goog.ui.style.app.MenuButtonRenderer
Classgoog.ui.style.app.MenuButtonRenderer
> goog.ui.style.app.ButtonRenderer
> goog.ui.CustomButtonRenderer
> goog.ui.ButtonRenderer
> goog.ui.ControlRenderer
goog.ui.style.app.MenuButtonRenderer()
Renderer for {@link goog.ui.style.app.MenuButton}s. This implementation overrides {@link goog.ui.style.app.ButtonRenderer#createButton} to insert a dropdown element into the content element after the specified content.
.CSS_CLASS
{string
}Default CSS class to be applied to the root element of components rendered by this renderer.
.IE6_CLASS_COMBINATIONS
{Array
.<Array
.<string
>>}Array of arrays of CSS classes that we want composite classes added and removed for in IE6 and lower as a workaround for lack of multi-class CSS selector support.
.canDecorate(element)
Inherited from goog.ui.CustomButtonRenderer
.
Returns true if this renderer can decorate the element. Overrides {@link goog.ui.ButtonRenderer#canDecorate} by returning true if the element is a DIV, false otherwise.
element
{Element
}
boolean
}
.createButton(content, dom)
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:
content
{goog.ui.ControlContent
}
dom
{goog.dom.DomHelper
}
Element
}
.createContentWithDropdown(content, dom)
Inserts dropdown element as last child of existing content.
content
{goog.ui.ControlContent
}
dom
{goog.dom.DomHelper
}
Array
.<Node
>}
.createDom
Inherited from goog.ui.style.app.ButtonRenderer
.
Returns the button's contents wrapped in the following DOM structure:
control
{goog.ui.Control
}
Element
}
.createDropdown(dom)
Returns an appropriately-styled DIV containing a dropdown arrow. Creates the following DOM structure:
dom
{goog.dom.DomHelper
}
Element
}
.decorate(control, element)
Takes an element, decorates it with the menu button control, and returns the element. Overrides {@link goog.ui.style.app.ButtonRenderer#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.
control
{goog.ui.Control
}
element
{Element
}
Element
}
.enableClassName(control, className, enable)
Inherited from goog.ui.ControlRenderer
.
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.
control
{goog.ui.Control
|Element
}
className
{string
}
enable
{boolean
}
.enableExtraClassName(control, className, enable)
Inherited from goog.ui.ControlRenderer
.
Updates the control's DOM by adding or removing the specified extra class name to/from its element.
control
{goog.ui.Control
}
className
{string
}
enable
{boolean
}
.getAriaRole()
Returns the ARIA role to be applied to menu buttons, which have a menu attached to them.
goog.dom.a11y.Role
}
.getClassForState(state)
[protected]Inherited from goog.ui.ControlRenderer
.
Takes a single {@link goog.ui.Component.State}, and returns the corresponding CSS class name (null if none).
state
{goog.ui.Component.State
}
string
|undefined
}
.getClassNames(control)
[protected]Inherited from goog.ui.ControlRenderer
.
Returns all CSS class names applicable to the given control, based on its state. The return value is an array of strings containing
control
{goog.ui.Control
}
Array
.<string
>}
.getClassNamesForState(state)
[protected]Inherited from goog.ui.ControlRenderer
.
Takes a bit mask of {@link goog.ui.Component.State}s, 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 {@link getClassForState} method to generate each state-specific class.
state
{number
}
Array
.<string
>}
.getContentElement(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.
element
{Element
}
Element
}
.getCssClass()
Returns the CSS class to be applied to the root element of components rendered using this renderer.
string
}
.getIe6ClassCombinations()
.getKeyEventTarget(control)
Inherited from goog.ui.ControlRenderer
.
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.
control
{goog.ui.Control
}
Element
}
.getStateFromClass(className)
[protected]Inherited from goog.ui.ControlRenderer
.
Takes a single CSS class name which may represent a component state, and returns the corresponding component state (0x00 if none).
className
{string
}
goog.ui.Component.State
}
.getStructuralCssClass()
Inherited from goog.ui.style.app.ButtonRenderer
.
.getTooltip(element)
Inherited from goog.ui.ButtonRenderer
.
Takes a button's root element, and returns its tooltip text.
element
{Element
}
string
|undefined
}
.getValue
Inherited from goog.ui.ButtonRenderer
.
Takes a button's root element, and returns the value associated with it. No-op in the base class.
element
{Element
}
string
|undefined
}
.hasBoxStructure(button, element)
[protected]Inherited from goog.ui.style.app.ButtonRenderer
.
Check if the button's element has a box structure.
button
{goog.ui.Button
}
element
{Element
}
boolean
}
.initializeDom(control)
Inherited from goog.ui.ControlRenderer
.
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 {@link goog.ui.Control#enterDocument}.
control
{goog.ui.Control
}
.isFocusable(control)
Inherited from goog.ui.ControlRenderer
.
Returns true if the control's key event target supports keyboard focus (based on its {@code tabIndex} attribute), false otherwise.
control
{goog.ui.Control
}
boolean
}
.setAllowTextSelection(element, allow)
Inherited from goog.ui.ControlRenderer
.
Allows or disallows text selection within the control's DOM.
element
{Element
}
allow
{boolean
}
.setAriaRole(element, opt_preferredRole)
Inherited from goog.ui.ControlRenderer
.
Sets the element's ARIA role.
element
{Element
}
opt_preferredRole
{?goog.dom.a11y.Role
=}
.setAriaStates(control, element)
Inherited from goog.ui.ControlRenderer
.
Sets the element's ARIA states. An element does not need an ARIA role in order to have an ARIA state. Only states which are initialized to be true will be set.
control
{!goog.ui.Control
}
element
{!Element
}
.setCollapsed(button, sides)
[protected]Inherited from goog.ui.ButtonRenderer
.
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.
button
{goog.ui.Button
}
sides
{number
}
.setContent()
.setFocusable(control, focusable)
Inherited from goog.ui.ControlRenderer
.
Updates the control's key event target to make it focusable or non-focusable via its {@code tabIndex} attribute. Does nothing if the control doesn't support the {@code FOCUSED} state, or if it has no key event target.
control
{goog.ui.Control
}
focusable
{boolean
}
.setRightToLeft(element, rightToLeft)
Inherited from goog.ui.ControlRenderer
.
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.
element
{Element
}
rightToLeft
{boolean
}
.setState(control, state, enable)
Inherited from goog.ui.ControlRenderer
.
Updates the appearance of the control in response to a state change.
control
{goog.ui.Control
}
state
{goog.ui.Component.State
}
enable
{boolean
}
.setTooltip(element, tooltip)
[protected]Inherited from goog.ui.ButtonRenderer
.
Takes a button's root element and a tooltip string, and updates the element with the new tooltip.
element
{Element
}
tooltip
{string
}
.setValue
Inherited from goog.ui.ButtonRenderer
.
Takes a button's root element and a value, and updates the element to reflect the new value. No-op in the base class.
element
{Element
}
value
{string
}
.setVisible(element, visible)
Inherited from goog.ui.ControlRenderer
.
Shows or hides the element.
element
{Element
}
visible
{boolean
}
.updateAriaState(element, state, enable)
[protected]Inherited from goog.ui.ButtonRenderer
.
Updates the button's ARIA (accessibility) state if the button is being treated as a checkbox.
element
{Element
}
state
{goog.ui.Component.State
}
enable
{boolean
}