Packagecom.bourre.commands
Classpublic class AbstractCommand
ImplementsCommand
SubclassesAbstractService, AbstractSyncCommand, Batch, BuildArray, BuildBoolean, BuildClass, BuildDictionary, BuildFunction, BuildInstance, BuildInt, BuildNull, BuildNumber, BuildObject, BuildRef, BuildString, BuildUint, BuildXML

Player version: Flash Player 9.0
Language version: ActionScript 3.0

AbstractCommand provides a skeleton for commands which might work within plugin's FrontController. Abstract command provides methods which allow the FrontController to set the command owner at the command creation. Additionally the AbstractCommand class provides convenient method to access all MVC components and logging tools of the plugin owner.

LowRA encourage the creation of stateless commands, it means that commands must realize all their process entirely in the execute call. The constructor of a stateless command should always be empty.

See the How to use the Command pattern implementation in LowRA document for more details on the commands package structure.



Protected Properties
 PropertyDefined by
  _owner : Plugin
A reference to the plugin owner of this command.
AbstractCommand
Public Methods
 MethodDefined by
  
Empty constructor of a stateless command
AbstractCommand
  
execute(e:Event = null):void
Override the execute virtual method to create a concret command.
AbstractCommand
  
Returns the exclusive logger object owned by the plugin.
AbstractCommand
  
getModel(key:String):AbstractModel
Returns a reference to the model AbstractModel.
AbstractCommand
  
Returns a reference to the owner of this command.
AbstractCommand
  
getView(key:String):AbstractView
Returns a reference to the view AbstractView.
AbstractCommand
  
isModelRegistered(key:String):Boolean
Check if a model AbstractModel is registered with passed key in owner's ModelLocator.
AbstractCommand
  
isViewRegistered(key:String):Boolean
Check if a view AbstractView is registered with passed key in owner's ViewLocator.
AbstractCommand
  
setOwner(owner:Plugin):void
Defines the plugin owner of this command.
AbstractCommand
  
toString():String
Returns the string representation of this instance.
AbstractCommand
Protected Methods
 MethodDefined by
  
firePrivateEvent(e:Event):void
Fires a private event directly on this command's owner.
AbstractCommand
Property detail
_ownerproperty
protected var _owner:Plugin

Player version: Flash Player 9.0
Language version: ActionScript 3.0

A reference to the plugin owner of this command.

Constructor detail
AbstractCommand()constructor
public function AbstractCommand()

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Empty constructor of a stateless command

Method detail
execute()method
public function execute(e:Event = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Override the execute virtual method to create a concret command. Stateless command may use the passed-in event as data source for their operation.

Parameters
e:Event (default = null) — event object that will be used as data source by the command

Throws
UnimplementedVirtualMethodException — Concret command doesn't override the execute method
 
UnreachableDataException — Stateless command use the passed-in event as data source for its execution, so the event must provide the right data for the current Command object.
firePrivateEvent()method 
protected function firePrivateEvent(e:Event):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Fires a private event directly on this command's owner.

Parameters
e:Event
getLogger()method 
public function getLogger():PluginDebug

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the exclusive logger object owned by the plugin. It allow this command to send logging message directly on its owner logging channel.

Returns
PluginDebug — logger associated to the owner
getModel()method 
public function getModel(key:String):AbstractModel

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns a reference to the model AbstractModel. It allow this command to locate any model registered to owner's ModelLocator.

Parameters
key:String — key

Returns
AbstractModel — a reference to the model registered with key argument
getOwner()method 
public function getOwner():Plugin

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns a reference to the owner of this command.

Returns
Plugin — the plugin owner of this command
getView()method 
public function getView(key:String):AbstractView

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns a reference to the view AbstractView. It allow this command to locate any view registered to owner's ViewLocator.

Parameters
key:String — key

Returns
AbstractView — a reference to registered view
isModelRegistered()method 
public function isModelRegistered(key:String):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Check if a model AbstractModel is registered with passed key in owner's ModelLocator.

Parameters
key:String — key

Returns
Boolean — true if model a model AbstractModel is registered.
isViewRegistered()method 
public function isViewRegistered(key:String):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Check if a view AbstractView is registered with passed key in owner's ViewLocator.

Parameters
key:String — key

Returns
Boolean — true if model a view AbstractView is registered.
setOwner()method 
public function setOwner(owner:Plugin):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Defines the plugin owner of this command. Generally the owner is defined by the FrontController of a plugin when it instantiate a command.

Parameters
owner:Plugin — plugin which will own the command
toString()method 
public function toString():String

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the string representation of this instance.

Returns
String — the string representation of this instance