ui.Dialog.ButtonSet Extends goog.structs.Map
A button set defines the behaviour of a set of buttons that the dialog can show. Uses the goog.structs.Map interface.

Inheritance

Constructor

goog.ui.Dialog.ButtonSet(opt_domHelper)

Parameters

opt_domHelper : goog.dom.DomHelper=
Optional DOM helper; see goog.ui.Component for semantics.

Instance Methods

Public Protected Private
addButton(opt_isDefaultopt_isCancel) !goog.ui.Dialog.ButtonSet
Adds a button (an object with a key and caption) to this button set. Buttons will be displayed in the order they are added.
Arguments:
: !{key: string, caption: string
No description.
opt_isDefault : boolean=
Whether this button is the default button. Dialog will dispatch for this button if enter is pressed.
opt_isCancel : boolean=
Whether this button has the same behavior as cancel. If escape is pressed this button will fire.
Returns: !goog.ui.Dialog.ButtonSet  The button set, to make it easy to chain "addButton" calls and build new ButtonSets.
code »
attachToElement(el)
Attaches the button set to an element, rendering it inside.
Arguments:
el : Element
Container.
code »
decorate(element)
Decorates the given element by adding any button elements found among its descendants to the button set. The first button found is assumed to be the default and will receive focus when the button set is rendered. If a button with a name of goog.ui.Dialog.DefaultButtonKeys.CANCEL is found, it is assumed to have "Cancel" semantics. TODO(attila): ButtonSet should be a goog.ui.Component. Really.
Arguments:
element : Element
The element to decorate; should contain buttons.
code »
getAllButtons() !NodeList
Returns all the HTML Button elements in the button set container.
Returns: !NodeList  A live NodeList of the buttons.
code »
getButton(key) Element
Returns the HTML Button element.
Arguments:
key : string
The button to return.
Returns: Element  The button, if found else null.
code »
getCancel() ?string
Returns the cancel button.
Returns: ?string  The cancel button.
code »
getDefault() ?string
Returns the default button.
Returns: ?string  The default button.
code »
getDomHelper() !goog.dom.DomHelper
Returns the dom helper that is being used on this component.
Returns: !goog.dom.DomHelper  The dom helper used on this component. TODO(user): Remove after refactoring to goog.ui.Component.
code »
getElement() Element
Gets the component's element.
Returns: Element  The element for the component. TODO(user): Remove after refactoring to goog.ui.Component.
code »
render()
Renders the button set inside its container element.
code »
set(keycaptionopt_isDefaultopt_isCancel) !goog.ui.Dialog.ButtonSet
Adds a button to the button set. Buttons will be displayed in the order they are added.
Arguments:
key : *
Key used to identify the button in events.
caption : *
A string caption or a DOM node that can be appended to a button element.
opt_isDefault : boolean=
Whether this button is the default button, Dialog will dispatch for this button if enter is pressed.
opt_isCancel : boolean=
Whether this button has the same behaviour as cancel. If escape is pressed this button will fire.
Returns: !goog.ui.Dialog.ButtonSet  The button set, to make it easy to chain "set" calls and build new ButtonSets.
code »
setAllButtonsEnabled(enabled)
Enables or disables all of the buttons in this set.
Arguments:
enabled : boolean
True to enable; false to disable.
code »
setButtonEnabled(keyenabled)
Enables or disables a button in this set by key. If the button is not found, does nothing.
Arguments:
key : string
The button to enable or disable.
enabled : boolean
True to enable; false to disable.
code »
setCancel(key)
Sets the cancel button.
Arguments:
key : ?string
The cancel button.
code »
setDefault(key)
Sets the default button.
Arguments:
key : ?string
The default button.
code »
__iterator__(opt_keys) !goog.iter.Iterator
Returns an iterator that iterates over the values or the keys in the map. This throws an exception if the map was mutated since the iterator was created.
Arguments:
opt_keys : boolean=
True to iterate over the keys. False to iterate over the values. The default value is false.
Returns: !goog.iter.Iterator  An iterator over the values or keys in the map.
code »
addAll(map)
Adds multiple key-value pairs from another goog.structs.Map or Object.
Arguments:
map : Object
Object containing the data to add.
code »
cleanupKeysArray_()
Cleans up the temp keys array by removing entries that are no longer in the map.
code »
clear()
Removes all key-value pairs from the map.
code »
clone() !goog.structs.Map
Clones a map and returns a new map.
Returns: !goog.structs.Map  A new map with the same key-value pairs.
code »
containsKey(key) boolean
Whether the map contains the given key.
Arguments:
key : *
The key to check for.
Returns: boolean  Whether the map contains the key.
code »
containsValue(val) boolean
Whether the map contains the given value. This is O(n).
Arguments:
val : V
The value to check for.
Returns: boolean  Whether the map contains the value.
code »
equals(otherMapopt_equalityFn) boolean
Whether this map is equal to the argument map.
Arguments:
otherMap : goog.structs.Map
The map against which to test equality.
opt_equalityFn : function(V, V): boolean=
Optional equality function to test equality of values. If not specified, this will test whether the values contained in each map are identical objects.
Returns: boolean  Whether the maps are equal.
code »
forEach(fopt_obj)
Calls the given function on each entry in the map.
Arguments:
f : function(this:T, V, K, goog.structs.Map.<K,V>)
No description.
opt_obj : T=
The value of "this" inside f.
code »
get(keyopt_val) V | DEFAULT
Returns the value for the given key. If the key is not found and the default value is not given this will return undefined.
Arguments:
key : *
The key to get the value for.
opt_val : DEFAULT=
The value to return if no item is found for the given key, defaults to undefined.
Returns: V | DEFAULT  The value for the given key.
code »
getCount() number
No description.
Returns: number  The number of key-value pairs in the map.
code »
getKeyIterator() !goog.iter.Iterator
Returns an iterator that iterates over the keys in the map. Removal of keys while iterating might have undesired side effects.
Returns: !goog.iter.Iterator  An iterator over the keys in the map.
code »
getKeys() !Array.<string>
Returns the keys of the map.
Returns: !Array.<string>  Array of string values.
code »
getValueIterator() !goog.iter.Iterator
Returns an iterator that iterates over the values in the map. Removal of keys while iterating might have undesired side effects.
Returns: !goog.iter.Iterator  An iterator over the values in the map.
code »
getValues() !Array.<V>
Returns the values of the map.
Returns: !Array.<V>  The values in the map.
code »
isEmpty() boolean
No description.
Returns: boolean  Whether the map is empty.
code »
remove(key) boolean
Removes a key-value pair based on the key. This is O(logN) amortized due to updating the keys array whenever the count becomes half the size of the keys in the keys array.
Arguments:
key : *
The key to remove.
Returns: boolean  Whether object was removed.
code »
set(keyvalue) *
Adds a key-value pair to the map.
Arguments:
key : *
The key.
value : V
The value to add.
Returns: *  Some subclasses return a value.
code »
toObject() !Object
No description.
Returns: !Object  Object representation of the map.
code »
transpose() !goog.structs.Map
Returns a new map in which all the keys and values are interchanged (keys become values and values become keys). If multiple keys map to the same value, the chosen transposed value is implementation-dependent. It acts very similarly to {goog.object.transpose(Object)}.
Returns: !goog.structs.Map  The transposed map.
code »

Instance Properties

cancelButton_ :
The button whose action is associated with the escape key and the X button on the dialog.
Code »
class_ :
A CSS className for this component.
Code »
constructor :
No description.
Code »
defaultButton_ :
The button that has default focus (references key in buttons_ map).
Code »
No description.
Code »
element_ :
Optional container the button set should be rendered into.
Code »
count_ :
The number of key value pairs in the map.
Code »
keys_ :
An array of keys. This is necessary for two reasons: 1. Iterating the keys using for (var key in this.map_) allocates an object for every key in IE which is really bad for IE6 GC perf. 2. Without a side data structure, we would need to escape all the keys as that would be the only way we could tell during iteration if the key was an internal key or a property of the object. This array can contain deleted keys so it's necessary to check the map as well to see if the key is still in the map (this doesn't require a memory allocation in IE).
Code »
map_ :
Underlying JS object used to implement the map.
Code »
version_ :
Version used to detect changes while iterating.
Code »

