This class represents a button.
| Name | Type | Description |
|---|---|---|
opt_options |
H.ui.base.Button.Options |
optional
Optional parameters to be passed to the button instance |
Extends
Members
-
This enumeration represents the possible state a button can have, namely 'UP' and 'DOWN'
Properties:
Name Description UPThe button's state when it is not pressed. ('up')
DOWNThe button's state when it is pressed. ('down')
Methods
-
addClass (className)H.ui.base.Element inherited
-
This method adds a CSS class to the given UI element (if it is not already present).
Name Type Description classNamestring The name of the CSS class to add
Returns:
Type Description H.ui.base.Element The given UI element instance -
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method sets a listener for a specific event triggered by the given element.
Name Type Description typestring The name of the event type
handlerfunction An event handler function to be invoked when the event is fired
opt_captureboolean optional If
true, listening is active in the capture phase (bubble otherwise)opt_scopeObject optional The scope for the handler function
-
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which is triggered when the
EventTargetobject is being disposed.Name Type Description callbackfunction The callback function.
opt_scopeObject optional An optional scope for the callback function
-
dispatchEvent (evt) inherited
-
This method dispatches an event on the
EventTargetobject.Name Type Description evtH.util.Event | string An object representing the event or a string with the event name
-
dispose () inherited
-
This method removes listeners from the given object. Classes that extend
EventTargetmay need to override this method in order to remove references to DOM Elements and additional listeners. -
getData ()* inherited
-
This method retrieves previously stored arbitrary data from the given element.
Returns:
Type Description * The previously stored data object or nullif no data was stored. -
getElement ()HTMLElement inherited
-
This method retrieves the HTML element that represents the given UI element.
Note: If the UI element has not been rendered, the method retrieves
null.Returns:
Type Description HTMLElement An object representing the given element instance or null -
This method retrieves the label string for the given button.
Returns:
Type Description string The label string for the button -
getState ()H.ui.base.Button.State
-
This method retrieves the current state of the button.
Returns:
Type Description H.ui.base.Button.State The current state of the button -
getVisibility ()boolean inherited
-
This method retrieves a value indicating if the given element is visibile.
Returns:
Type Description boolean trueif the given element is visible, otherwisefalse -
isDisabled ()boolean inherited
-
This method retrieves a value indicating if the given UI element is disabled.
Returns:
Type Description boolean trueif the element is disabled,falseotherwise -
removeClass (className)H.ui.base.Element inherited
-
This method removes a CSS class from the given UI element (if it is present).
Name Type Description classNamestring The CSS class name to add
Returns:
Type Description H.ui.base.Element The given UI element instance -
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the event target.
Name Type Description typestring The name of the event type
handlerfunction The previously added event handler
opt_captureboolean optional If
true, listening is active in the capture phase (bubble otherwise)opt_scopeObject optional The scope for the handler function
-
This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.
Name Type Description elementElement The HTML representation of the given UI element
docDocument The HTML document into which the give UI element is rendered
-
setData (data) inherited
-
This method stores arbitrary data with the given UI element.
Name Type Description data* The data to be stored
-
setDisabled (opt_disabled, opt_force)H.ui.base.Element inherited overrides
-
This method sets a value indicating if the given UI element is disabled.
Name Type Description opt_disabledboolean optional trueto disable the element,falseto enable it. Default isfalseopt_forceboolean 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:
Type Description H.ui.base.Element An object representing the given element instance -
setLabel (label, opt_force)H.ui.base.Button
-
This method sets the label string for the given button object.
Name Type Description labelstring The label to set on the given button object
opt_forceboolean 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:
Type Description H.ui.base.Button An object representing the given button object instance -
setState (state, opt_suppressEvent)H.ui.base.Button
-
This method sets the state of this button.
Name Type Description stateH.ui.base.Button.State A value to which the button is to be set
opt_suppressEventboolean optional An optional flag indicating that the
onStateChangecallback is not to be invokedReturns:
Type Description H.ui.base.Button An object representing this button instance -
setTabIndex (tabIndex) inherited
-
This method sets the tabIndex of the element. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex for more details.
Name Type Description tabIndexnumber -
setVisibility (visibility) inherited
-
This method sets a value indicating if the given element is visible.
Name Type Description visibilityboolean trueif the given element is visible, otherwisefalse
Type Definitions
-
This object defines the configuration (initialization) options for a button object.
Properties:
Name Type Argument Description disabledboolean <optional>
A flag to indicate whether the given button object is disabled, the default is
falselabelstring <optional>
The mark-up (used as
innerHTML) to be rendered into the given button objectonStateChangefunction <optional>
An event listener for the
onstatechangeevent to be addeddata* An arbitrary data object to be stored with the given button object
Events
-
This event is dispatched by the button when its state changes.
Type: