Packagecom.developmentarc.framework.controllers
Classpublic class ActionDelegate
InheritanceActionDelegate Inheritance flash.events.EventDispatcher

The ActionDelegate is responsible for brokering commands to the actions that have registered for the command type. When an Action is registered to the ActionDelegate, the Delegate reviews the commands for the specific action and then registers to the EventBroker to track the requested Command. When the Command is dispatched to the EventBroker the Action's applyAction() method was assigned and is called.



Public Properties
 PropertyDefined by
  actions : Array
Defines an Array of IActions that are then registered through the delegate to the Action's commands Array.
ActionDelegate
Public Methods
 MethodDefined by
  
Constructor.
ActionDelegate
  
addAction(action:IAction):void
Used to add a single action to to the ActionDelegate.
ActionDelegate
  
removeAction(action:IAction):void
Removes an action from the ActionDelegate.
ActionDelegate
Protected Methods
 MethodDefined by
  
handleCommandChange(event:Event):void
When the commands of a registered Action change this method unregisters exiting commands and then registers the new command list.
ActionDelegate
  
registerActions(actions:Array):void
Registers the action array and the commands assigned to that action.
ActionDelegate
  
Registers the Action's commands via the EventBroker.
ActionDelegate
  
unregisterActions(actions:Array):void
Unregisters an Array of IActions from their commands.
ActionDelegate
  
unregisterCommands(action:IAction, commands:Array):void
Unregisters the Action's commands via the EventBroker.
ActionDelegate
Property detail
actionsproperty
actions:Array  [read-write]

Defines an Array of IActions that are then registered through the delegate to the Action's commands Array. The ActionDelegate can be used in MXML and we encourge this to enable a centralized location for where the Actions and Commands are assigned.

Implementation
    public function get actions():Array
    public function set actions(value:Array):void

Example
When assigning code via MXML, use this syntax:
<controllers:ActionDelegate>
 <controllers:actions>
  <mx:Array>
   <actiontypes:BasicAction commands="{[BasicCommand.MY_BASIC_COMMAND]}" />
   <actiontypes:MultipleCommandAction commands="{[BasicCommand.A_SECOND_COMMAND, BasicCommand.MY_BASIC_COMMAND]}" />
  </mx:Array>
 </controllers:actions>
</controllers:ActionDelegate>
   

Constructor detail
ActionDelegate()constructor
public function ActionDelegate()

Constructor.

Method detail
addAction()method
public function addAction(action:IAction):void

Used to add a single action to to the ActionDelegate.

Parameters
action:IAction — The action to register.
handleCommandChange()method 
protected function handleCommandChange(event:Event):void

When the commands of a registered Action change this method unregisters exiting commands and then registers the new command list. This method is important when assigning commands via MXML due to the population order of child tags.

Parameters
event:Event — The change event.
registerActions()method 
protected function registerActions(actions:Array):void

Registers the action array and the commands assigned to that action.

Parameters
actions:Array — The array of IActions to register to commands.
registerCommands()method 
protected function registerCommands(action:IAction):void

Registers the Action's commands via the EventBroker.

Parameters
action:IAction — The action to register.
removeAction()method 
public function removeAction(action:IAction):void

Removes an action from the ActionDelegate.

Parameters
action:IAction — The action to remove.
unregisterActions()method 
protected function unregisterActions(actions:Array):void

Unregisters an Array of IActions from their commands.

Parameters
actions:Array — The Array if IActions to unregister.
unregisterCommands()method 
protected function unregisterCommands(action:IAction, commands:Array):void

Unregisters the Action's commands via the EventBroker.

Parameters
action:IAction — The action to unregister.
 
commands:Array