Namespace: Widget

Widget

User interface widgets.
Source:

Methods

addClass(className)

Adds a CSS class to the widget if not already present.
Parameters:
Name Type Description
className String The class name to add.
Source:

addEventListener(ev, func)

Add an event listener function to this widget.
Parameters:
Name Type Description
ev String The event type to listen for (e.g. keydown)
func function The handler to be called when the event is fired.
Source:
See:

broadcastEvent(ev)

Broadcast an event from object, triggering any event listeners bound to this widget and any parent widgets. To halt bubbling of the event, see antie.events.Event#stopPropagation.
Parameters:
Name Type Description
ev antie.events.Event The event to bubble.
Source:
See:

bubbleEvent(ev)

Bubbles an event from object, triggering any event listeners bound to this widget and any parent widgets. To halt bubbling of the event, see antie.events.Event#stopPropagation.
Parameters:
Name Type Description
ev antie.events.Event The event to bubble.
Source:
See:

fireEvent(ev)

Fires an event on this object, triggering any event listeners bound to this widget only. Note: this does not bubble or propagate the event to other widgets, for that functionality see #bubbleEvent.
Parameters:
Name Type Description
ev antie.events.Event The event to fire.
Source:
See:

getClasses()

Get an array of class names that this widget has.
Source:
Returns:
An array of class names (Strings)

getComponent()

Returns the component this widget is a descendant of
Source:

getCurrentApplication()

Gets a reference to the application responsible for creating the widget.
Source:
See:
  • antie.RuntimeContext

getDataItem()

Get any data item associated with this widget.
Source:

hasClass(className)

Checks to see if the widget has a given CSS class.
Parameters:
Name Type Description
className String The class name to check.
Source:
Returns:
Boolean true if the device has the className. Otherwise boolean false.

hide(options)

Hides a widget. If animation is enabled the widget will be faded out of view.
Parameters:
Name Type Description
options Object Details of the element to be shown, with optional parameters.
Properties
Name Type Attributes Default Description
skipAnim Boolean <optional>
By default the showing of the element will be animated (faded in). Pass true here to prevent animation.
onComplete function <optional>
Callback function to be called when the element has been shown.
fps Number <optional>
25 Frames per second for fade animation.
duration Number <optional>
840 Duration of fade animation, in milliseconds (ms).
easing String <optional>
linear Easing style for fade animation.
Source:
Returns:
Boolean true if animation was called, otherwise false

isComponent() → {Boolean}

Returns whether the widget is a Component.
Source:
Returns:
True if the widget is a Component.
Type
Boolean

isFocusable()

Checks to see if a widget is focussable, i.e. contains an enabled button.
Source:
See:

isFocussed()

Get if this widget is in the current focus path.
Source:
Returns:
Boolean true if this widget is in the focus path, otherwise false.

moveTo(options)

Moves a widget so that its top-left corner is at the given position.
Parameters:
Name Type Description
options Object Details of the element to be shown, with optional parameters.
Properties
Name Type Attributes Default Description
skipAnim Boolean <optional>
By default the showing of the element will be animated (faded in). Pass true here to prevent animation.
onComplete function <optional>
Callback function to be called when the element has been shown.
fps Number <optional>
25 Frames per second for fade animation.
duration Number <optional>
840 Duration of fade animation, in milliseconds (ms).
easing String <optional>
linear Easing style for fade animation.
Source:
Returns:
Boolean true if animation was called, otherwise false

removeClass(className)

Removes a CSS class from the widget if present.
Parameters:
Name Type Description
className String The class name to remove.
Source:

removeEventListener(ev, func)

Removes an event listener function to this widget.
Parameters:
Name Type Description
ev String The event type that the listener is to be removed from (e.g. keydown)
func function The handler to be removed.
Source:
See:

removeFocus()

Remove focus state from this widget.
Source:

render(device)

Renders the widget to device-specific output.
Parameters:
Name Type Description
device antie.devices.Device The device to render to.
Source:
Returns:
A device-specific object that represents the widget as displayed on the device (in a browser, a DOMElement);

setDataItem(dataItem)

Associate a data item with this widget.
Parameters:
Name Type Description
dataItem object Object to associate with this widget.
Source:

show(options)

Shows a widget. If animation is enabled the widget will be faded in.
Parameters:
Name Type Description
options Object Details of the element to be shown, with optional parameters.
Properties
Name Type Attributes Default Description
skipAnim Boolean <optional>
By default the showing of the element will be animated (faded in). Pass true here to prevent animation.
onComplete function <optional>
Callback function to be called when the element has been shown.
fps Number <optional>
25 Frames per second for fade animation.
duration Number <optional>
840 Duration of fade animation, in milliseconds (ms).
easing String <optional>
linear Easing style for fade animation.
Source:
Returns:
Boolean true if animation was called, otherwise false