Packageorg.robotlegs.utilities.undoablecommand
Classpublic class UndoableCommandBase
InheritanceUndoableCommandBase Inheritance Object
Implements IUndoableCommand
Subclasses UndoableCommand



Public Properties
 PropertyDefined By
  eventDispatcher : IEventDispatcher
Event bus to dispatch events on.
UndoableCommandBase
Protected Properties
 PropertyDefined By
  hasExecuted : Boolean
Keeps track of whether this command has been executed, to prevent undoing commands that have not been yet been executed.
UndoableCommandBase
Public Methods
 MethodDefined By
  
UndoableCommandBase(doFunction:Function = null, undoFunction:Function = null)
Creates a new UndoableCommand
UndoableCommandBase
  
execute():void
Executes the command.
UndoableCommandBase
  
undo():void
Executes the undo function.
UndoableCommandBase
Protected Methods
 MethodDefined By
  
doExecute():void
Subclasses MUST override this function with the body of their command.
UndoableCommandBase
  
Subclasses must override this function.
UndoableCommandBase
Property Detail
eventDispatcherproperty
eventDispatcher:IEventDispatcher

Event bus to dispatch events on.


Implementation
    public function get eventDispatcher():IEventDispatcher
    public function set eventDispatcher(value:IEventDispatcher):void
hasExecutedproperty 
protected var hasExecuted:Boolean

Keeps track of whether this command has been executed, to prevent undoing commands that have not been yet been executed.

Constructor Detail
UndoableCommandBase()Constructor
public function UndoableCommandBase(doFunction:Function = null, undoFunction:Function = null)

Creates a new UndoableCommand

Parameters
doFunction:Function (default = null) — the function to execute
 
undoFunction:Function (default = null) — execute this function to undo the operations of doFunction
Method Detail
doExecute()method
protected function doExecute():void

Subclasses MUST override this function with the body of their command.

execute()method 
public final function execute():void

Executes the command. If we passed in an execute function to the constructor, execute passed-in function, otherwise execute overriden doExecute function. Will not execute more than once without first undoing

undo()method 
public final function undo():void

Executes the undo function. If we passed in an undo function to the constructor, execute passed-in undo function, otherwise execute overriden undoExecute function. Will not undo if function has not executed.

undoExecute()method 
protected function undoExecute():void

Subclasses must override this function. This function should undo whatever the doExecute command did.