Package | org.spicefactory.lib.command.base |
Class | public class AbstractCommandExecutor |
Inheritance | AbstractCommandExecutor AbstractSuspendableCommand AbstractCancellableCommand AbstractAsyncCommand flash.events.EventDispatcher |
Implements | CommandExecutor |
Subclasses | CommandSequence, DefaultCommandFlow, DefaultCommandProxy, ParallelCommands |
executeCommand
method to start a command and override the protected template method
commandComplete
for dealing with the result.
Property | Defined By | ||
---|---|---|---|
active : Boolean [read-only]
Indicates whether this command is currently executing. | AbstractAsyncCommand | ||
cancellable : Boolean [read-only]
Indicates whether this executor can be cancelled. | AbstractCommandExecutor | ||
domain : ApplicationDomain
The domain to use in case reflection on the command classes
this exeutor deals with is required. | AbstractCommandExecutor | ||
suspendable : Boolean [read-only]
Indicates whether this executor can be suspended. | AbstractCommandExecutor | ||
suspended : Boolean [read-only]
Indicates whether this command is currently suspended. | AbstractSuspendableCommand |
Property | Defined By | ||
---|---|---|---|
data : CommandData [read-only]
The data associated with this executor. | AbstractCommandExecutor | ||
lifecycle : CommandLifecycle [read-only]
The lifecycle hook to use for the commands executed by this instance. | AbstractCommandExecutor |
Method | Defined By | ||
---|---|---|---|
AbstractCommandExecutor(description:String = null, processErrors:Boolean = false, processCancellations:Boolean = false)
Creates a new instance. | AbstractCommandExecutor | ||
addData(value:Object):void
Adds a value to this executor that can get passed to any command
executed by this instance. | AbstractCommandExecutor | ||
cancel():void
Cancels the command. | AbstractCancellableCommand | ||
execute():void
Starts the execution of this command. | AbstractAsyncCommand | ||
Method that may be called by frameworks before executing this command to hook
into the lifecycle and data handling of this executor. | AbstractCommandExecutor | ||
resume():void
Resumes the command. | AbstractSuspendableCommand | ||
suspend():void
Suspends the command. | AbstractSuspendableCommand |
Method | Defined By | ||
---|---|---|---|
commandComplete(result:CommandResult):void
Invoked when a child command has completed its operation successfully. | AbstractCommandExecutor | ||
complete(result:Object = null):void
Signals that this command has completed. | AbstractAsyncCommand | ||
Creates a new instance holding the data commands executed by this instance will produce. | AbstractCommandExecutor | ||
Creates a new instance of the lifecycle hook. | AbstractCommandExecutor | ||
doCancel():void
Invoked when this command gets cancelled. | AbstractCancellableCommand | ||
doExecute():void
Invoked when the command starts executing. | AbstractAsyncCommand | ||
doResume():void
Invoked when this command gets resumed. | AbstractSuspendableCommand | ||
doSuspend():void
Invoked when this command gets suspended. | AbstractSuspendableCommand | ||
error(cause:Object = null):void
Signals an error condition and cancels the command. | AbstractAsyncCommand | ||
executeCommand(com:Command):void
Executes the specified command. | AbstractCommandExecutor |
cancellable | property |
cancellable:Boolean
[read-only] Indicates whether this executor can be cancelled.
This property should be true when all currently active commands can be cancelled.
public function get cancellable():Boolean
data | property |
data:CommandData
[read-only] The data associated with this executor. Contains any results from previously executed commands or data specified upfront.
protected function get data():CommandData
domain | property |
domain:ApplicationDomain
The domain to use in case reflection on the command classes this exeutor deals with is required.
public function get domain():ApplicationDomain
public function set domain(value:ApplicationDomain):void
lifecycle | property |
lifecycle:CommandLifecycle
[read-only] The lifecycle hook to use for the commands executed by this instance.
protected function get lifecycle():CommandLifecycle
suspendable | property |
suspendable:Boolean
[read-only] Indicates whether this executor can be suspended.
This property should be true when all currently active commands can be suspended.
public function get suspendable():Boolean
AbstractCommandExecutor | () | Constructor |
public function AbstractCommandExecutor(description:String = null, processErrors:Boolean = false, processCancellations:Boolean = false)
Creates a new instance.
Parametersdescription:String (default = null ) — a description of this command
| |
processErrors:Boolean (default = false ) — if true an error in a command executed by this instance leads to commandComplete getting called,
if false the executor will stop with an error result
| |
processCancellations:Boolean (default = false ) — if true the cancelleation of a command executed by this instance leads
to commandComplete getting called, if false the executor will stop with an error result
|
addData | () | method |
public function addData(value:Object):void
Adds a value to this executor that can get passed to any command executed by this instance.
Parameters
value:Object — the value to add to this executor
|
commandComplete | () | method |
protected function commandComplete(result:CommandResult):void
Invoked when a child command has completed its operation successfully.
It may also get invoked when a child command has been cancelled
(in case processCancellations
is set to true) and commands
that failed (in case the processErrors
is set to true).
Parameters
result:CommandResult — the result of the command
|
createData | () | method |
protected function createData():CommandData
Creates a new instance holding the data commands executed by this instance will produce.
Subclasses may override this method to provide specialized implementations.
This method will only get invoked when the first command executed by this
instance gets started without the prepare
method being invoked
upfront. The prepare
method allows to pass down CommandData
instances from the environment (like parent executors), in which case this instance
should not use its own implementations.
CommandData — a new instance to use for holding the data commands executed by this instance will produce
|
createLifecycle | () | method |
protected function createLifecycle():CommandLifecycle
Creates a new instance of the lifecycle hook.
Subclasses may override this method to provide specialized implementations.
This method will only get invoked when the first command executed by this
instance gets started without the prepare
method being invoked
upfront. The prepare
method allows to pass down CommandLifecycle
instances from the environment (like parent executors), in which case this instance
should not create its own lifecycle.
CommandLifecycle — a new lifecycle instance to use when executing commands
|
executeCommand | () | method |
protected function executeCommand(com:Command):void
Executes the specified command.
Upon completion the commandComplete
method will get invoked
which may be overridden by subclasses to deal with the result or decide
on the next command to execute.
Parameters
com:Command — the command to execute
|
prepare | () | method |
public function prepare(lifecycle:CommandLifecycle, data:CommandData):void
Method that may be called by frameworks before executing this command to hook into the lifecycle and data handling of this executor.
Parameters
lifecycle:CommandLifecycle — the lifecycle hooks this executor should use
| |
data:CommandData — data that can be passed to commands executed by this instance
|