Packagecom.adobe.cairngorm.commands
Classpublic class SequenceCommand
ImplementsICommand

The SequenceCommand is provided as a "psuedo-abstract" (since ActionScript has no real concept of abstract classes) base-class that can be extended when you wish to chain commands together for a single user-gesture, or establish some simple form of decision-based workflow.

By extending SequenceCommand, you can specify the event that should be broadcast to the controller (causing another command execution without a further user-gesture) when the current command has completed execution.

For a command implementing the Responder interface, you may choose to sequence a subsequent command on successful completion of the command, in the onResult() handler, or on failure of the command in the onFault() method.

For commands that do not implement the Responder interface, you can simply chain commands by causing the sequenced command to be invoked as the last action in your command's execute() method.

Usage

In the constructor of a concrete SequenceCommand implementation, you should set nextEvent to the event that is responsible for calling your subsequent command.

Alternatively, you can override the implicit nextEvent getter, to programmatically decide at runtime which event should be broadcast next.

Invocation of the next command in the sequence is explicitly controlled by the developer, by calling the executeNextCommand() method provided in the SequenceCommand base-class. This can be called either in the body of the execute() method (for synchronous sequencing) or in the body of an onResult() or onFault() handler (for asynchronous sequencing, that can also support conditional workflow).

See also

com.adobe.cairngorm.commands.ICommand
com.adobe.cairngorm.control.CairngormEventDispatcher


Public Properties
 PropertyDefined by
  nextEvent : CairngormEvent
The next event in the sequence.
SequenceCommand
Public Methods
 MethodDefined by
  
SequenceCommand(nextEvent:CairngormEvent = null)
Constructor, with optional nextEvent.
SequenceCommand
  
execute(event:CairngormEvent):void
Abstract implementation of the execute() method.
SequenceCommand
  
Call to execute the next command in the sequence.
SequenceCommand
Property detail
nextEventproperty
public var nextEvent:CairngormEvent

The next event in the sequence.

Constructor detail
SequenceCommand()constructor
public function SequenceCommand(nextEvent:CairngormEvent = null)

Constructor, with optional nextEvent.

Parameters
nextEvent:CairngormEvent (default = null)
Method detail
execute()method
public function execute(event:CairngormEvent):void

Abstract implementation of the execute() method.

ActionScript does not explicity support abstract methods and abstract classes, so this concrete implementation of the interface method must be overridden by the developer.

Parameters
event:CairngormEvent
executeNextCommand()method 
public function executeNextCommand():void

Call to execute the next command in the sequence.

Called explicitly by the developer within a concrete SequenceCommand implementation, this method causes the event registered with nextEvent to be broadcast, for the next command in the sequence to be called without further user-gesture.