ui.ToolbarMenuButtonRenderer Extends goog.ui.MenuButtonRenderer
Toolbar-specific renderer for goog.ui.MenuButtons, based on goog.ui.MenuButtonRenderer.

Inheritance

Constructor

goog.ui.ToolbarMenuButtonRenderer()

Instance Methods

Public Protected Private
getCssClass() string
Returns the CSS class to be applied to the root element of menu buttons rendered using this renderer.
Returns: string  Renderer-specific CSS class.
code »
createButton(contentdom) Element
Takes a text caption or existing DOM structure, and returns the content and a dropdown arrow element wrapped in a pseudo-rounded-corner box. Creates the following DOM structure:
Contents...
 
Arguments:
content : goog.ui.ControlContent
Text caption or DOM structure to wrap in a box.
dom : goog.dom.DomHelper
DOM helper, used for document interaction.
Returns: Element  Pseudo-rounded-corner box containing the content.
code »
createCaption(contentdom) Element
Takes a text caption or existing DOM structure, and returns it wrapped in an appropriately-styled DIV. Creates the following DOM structure:
Contents...
Arguments:
content : goog.ui.ControlContent
Text caption or DOM structure to wrap in a box.
dom : goog.dom.DomHelper
DOM helper, used for document interaction.
Returns: Element  Caption element.
code »
createDropdown(dom) Element
Returns an appropriately-styled DIV containing a dropdown arrow element. Creates the following DOM structure:
 
