H.ui.base.Button
Class Summary
Extends: H.ui.base.Element
This class represents a button.
[ For full details, see the Class Details ]
Method Summary
Methods |
---|
This method retrieves the current state of the button. |
This method sets the state of this button. |
This method retrieves the label string for the given button. |
This method sets the label string for the given button object. |
This method sets a listener for a specific event triggered by the given element. |
This method removes a previously added listener from the event target. |
This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes. |
This method retrieves a value indicating if the given UI element is disabled. |
This method sets a value indicating if the given UI element is disabled. |
This method retrieves previously stored arbitrary data from the given element. |
This method stores arbitrary data with the given UI element. |
This method retrieves the HTML element the given UI element renders. |
This method sets a value indicating if the given element is visible. |
This method retrieves a value indicating if the given element is visibile. |
This method adds a CSS class to the given UI element (if it is not already present). |
This method removes a CSS class from the given UI element (if it is present). |
Events Summary
Events |
---|
This event is dispatched by the button when its state changes. |
Class Description
This class represents a button.
Constructor Details
H.ui.base.Button(opt_options)
- Parameters:
-
opt_options
: -
{H.ui.base.Button.Options=} [optional]
- Optional parameters to be passed to the button instance
Method Details
getState () : {H.ui.base.Button.State}
This method retrieves the current state of the button.
- Returns:
-
{H.ui.base.Button.State}
- The current state of the button
setState (state, opt_suppressEvent) : {H.ui.base.Button}
This method sets the state of this button.
- Parameters:
-
state
: -
{H.ui.base.Button.State}
- A value to which the button is to be set
-
opt_suppressEvent
: -
{boolean=} [optional]
- An optional flag indicating that the
onStateChange
callback is not to be invoked
- Returns:
-
{H.ui.base.Button}
- An object representing this button instance
getLabel () : {string}
This method retrieves the label string for the given button.
- Returns:
-
{string}
- The label string for the button
setLabel (label, opt_force) : {H.ui.base.Button}
This method sets the label string for the given button object.
- Parameters:
-
label
: -
{string}
- The label to set on the given button object
-
opt_force
: -
{boolean=} [optional]
- A Boolean flag indicating if the new label should be set and propagated even if it has the same value as the current one (
true
) or not (false
).
- Returns:
-
{H.ui.base.Button}
- An object representing the given button object instance
addEventListener (type, handler, opt_capture, opt_scope)
This method sets a listener for a specific event triggered by the given element.
- Parameters:
-
type
: -
{string}
- The name of the event type
-
handler
: -
{!Function}
- An event handler function to be invoked when the event is fired
-
opt_capture
: -
{boolean=} [optional]
- If
true
, listening is active in the capture phase (bubble otherwise) -
opt_scope
: -
{Object=} [optional]
- The scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method removes a previously added listener from the event target.
- Parameters:
-
type
: -
{string}
- The name of the event type
-
handler
: -
{!Function}
- The previously added event handler
-
opt_capture
: -
{boolean=} [optional]
- If
true
, listening is active in the capture phase (bubble otherwise) -
opt_scope
: -
{Object=} [optional]
- The scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.
- Parameters:
-
element
: -
{Element}
- The HTML representation of the given UI element
-
doc
: -
{Document}
- The HTML document into which the give UI element is rendered
isDisabled () : {boolean}
This method retrieves a value indicating if the given UI element is disabled.
- Returns:
-
{boolean}
-
true
if the element is disabled,false
otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method sets a value indicating if the given UI element is disabled.
- Parameters:
-
disabled
: -
{boolean}
-
true
to disable the element,false
to enable it -
opt_force
: -
{boolean=} [optional]
- An optional Boolean flag indicating that the value should be set and propagated even if it is the same as the current state
- Returns:
-
{H.ui.base.Element}
- An object representing the given element instance
getData () : {*}
This method retrieves previously stored arbitrary data from the given element.
- Returns:
-
{*}
- The previously stored data object or
null
if no data was stored.
setData (data)
This method stores arbitrary data with the given UI element.
- Parameters:
-
data
: -
{*}
- The data to be stored
getElement () : {?HTMLElement}
This method retrieves the HTML element the given UI element renders.
Note: If the UI element has not been rendered, the method retrieves null
.
- Returns:
-
{?HTMLElement}
- An object representing the given element instance or
null
setVisibility (visibility)
This method sets a value indicating if the given element is visible.
- Parameters:
-
visibility
: -
{boolean}
-
true
if the given element is visible, otherwisefalse
getVisibility () : {boolean}
This method retrieves a value indicating if the given element is visibile.
- Returns:
-
{boolean}
-
true
if the given element is visible, otherwisefalse
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to the given UI element (if it is not already present).
- Parameters:
-
className
: -
{string}
- The name of the CSS class to add
- Returns:
-
{H.ui.base.Element}
- The given UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from the given UI element (if it is present).
- Parameters:
-
className
: -
{string}
- The CSS class name to add
- Returns:
-
{H.ui.base.Element}
- The given UI element instance
Event Details
statechange: {H.util.Event}
This event is dispatched by the button when its state changes.