Static Methods

goog.ui.Dialog.ButtonSet.createContinueSaveCancel() !goog.ui.Dialog.ButtonSet
Creates a new ButtonSet with 'Continue', 'Save', and 'Cancel' (default) buttons.
Returns: !goog.ui.Dialog.ButtonSet  The created ButtonSet.
code »
goog.ui.Dialog.ButtonSet.createOk() !goog.ui.Dialog.ButtonSet
Creates a new ButtonSet with a single 'OK' button, which is also set with cancel button semantics so that pressing escape will close the dialog.
Returns: !goog.ui.Dialog.ButtonSet  The created ButtonSet.
code »
goog.ui.Dialog.ButtonSet.createOkCancel() !goog.ui.Dialog.ButtonSet
Creates a new ButtonSet with 'OK' (default) and 'Cancel' buttons.
Returns: !goog.ui.Dialog.ButtonSet  The created ButtonSet.
code »
goog.ui.Dialog.ButtonSet.createYesNo() !goog.ui.Dialog.ButtonSet
Creates a new ButtonSet with 'Yes' (default) and 'No' buttons.
Returns: !goog.ui.Dialog.ButtonSet  The created ButtonSet.
code »
goog.ui.Dialog.ButtonSet.createYesNoCancel() !goog.ui.Dialog.ButtonSet
Creates a new ButtonSet with 'Yes', 'No' (default), and 'Cancel' buttons.
Returns: !goog.ui.Dialog.ButtonSet  The created ButtonSet.
code »

Static Properties

goog.ui.Dialog.ButtonSet.CONTINUE_SAVE_CANCEL : goog.ui.Dialog.ButtonSet
No description.
Code »
goog.ui.Dialog.ButtonSet.OK : goog.ui.Dialog.ButtonSet
No description.
Code »
goog.ui.Dialog.ButtonSet.OK_CANCEL : goog.ui.Dialog.ButtonSet
No description.
Code »
goog.ui.Dialog.ButtonSet.YES_NO : goog.ui.Dialog.ButtonSet
No description.
Code »
goog.ui.Dialog.ButtonSet.YES_NO_CANCEL : goog.ui.Dialog.ButtonSet
No description.
Code »
goog.ui.Dialog.ButtonSet.superClass_ :
No description.
Code »

Enumerations

goog.ui.Dialog.ButtonSet.DefaultButtons :
The standard buttons (keys associated with captions).
Constants:
CANCEL
No description.
CONTINUE
No description.
NO
No description.
OK
No description.
SAVE
No description.
YES
No description.
Code »

Package ui.Dialog

Package Reference