qnx.fuse.ui.actionbar.ActionBar

ActionBar

Properties | Methods | Events | Examples


Packageqnx.fuse.ui.actionbar
Classpublic final class ActionBar
InheritanceActionBar Inheritance UIComponent Inheritance flash.display.MovieClip

The ActionBar is a control designed to stretch across the bottom of the screen. It allows users to choose application specific actions to perform. Actions may change depending on the context of the application.

You can add two types of actions to the ActionBar.

  • Action: Actions represent tasks you can perform on the current view (what is shown above the ActionBar).

  • TabAction: TabActions represent other views you can navigate to from the current view.

Actions are added using the addAction() method. If an Action's properties are updated after adding it to the ActionBar, changes will not be reflected in the ActionBar. Instead, update properties on the Action instance and then use replaceAction or replaceActionAt so the ActionBar can update its visual state.



Class information:
BlackBerry 10 Version:   10.0.0

View the examples



Public Properties

 PropertyDefined By
  backButton : Action
Adds an Action to be associated with the back button.
ActionBar
 InheritedcontextActions : Vector.<ActionSet>
Gets or Sets a Vector of ActionSet objects.
UIComponent
 InheritedcontextMultiSelectText : String
Gets or Sets a String to be displayed when showing the Multi Select Context Menu.
UIComponent
 InheritedcurrentTheme : String
[read-only] Returns the current theme this component is styled with.
UIComponent
  enableBackButtonDrag : Boolean
Enables dispatching of DragEvents when interacting with the back button.
ActionBar
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
  height : Number
[override] Gets the height of the component.
ActionBar
 Inheritedid : String
The id is a name for the component that can be used in CSS using the # selector.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Gets or sets the layoutData.
UIComponent
 Inheritedlocale : String
Gets or sets the current locale of the component.
UIComponent
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
  numActions : uint
[read-only] Returns the number of actions that have been added to the ActionBar.
ActionBar
  numTabs : uint
[read-only] Returns the number of tabs that have been added to the ActionBar.
ActionBar
  selectedTabAction : TabAction
Sets the selected TabAction.
ActionBar
 InheritedstyleChildren : Boolean
Allows you to style the children of this component with CSS.
UIComponent
  tabOverflowParent : DisplayObjectContainer
Gets or sets the parent display object for the tab overflow menu.
ActionBar
  totalItems : uint
[read-only] Returns the total number of Actions and TabActions that have been added to the ActionBar.
ActionBar

Protected Properties

 PropertyDefined By
 InheritedaccessibilityImplimentationClass : Class
UIComponent
  cssID : String
[override] [read-only] Returns the CSS ID of the component.
ActionBar
 InheritedexplicitLocale : Boolean
Set to true when the locale property has been set externally.
UIComponent
 InheritedinternalID : String
The Component's Id used for styling.
UIComponent
 InheritedlongPressEnabled : Boolean
Specifies whether the UIComponent can detect a long press.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new ActionBar.
ActionBar
  
addAction(action:ActionBase):void
Appends an action to the end of the list.
ActionBar
  
addActionAt(action:ActionBase, index:int):void
Adds an item to the list at the specified index.
ActionBar
  
addActionsAt(actions:Vector.<ActionBase>, index:int):void
Adds an array item at the specified index.
ActionBar
 Inherited
Cancels a long press from occuring on the component.
UIComponent
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
  
Returns the item in the list of actions at the specified index.
ActionBar
 Inherited
Returns the CSS selector for the object, composing it from its position in the display hierarchy and an optional ID selector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
  
If either the tab overflow menu, or the action overflow menu are open calling this method will close them.
ActionBar
  
indexOf(action:ActionBase):int
Returns the index of the action in the list.
ActionBar
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
  
Removes a given action from the list of actions.
ActionBar
  
removeActionAt(index:int):void
Removes an item from list at the specified index.
ActionBar
  
removeAll():void
Removes all the actions from the list.
ActionBar
  
replaceAction(action:Action, oldAction:Action):void
Replaces an action, given the new action object and the old action.
ActionBar
  
replaceActionAt(action:Action, index:int):void
Replaces the action in the list at the specified index with a new action.
ActionBar
  
reserveActionSpace(value:Boolean):void
Reserves the space used to show an Action with an actionPlacement value of ActionPlacement.ON_BAR.
ActionBar
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
showTabsFirstOnBar(value:Boolean):void
Specifies whether TabActions should take priority in the action bar instead of Actions.
ActionBar
 Inherited
updateDefaultLocale(updateChildren:Boolean = true):void
Updates the locale property to be the same as the locale of the device.
UIComponent
 Inherited
Lets a component that contains text know that it should update its font formats as the font settings have changed.
UIComponent
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
allowShowContextMenu(target:IEventDispatcher):Boolean
When the user presses on the component this method is called with the object that dispatched the event.
UIComponent
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
Style the component after the style has changed.
UIComponent
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
excemptFromCSSStyling(target:*, property:String = null):void
Exempts a property on an object from being styled by CSS.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
getStyleApplier():Function
A style applier is a method that gets called every time a property from the stylesheet should be applied to the component.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
Is called when a user is no longer long pressing on the component.
UIComponent
 Inherited
