goog.ui.ToolbarColorMenuButtonRenderer
Provided By | |
---|---|
Extends |
Toolbar-style renderer for goog.ui.ColorMenuButton
s.
new ToolbarColorMenuButtonRenderer()
Parameters | None. |
---|
Instance Methods
this.canDecorate( element ) → boolean
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.
Defined by | |||||
---|---|---|---|---|---|
Overrides | |||||
Parameters |
| ||||
Returns |
|
this.createButton( content, dom ) → Element
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:
<div class="goog-inline-block goog-menu-button-outer-box">
<div class="goog-inline-block goog-menu-button-inner-box">
<div class="goog-inline-block goog-menu-button-caption">
Contents...
</div>
<div class="goog-inline-block goog-menu-button-dropdown">
</div>
</div>
</div>
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Overrides | |||||||||
Parameters |
| ||||||||
Returns |
|
this.createCaption( content, dom ) → Element
Element
Overrides the superclass implementation by wrapping the caption text or DOM structure in a color indicator element. Creates the following DOM structure:
<div class="goog-inline-block goog-toolbar-menu-button-caption">
<div class="goog-color-menu-button-indicator">
Contents...
</div>
</div>
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
| ||||||||
Returns |
| ||||||||
See Also |
this.createDom( control ) → Element
Element
Returns the button's contents wrapped in the following DOM structure:
<div class="goog-inline-block goog-custom-button">
<div class="goog-inline-block goog-custom-button-outer-box">
<div class="goog-inline-block goog-custom-button-inner-box">
Contents...
</div>
</div>
</div>
Overrides goog.ui.ButtonRenderer#createDom
.
Defined by | |||||
---|---|---|---|---|---|
Overrides | |||||
Parameters |
| ||||
Returns |
|
this.createDropdown( dom ) → Element
Element
Returns an appropriately-styled DIV containing a dropdown arrow element. Creates the following DOM structure:
<div class="goog-inline-block goog-menu-button-dropdown">
</div>
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.decorate( control, element ) → (Element|null)
(Element|null)
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Overrides | |||||||||
Parameters |
| ||||||||
Returns |
|
this.enableClassName( control, className, enable ) → void
void
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.
Defined by | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.enableExtraClassName( control, className, enable ) → void
void
Updates the control's DOM by adding or removing the specified extra class name to/from its element.
Defined by | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.getAriaRole() → (goog.a11y.aria.Role|undefined)
(goog.a11y.aria.Role|undefined)
Returns the ARIA role to be applied to custom buttons.
Defined by | |||
---|---|---|---|
Overrides | |||
Parameters | None. | ||
Returns |
|
this.getClassForState( state ) → (string|undefined)
(string|undefined)
Takes a single goog.ui.Component.State
, and returns the
corresponding CSS class name (null if none).
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
Returns all CSS class names applicable to the given control, based on its state. The return value is an array of strings containing
- the renderer-specific CSS class returned by
#getCssClass
, followed by - the structural CSS class returned by
getStructuralCssClass
(if different from the renderer-specific CSS class), followed by - any state-specific classes returned by
#getClassNamesForState
, followed by - any extra classes returned by the control's `getExtraClassNames` method and
- for IE6 and lower, additional combined classes from
getAppliedCombinedClassNames_
.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
Takes a bit mask of 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 getClassForState
method to
generate each state-specific class.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.getContentElement( element ) → (Element|null)
(Element|null)
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.
Defined by | |||||
---|---|---|---|---|---|
Overrides | |||||
Parameters |
| ||||
Returns |
|
this.getCssClass() → string
string
Returns the CSS class to be applied to the root element of menu buttons rendered using this renderer.
Defined by | |||
---|---|---|---|
Overrides | |||
Parameters | None. | ||
Returns |
|
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.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getKeyEventTarget( control ) → (Element|null)
(Element|null)
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.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.getStateFromClass( className ) → goog.ui.Component.State
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).
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.getStructuralCssClass() → string
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.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getTooltip( element ) → (string|undefined)
(string|undefined)
Takes a button's root element, and returns its tooltip text.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.getValue( element ) → (string|undefined)
(string|undefined)
Takes a button's root element, and returns the value associated with it. No-op in the base class.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.hasBoxStructure( button, element ) → boolean
boolean
Check if the button's element has a box structure.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
| ||||||||
Returns |
|
this.initializeDom( button ) → void
void
Initializes the button's DOM when it enters the document. Overrides the superclass implementation by making sure the button's color indicator is initialized.
Overrides | |||||
---|---|---|---|---|---|
Parameters |
|
this.isFocusable( control ) → boolean
boolean
Returns true if the control's key event target supports keyboard focus
(based on its tabIndex
attribute), false otherwise.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns |
|
this.setAllowTextSelection( element, allow ) → void
void
Allows or disallows text selection within the control's DOM.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setAriaLabel( element, ariaLabel ) → void
void
Sets the element's ARIA label. This should be overriden by subclasses that don't apply the role directly on control.element_.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setAriaRole( element, opt_preferredRole ) → void
void
Sets the element's ARIA role.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setAriaStates( control, element ) → void
void
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setCollapsed( button, sides ) → void
void
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setContent( element, content ) → void
void
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setFocusable( control, focusable ) → void
void
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setRightToLeft( element, rightToLeft ) → void
void
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.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setState( control, state, enable ) → void
void
Updates the appearance of the control in response to a state change.
Defined by | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setTooltip( element, tooltip ) → void
void
Takes a button's root element and a tooltip string, and updates the element with the new tooltip.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setValue( element, value ) → void
void
Takes a color menu button control's root element and a value object
(which is assumed to be a color), and updates the button's DOM to reflect
the new color. Overrides goog.ui.ButtonRenderer#setValue
.
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setVisible( element, visible ) → void
void
Shows or hides the element.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.updateAriaState( element, state, enable ) → void
void
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.
Defined by | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Overrides | |||||||||||||
Parameters |
|
Static Functions
ToolbarColorMenuButtonRenderer.getInstance() → goog.ui.ToolbarColorMenuButtonRenderer
goog.ui.ToolbarColorMenuButtonRenderer
Parameters | None. | |
---|---|---|
Returns |
|