Arguments:
dom : goog.dom.DomHelper
DOM helper, used for document interaction.
Returns: Element  Dropdown element.
code »
decorate(controlelement) Element
Takes an element, decorates it with the menu button control, and returns the element. Overrides goog.ui.CustomButtonRenderer#decorate by looking for a child element that can be decorated by a menu, and if it finds one, decorates it and attaches it to the menu button.
Arguments:
control : goog.ui.Control
goog.ui.MenuButton to decorate the element.
element : Element
Element to decorate.
Returns: Element  Decorated element.
code »
getContentElement(element) Element
Takes the button's root element and returns the parent element of the button's contents. Overrides the superclass implementation by taking the nested DIV structure of menu buttons into account.
Arguments:
element : Element
Root element of the button whose content element is to be returned.
Returns: Element  The button's content element.
code »
getCssClass() string
Returns the CSS class to be applied to the root element of components rendered using this renderer.
Returns: string  Renderer-specific CSS class.
code »
canDecorate(element) boolean
Returns true if this renderer can decorate the element. Overrides goog.ui.ButtonRenderer#canDecorate by returning true if the element is a DIV, false otherwise.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
createButton(contentdom) Element
Takes a text caption or existing DOM structure, and returns the content wrapped in a pseudo-rounded-corner box. Creates the following DOM structure:
Contents...
Used by both #createDom and #decorate. To be overridden by subclasses.
Arguments:
content : goog.ui.ControlContent
Text caption or DOM structure to wrap in a box.
dom : goog.dom.DomHelper
DOM helper, used for document interaction.
Returns: Element  Pseudo-rounded-corner box containing the content.
code »
createDom(control) Element
Returns the button's contents wrapped in the following DOM structure:
Contents...
Overrides goog.ui.ButtonRenderer#createDom.
Arguments:
control : goog.ui.Control
goog.ui.Button to render.
Returns: Element  Root element for the button.
code »
decorate(controlelement) Element
Takes an existing element and decorates it with the custom button control. Initializes the control's ID, content, tooltip, value, and state based on the ID of the element, its child nodes, and its CSS classes, respectively. Returns the element. Overrides goog.ui.ButtonRenderer#decorate.
Arguments:
control : goog.ui.Control
Button instance to decorate the element.
element : Element
Element to decorate.
Returns: Element  Decorated element.
code »
getAriaRole() goog.a11y.aria.Role | undefined
Returns the ARIA role to be applied to custom buttons.
Returns: goog.a11y.aria.Role | undefined  ARIA role.
code »
getContentElement(element) Element
Takes the button's root element and returns the parent element of the button's contents. Overrides the superclass implementation by taking the nested DIV structure of custom buttons into account.
Arguments:
element : Element
Root element of the button whose content element is to be returned.
Returns: Element  The button's content element (if any).
code »
getCssClass() string
Returns the CSS class to be applied to the root element of components rendered using this renderer.
Returns: string  Renderer-specific CSS class.
code »
hasBoxStructure(buttonelement) boolean
Check if the button's element has a box structure.
Arguments:
button : goog.ui.Button
Button instance whose structure is being checked.
element : Element
Element of the button.
Returns: boolean  Whether the element has a box structure.
code »
createDom()
No description.
code »
decorate()
No description.
code »
getAriaRole() goog.a11y.aria.Role | undefined
Returns the ARIA role to be applied to buttons.
Returns: goog.a11y.aria.Role | undefined  ARIA role.
code »
getCssClass()
No description.
code »
getTooltip(element) string | undefined
Takes a button's root element, and returns its tooltip text.
Arguments:
element : Element
The button's root element.
Returns: string | undefined  The tooltip text.
code »
getValue(element) string | undefined
Takes a button's root element, and returns the value associated with it. No-op in the base class.
Arguments:
element : Element
The button's root element.
Returns: string | undefined  The button's value (undefined if none).
code »
setCollapsed(buttonsides)
Collapses the border on one or both sides of the button, allowing it to be combined with the adjacent button(s), forming a single UI componenet with multiple targets.
Arguments:
button : goog.ui.Button
Button to update.
sides : number
Bitmap of one or more goog.ui.ButtonSides for which borders should be collapsed.
code »
setTooltip(elementtooltip)
Takes a button's root element and a tooltip string, and updates the element with the new tooltip.
Arguments:
element : Element
The button's root element.
tooltip : string
New tooltip text.
code »
setValue(elementvalue)
Takes a button's root element and a value, and updates the element to reflect the new value. No-op in the base class.
Arguments:
element : Element
The button's root element.
value : string
New value.
code »
updateAriaState(elementstateenable)
Updates the button's ARIA (accessibility) state if the button is being treated as a checkbox. Also makes sure that attributes which aren't supported by buttons aren't being added.
Arguments:
element : Element
Element whose ARIA state is to be updated.
state : goog.ui.Component.State
Component state being enabled or disabled.
enable : boolean
Whether the state is being enabled or disabled.
code »
canDecorate(element) boolean
Returns true if this renderer can decorate the element, false otherwise. The default implementation always returns true.
Arguments:
element : Element
Element to decorate.
Returns: boolean  Whether the renderer can decorate the element.
code »
createClassByStateMap_()
Creates the lookup table of states to classes, used during state changes.
code »
createDom(control) Element
Returns the control's contents wrapped in a DIV, with the renderer's own CSS class and additional state-specific classes applied to it.
Arguments:
control : goog.ui.Control
Control to render.
Returns: Element  Root element for the control.
code »
createStateByClassMap_()
Creates the lookup table of classes to states, used during decoration.
code »
decorate(controlelement) Element
Default implementation of decorate for goog.ui.Controls. Initializes the control's ID, content, and state based on the ID of the element, its child nodes, and its CSS classes, respectively. Returns the element.
Arguments:
control : goog.ui.Control
Control instance to decorate the element.
element : Element
Element to decorate.
Returns: Element  Decorated element.
code »
enableClassName(controlclassNameenable)
Updates the control's DOM by adding or removing the specified class name to/from its root element. May add additional combined classes as needed in IE6 and lower. Because of this, subclasses should use this method when modifying class names on the control's root element.
Arguments:
control : goog.ui.Control | Element
Control instance (or root element) to be updated.
className : string
CSS class name to add or remove.
enable : boolean
Whether to add or remove the class name.
code »
enableExtraClassName(controlclassNameenable)
Updates the control's DOM by adding or removing the specified extra class name to/from its element.
Arguments:
control : goog.ui.Control
Control to be updated.
className : string
CSS class name to add or remove.
enable : boolean
Whether to add or remove the class name.
code »
getAppliedCombinedClassNames_(classesopt_includedClass) !Array.<string>
Returns an array of all the combined class names that should be applied based on the given list of classes. Checks the result of getIe6ClassCombinations for any combinations that have all members contained in classes. If a combination matches, the members are joined with an underscore (in order), and added to the return array. If opt_includedClass is provided, return only the combined classes that have all members contained in classes AND include opt_includedClass as well. opt_includedClass is added to classes as well.
Arguments:
classes : goog.array.ArrayLike.<string>
Array-like thing of classes to return matching combined classes for.
opt_includedClass : ?string=
If provided, get only the combined classes that include this one.
Returns: !Array.<string>  Array of combined class names that should be applied.
code »
getAriaRole() goog.a11y.aria.Role | undefined
Returns the ARIA role to be applied to the control. See http://wiki/Main/ARIA for more info.
Returns: goog.a11y.aria.Role | undefined  ARIA role.
code »
getClassForState(state) string | undefined
Takes a single goog.ui.Component.State, and returns the corresponding CSS class name (null if none).
Arguments:
state : goog.ui.Component.State
Component state.
Returns: string | undefined  CSS class representing the given state (undefined if none).
code »
getClassNames(control) !Array.<string>
Returns all CSS class names applicable to the given control, based on its state. The return value is an array of strings containing
  1. the renderer-specific CSS class returned by #getCssClass, followed by
  2. the structural CSS class returned by getStructuralCssClass (if different from the renderer-specific CSS class), followed by
  3. any state-specific classes returned by #getClassNamesForState, followed by
  4. any extra classes returned by the control's getExtraClassNames method and
  5. for IE6 and lower, additional combined classes from getAppliedCombinedClassNames_.