Is called when a user long presses on the component.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
Calling this function will refresh the ContextMenu with whatever actions were set by contextActions.
UIComponent
 Inherited
Shows the context menu if there are contextActions associated with the control.
UIComponent
 Inherited
styleState():void
Style the component after state has changed.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent

Events

 Event Summary Defined By
  Dispatched when an Action is selected.ActionBar
 InheritedDispatched when the Context Menu has closed to the DISMISSED state.UIComponent
 InheritedDispatched when the ContextMenu is closing to the DISMISSED state.UIComponent
 InheritedDispatched when the Context Menu has opened to the PEEK or EXPANDED state.UIComponent
 InheritedDispatched when the ContextMenu is opening from the DISMISSED state.UIComponent
  Dispatched when the tab overflow menu begins to be dragged.ActionBar
  Dispatched when the tab overflow menu stops being dragged.ActionBar
  Dispatched every frame when the tab overflow menu is being dragged.ActionBar
 InheritedDispatched when the CrossCut multiselect has been canceled.UIComponent

Property Detail

backButton


backButton:Action

Adds an Action to be associated with the back button. The back button will be shown if there are no TabActions added to the ActionBar and the supplied Action is not null.

Set the backButton to null if you wish to remove the back button.


Implementation

public function get backButton():Action
public function set backButton(value:Action):void

cssID


cssID:String  [read-only]
[override]

Returns the CSS ID of the component. The CSS ID is used for identifying the type of component in CSS.

The default value is ActionBar.


Implementation

protected function get cssID():String

enableBackButtonDrag


enableBackButtonDrag:Boolean

Enables dispatching of DragEvents when interacting with the back button. If enabled:

  • DragEvent.DRAG_START event is dispatched when the user presses the back button.
  • DragEvent.DRAG_MOVE event is dispatched when the user moves their finger on the back button.
  • DragEvent.DRAG_END event is dispatched when the user releases the back button.


Implementation

public function get enableBackButtonDrag():Boolean
public function set enableBackButtonDrag(value:Boolean):void

height


height:Number
[override]

Gets the height of the component.

The visual height of the control will differ slightly between portrait and landscape views. Listen for an Event.RESIZE event on the stage and re-lay out components based on the height of the ActionBar.

Note that you cannot set the height of ActionBar and calling the height setter will do nothing.


Implementation

public function get height():Number
public function set height(value:Number):void

numActions


numActions:uint  [read-only]

Returns the number of actions that have been added to the ActionBar. This tally excludes the number of TabActions that have been added to the ActionBar.

This returns the total number of actions added, not just number of visible actions.


Implementation

public function get numActions():uint

numTabs


numTabs:uint  [read-only]

Returns the number of tabs that have been added to the ActionBar. This tally excludes the number of Actions that have been added to the ActionBar.

This returns the total number of tabs added, not just number of visible tabs.


Implementation

public function get numTabs():uint

selectedTabAction


selectedTabAction:TabAction

Sets the selected TabAction. This selects the action wherever it appears in the ActionBar and associated menus.


Implementation

public function get selectedTabAction():TabAction
public function set selectedTabAction(value:TabAction):void

tabOverflowParent


tabOverflowParent:DisplayObjectContainer

Gets or sets the parent display object for the tab overflow menu. This gives you control over where the tab overflow menu appears.

By default the menu appears in a new window on top of all content. By setting this you can layer the menu behind or in between display objects on the stage.

If no tabOverflowParent is set, overflow menus are created in a new window and placed over top of of the application content. As a result, tab overflow menus will not appear when running on the Desktop through Flash Builder if no tabOverflowParent is set.


Implementation

public function get tabOverflowParent():DisplayObjectContainer
public function set tabOverflowParent(value:DisplayObjectContainer):void

totalItems


totalItems:uint  [read-only]

Returns the total number of Actions and TabActions that have been added to the ActionBar.


Implementation

public function get totalItems():uint

Constructor Detail

ActionBar()


public function ActionBar()

Creates a new ActionBar.

Method Detail

addAction()


public function addAction(action:ActionBase):void

Appends an action to the end of the list.

Parameters

action:ActionBase — The item to add.

addActionAt()


public function addActionAt(action:ActionBase, index:int):void

Adds an item to the list at the specified index.

Parameters

action:ActionBase — The item to add.
index:int — The offset value at which to add the item.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the list of actions.

addActionsAt()


public function addActionsAt(actions:Vector.<ActionBase>, index:int):void

Adds an array item at the specified index.

Parameters

actions:Vector.<ActionBase> — The array of items to add.
index:int — The index, or offset, at which to add the items.


Throws

RangeError — Thrown if the specified index is less than 0, or greater than or equal to the length of the list of actions.

See also

addAction()
addActionAt()

getActionAt()


public function getActionAt(index:int):ActionBase

Returns the item in the list of actions at the specified index.

Parameters

index:int — The index of the action to return.

