goog.ui.NativeButtonRenderer
Classgoog.ui.NativeButtonRenderer
> goog.ui.ButtonRenderer
> goog.ui.ControlRenderer
goog.ui.NativeButtonRenderer()
Renderer for {@link goog.ui.Button}s. Renders and decorates native HTML button elements. Since native HTML buttons have built-in support for many features, overrides many expensive (and redundant) superclass methods to be no-ops.
.canDecorate(element)
Overrides {@link goog.ui.ButtonRenderer#canDecorate} by returning true only if the element is an HTML button.
element
{Element
}
boolean
}
.createDom(button)
Returns the button's contents wrapped in a native HTML button element. Sets the button's disabled attribute as needed.
button
{goog.ui.Control
}
Element
}
.decorate(control, element)
Default implementation of {@code decorate} for {@link goog.ui.Control}s. 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.
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 buttons.
goog.dom.a11y.Role
|undefined
}
.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)
Inherited from goog.ui.ControlRenderer
.
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.
element
{Element
}
Element
}
.getCssClass()
Inherited from goog.ui.ButtonRenderer
.
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.
string
}
.getIe6ClassCombinations()
Inherited from goog.ui.ControlRenderer
.
Returns an array of combinations of classes to apply combined class names for in IE6 and below. See {@link IE6_CLASS_COMBINATIONS} for more detail. This method doesn't reference {@link IE6_CLASS_COMBINATIONS} so that it can be compiled out, but subclasses should return their IE6_CLASS_COMBINATIONS static constant instead.
Array
.<Array
.<string
>>}
.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.ControlRenderer
.
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 {@link #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 {@link #getCssClass}, but subclasses are expected to override this method as needed.
string
}
.getTooltip(element)
Inherited from goog.ui.ButtonRenderer
.
Takes a button's root element, and returns its tooltip text.
element
{Element
}
string
|undefined
}
.getValue(element)
Takes a button's root element, and returns the value associated with it. No-op in the base class.
element
{Element
}
string
|undefined
}
.initializeDom()
Native buttons natively support BiDi and keyboard focus.
.isFocusable()
.setAllowTextSelection
.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(element, content)
Inherited from goog.ui.ControlRenderer
.
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.
element
{Element
}
content
{goog.ui.ControlContent
}
.setFocusable
.setRightToLeft
.setState()
.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(element, value)
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
[protected]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
}