Since all controls have at least one renderer-specific CSS class name, this method is guaranteed to return an array of at least one element.
Arguments:
control : goog.ui.Control
Control whose CSS classes are to be returned.
Returns: !Array.<string>  Array of CSS class names applicable to the control.
code »
getClassNamesForState(state) !Array.<string>
Takes a bit mask of goog.ui.Component.States, and returns an array of the appropriate class names representing the given state, suitable to be applied to the root element of a component rendered using this renderer, or null if no state-specific classes need to be applied. This default implementation uses the renderer's getClassForState method to generate each state-specific class.
Arguments:
state : number
Bit mask of component states.
Returns: !Array.<string>  Array of CSS class names representing the given state.
code »
getContentElement(element) Element
Takes the control's root element and returns the parent element of the control's contents. Since by default controls are rendered as a single DIV, the default implementation returns the element itself. Subclasses with more complex DOM structures must override this method as needed.
Arguments:
element : Element
Root element of the control whose content element is to be returned.
Returns: Element  The control's content element.
code »
getCssClass() string
Returns the CSS class name to be applied to the root element of all components rendered or decorated using this renderer. The class name is expected to uniquely identify the renderer class, i.e. no two renderer classes are expected to share the same CSS class name.
Returns: string  Renderer-specific CSS class name.
code »
getIe6ClassCombinations() Array.<Array.<string>>
Returns an array of combinations of classes to apply combined class names for in IE6 and below. See IE6_CLASS_COMBINATIONS for more detail. This method doesn't reference IE6_CLASS_COMBINATIONS so that it can be compiled out, but subclasses should return their IE6_CLASS_COMBINATIONS static constant instead.
Returns: Array.<Array.<string>>  Array of class name combinations.
code »
getKeyEventTarget(control) Element
Returns the element within the component's DOM that should receive keyboard focus (null if none). The default implementation returns the control's root element.
Arguments:
control : goog.ui.Control
Control whose key event target is to be returned.
Returns: Element  The key event target.
code »
getStateFromClass(className) goog.ui.Component.State
Takes a single CSS class name which may represent a component state, and returns the corresponding component state (0x00 if none).
Arguments:
className : string
CSS class name, possibly representing a component state.
Returns: goog.ui.Component.State  state Component state corresponding to the given CSS class (0x00 if none).
code »
getStructuralCssClass() string
Returns the name of a DOM structure-specific CSS class to be applied to the root element of all components rendered or decorated using this renderer. Unlike the class name returned by #getCssClass, the structural class name may be shared among different renderers that generate similar DOM structures. The structural class name also serves as the basis of derived class names used to identify and style structural elements of the control's DOM, as well as the basis for state-specific class names. The default implementation returns the same class name as #getCssClass, but subclasses are expected to override this method as needed.
Returns: string  DOM structure-specific CSS class name (same as the renderer- specific CSS class name by default).
code »
initializeDom(control)
Initializes the control's DOM by configuring properties that can only be set after the DOM has entered the document. This implementation sets up BiDi and keyboard focus. Called from goog.ui.Control#enterDocument.
Arguments:
control : goog.ui.Control
Control whose DOM is to be initialized as it enters the document.
code »
isFocusable(control) boolean
Returns true if the control's key event target supports keyboard focus (based on its tabIndex attribute), false otherwise.
Arguments:
control : goog.ui.Control
Control whose key event target is to be checked.
Returns: boolean  Whether the control's key event target is focusable.
code »
setAllowTextSelection(elementallow)
Allows or disallows text selection within the control's DOM.
Arguments:
element : Element
The control's root element.
allow : boolean
Whether the element should allow text selection.
code »
setAriaRole(elementopt_preferredRole)
Sets the element's ARIA role.
Arguments:
element : Element
Element to update.
opt_preferredRole : ?goog.a11y.aria.Role=
The preferred ARIA role.
code »
setAriaStates(controlelement)
Sets the element's ARIA attributes, including distinguishing between universally supported ARIA properties and ARIA states that are only supported by certain ARIA roles. Only attributes which are initialized to be true will be set.
Arguments:
control : !goog.ui.Control
Control whose ARIA state will be updated.
element : !Element
Element whose ARIA state is to be updated.
code »
setContent(elementcontent)
Takes a control's root element, and sets its content to the given text caption or DOM structure. The default implementation replaces the children of the given element. Renderers that create more complex DOM structures must override this method accordingly.
Arguments:
element : Element
The control's root element.
content : goog.ui.ControlContent
Text caption or DOM structure to be set as the control's content. The DOM nodes will not be cloned, they will only moved under the content element of the control.
code »
setFocusable(controlfocusable)
Updates the control's key event target to make it focusable or non-focusable via its tabIndex attribute. Does nothing if the control doesn't support the FOCUSED state, or if it has no key event target.
Arguments:
control : goog.ui.Control
Control whose key event target is to be updated.
focusable : boolean
Whether to enable keyboard focus support on the control's key event target.
code »
setRightToLeft(elementrightToLeft)
Applies special styling to/from the control's element if it is rendered right-to-left, and removes it if it is rendered left-to-right.
Arguments:
element : Element
The control's root element.
rightToLeft : boolean
Whether the component is rendered right-to-left.
code »
setState(controlstateenable)
Updates the appearance of the control in response to a state change.
Arguments:
control : goog.ui.Control
Control instance to update.
state : goog.ui.Component.State
State to enable or disable.
enable : boolean
Whether the control is entering or exiting the state.
code »
setVisible(elementvisible)
Shows or hides the element.
Arguments:
element : Element
Element to update.
visible : boolean
Whether to show the element.
code »
updateAriaState(elementstateenable)
Updates the element's ARIA (accessibility) attributes , including distinguishing between universally supported ARIA properties and ARIA states that are only supported by certain ARIA roles.
Arguments:
element : Element
Element whose ARIA state is to be updated.
state : goog.ui.Component.State
Component state being enabled or disabled.
enable : boolean
Whether the state is being enabled or disabled.
code »

Instance Properties

constructor :
No description.
Code »
constructor :
No description.
Code »
constructor :
No description.
Code »
constructor :
No description.
Code »
classByState_ :
Map of component states to state-specific structural class names, used when changing the DOM in response to a state change. Precomputed and cached on first use to minimize object allocations and string concatenation.
Code »
stateByClass_ :
Map of state-specific structural class names to component states, used during element decoration. Precomputed and cached on first use to minimize object allocations and string concatenation.
Code »

Static Methods

goog.ui.ToolbarMenuButtonRenderer.getInstance()
No description.
code »

Static Properties

goog.ui.ToolbarMenuButtonRenderer.CSS_CLASS :
Default CSS class to be applied to the root element of menu buttons rendered by this renderer.
Code »
goog.ui.ToolbarMenuButtonRenderer.instance_ :
No description.
Code »
goog.ui.ToolbarMenuButtonRenderer.superClass_ :
No description.
Code »

Package ui

Package Reference