Returns

ActionBase — The action at the specified index.

Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the list of actions.

hideOverflows()


public function hideOverflows():void

If either the tab overflow menu, or the action overflow menu are open calling this method will close them.

indexOf()


public function indexOf(action:ActionBase):int

Returns the index of the action in the list.

Parameters

action:ActionBase

Returns

int — The index of the aciton in the list.

removeAction()


public function removeAction(action:ActionBase):void

Removes a given action from the list of actions.

Parameters

action:ActionBase — The action to remove.


Throws

ArgumentError — thrown if the item could not be found in the lis t of actions.

removeActionAt()


public function removeActionAt(index:int):void

Removes an item from list at the specified index.

Parameters

index:int — The index of the object to remove.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the list of actions.

removeAll()


public function removeAll():void

Removes all the actions from the list.

replaceAction()


public function replaceAction(action:Action, oldAction:Action):void

Replaces an action, given the new action object and the old action.

Parameters

action:Action — The new action object data.
oldAction:Action — The action to replace.

replaceActionAt()


public function replaceActionAt(action:Action, index:int):void

Replaces the action in the list at the specified index with a new action.

Parameters

action:Action — The new action.
index:int — The index of the action to replace.


Throws

RangeError — thrown if the specified index is less than 0 or greater than or equal to the length of the list of actions.

reserveActionSpace()


public function reserveActionSpace(value:Boolean):void

Reserves the space used to show an Action with an actionPlacement value of ActionPlacement.ON_BAR.

This space is saved so that if certain views have an action to show in this space, while others dont, switching between tabs doesn't re-layout the ActionBar causing tabs to jump around.

Parameters

value:Boolean

See also

ActionPlacement.ON_BAR

showTabsFirstOnBar()


public function showTabsFirstOnBar(value:Boolean):void

Specifies whether TabActions should take priority in the action bar instead of Actions.

Parameters

value:Boolean

Event Detail

actionSelected


Event Object Type: qnx.fuse.ui.events.ActionEvent
ActionEvent.type property = qnx.fuse.ui.events.ActionEvent.ACTION_SELECTED

Dispatched when an Action is selected.

Dispatched when an action is selected.

The ActionEvent.ACTION_SELECTED constant defines the value of the type property of the event object for an actionSelected event.

The properties of the event object have the following values:

PropertyValue
actionThe action that was selected.
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
typeActionEvent.ACTION_SELECTED

dragBegin


Event Object Type: qnx.fuse.ui.events.DragEvent
DragEvent.type property = qnx.fuse.ui.events.DragEvent.DRAG_BEGIN

Dispatched when the tab overflow menu begins to be dragged.

Dispatched when dragging begins.

The DragEvent.DRAG_BEGIN constant defines the value of the type property of the event object for an dragBegin event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
deltaXThe delta of the x property of the control from its previous location.
deltaYThe delta of the y property of the control from its previous location.
typeDragEvent.DRAG_BEGIN

dragEnd


Event Object Type: qnx.fuse.ui.events.DragEvent
DragEvent.type property = qnx.fuse.ui.events.DragEvent.DRAG_END

Dispatched when the tab overflow menu stops being dragged.

Dispatched when dragging ends.

The DragEvent.DRAG_END constant defines the value of the type property of the event object for an dragEnd event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
deltaXThe delta of the x property of the control from its previous location.
deltaYThe delta of the y property of the control from its previous location.
typeDragEvent.DRAG_END

dragMove


Event Object Type: qnx.fuse.ui.events.DragEvent
DragEvent.type property = qnx.fuse.ui.events.DragEvent.DRAG_MOVE

Dispatched every frame when the tab overflow menu is being dragged.

Dispatched when dragging occurs.

The DragEvent.DRAG_MOVE constant defines the value of the type property of the event object for an dragMove event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
deltaXThe delta of the x property of the control from its previous location.
deltaYThe delta of the y property of the control from its previous location.
typeDragEvent.DRAG_MOVE

Examples

In the following example a new ActionBar is created and a single "Share" action is added to it. When the share action is tapped, its label is printed to the console.
package qnx.uitest.views
{
    import qnx.fuse.ui.actionbar.ActionBar;
    import qnx.fuse.ui.core.Action;
    import qnx.fuse.ui.events.ActionEvent;
    import flash.display.Sprite;
    [SWF(frameRate="60", backgroundColor="#FFFFFF")]
    public class ActionBarTest extends Sprite
    {
        public function ActionBarTest()
        {
            initializeUI();
        }
        private function initializeUI() : void
        {
            var actionBar : ActionBar = new ActionBar();
            actionBar.showTabsFirstOnBar( false );
            actionBar.addAction(new Action( "Share" ));
            actionBar.addEventListener(ActionEvent.ACTION_SELECTED, onActionSelected);
            actionBar.y = stage.stageHeight - actionBar.height;
            addChild(actionBar);
        }
        
        private function onActionSelected(e:ActionEvent) : void
        {
            trace("ActionSelected: " + e.action.label);
        }
    }
}
     




comments powered by Disqus