| Package | org.mymvc |
| Class | public class MyMVCController |
addCommand,
addParallelCommands and addEventListener.
Use addCommand to add a single or sequence of commands. e.g. addCommand('LOGIN', LoginCommand) or addCommand('LOGIN', [LoginCommand,DisplayResultCommand])
| Property | Defined by | ||
|---|---|---|---|
| commands : Dictionary
Dictionary of event name to command class mappings
| MyMVCController | ||
| Method | Defined by | ||
|---|---|---|---|
|
addCommand(eventType:String, commandRef:Object, useWeakReference:Boolean = true):void
Registers a MyMVCCommand class, or a sequence MyMVCCommands, with the Front Controller, against an event name
and listens for events with that name.
| MyMVCController | ||
|
addParallelCommands(eventType:String, commandRef:Object, useWeakReference:Boolean = true):void
Registers a parallel of MyMVCCommand classes with the Front Controller, against an event name
and listens for events with that name.
| MyMVCController | ||
|
removeCommand(eventType:String):void
Deregisters a MyMVCCommand class (or a class array) with the given event name
from the Front Controller.
| MyMVCController | ||
| Method | Defined by | ||
|---|---|---|---|
|
addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
A front controller can listen to an event emitted by MyMVCRadioStation
| MyMVCController | ||
|
dispatchEvent(event:MyMVCEvent):Boolean
A front controller can dispatch event to MyMVCRadioStation
| MyMVCController | ||
|
executeCommand(event:MyMVCEvent):void
Executes the single command
| MyMVCController | ||
|
executeCommands(event:MyMVCEvent):void
Executes the commands (sequence command)
| MyMVCController | ||
|
executeNext(e:MyMVCEvent, tmpSequenceCommandIndex:int, internalData:*):void
Executes the next command in a sequence command.
| MyMVCController | ||
|
executeParallelCommands(event:MyMVCEvent):void
Executes the parallel commands
| MyMVCController | ||
|
getCommand(commandName:String):Class
Returns the command class registered with the command name.
| MyMVCController | ||
|
getCommands(commandName:String):Array
Returns the array of command classes registered with the command name.
| MyMVCController | ||
| commands | property |
protected var commands:DictionaryDictionary of event name to command class mappings
| addCommand | () | method |
public function addCommand(eventType:String, commandRef:Object, useWeakReference:Boolean = true):voidRegisters a MyMVCCommand class, or a sequence MyMVCCommands, with the Front Controller, against an event name and listens for events with that name.
When an event is broadcast that matches eventType, the MyMVCCommand class referred to by commandRef receives control of the application, by having its execute() method invoked.
If the registered command are a sequence of command, when an event is broadcast that matches eventType, the MyMVCCommand classes referred to by commandRef will execute in sequence (i.e., one will execute after the previous one completes. Parameters
eventType:String — The name of the event that will be broadcast by the
when a particular user gesture occurs, eg "LOGIN"
|
|
commandRef:Object — A MyMVCCommand Class reference upon which execute()
can be called when the Front Controller hears an event broadcast with
eventType. Typically, this argument is passed as "LoginCommand"
or similar. Or, it can be an array
|
|
useWeakReference:Boolean (default = true) — A Boolean indicating whether the controller
should added as a weak reference to the MyMVCRadioStation,
meaning it will eligibile for garbage collection if it is unloaded from
the main application.
|
| addEventListener | () | method |
protected function addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidA front controller can listen to an event emitted by MyMVCRadioStation
ParameterseventType:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| addParallelCommands | () | method |
public function addParallelCommands(eventType:String, commandRef:Object, useWeakReference:Boolean = true):voidRegisters a parallel of MyMVCCommand classes with the Front Controller, against an event name and listens for events with that name.
When an event is broadcast that matches eventType, the front controller will split the event data (which has to be an array) into pieces. For each element of the data, the MyMVCCommand classes referred to by commandRef will execute in sequence (i.e., one will execute after the previous one completes). After one element of the data is processed, then this sequence of commands will process the next data. Parameters
eventType:String — The name of the event that will be broadcast by the
when a particular user gesture occurs. e.g. "LOGIN"
|
|
commandRef:Object — An Array of MyMVCCommand Class reference. e.g. [LoginCommand,DisplayResultCommand]
|
|
useWeakReference:Boolean (default = true) |
| dispatchEvent | () | method |
protected function dispatchEvent(event:MyMVCEvent):BooleanA front controller can dispatch event to MyMVCRadioStation
Parametersevent:MyMVCEvent |
Boolean |
| executeCommand | () | method |
protected function executeCommand(event:MyMVCEvent):voidExecutes the single command
Parametersevent:MyMVCEvent |
| executeCommands | () | method |
protected function executeCommands(event:MyMVCEvent):voidExecutes the commands (sequence command)
Parametersevent:MyMVCEvent |
| executeNext | () | method |
protected function executeNext(e:MyMVCEvent, tmpSequenceCommandIndex:int, internalData:*):voidExecutes the next command in a sequence command. Dispatch MyMVCEvent.COMPLETE event when all commands are finish.
Parameterse:MyMVCEvent |
|
tmpSequenceCommandIndex:int |
|
internalData:* |
| executeParallelCommands | () | method |
protected function executeParallelCommands(event:MyMVCEvent):voidExecutes the parallel commands
Parametersevent:MyMVCEvent |
| getCommand | () | method |
protected function getCommand(commandName:String):ClassReturns the command class registered with the command name.
ParameterscommandName:String |
Class |
| getCommands | () | method |
protected function getCommands(commandName:String):ArrayReturns the array of command classes registered with the command name.
ParameterscommandName:String |
Array |
| removeCommand | () | method |
public function removeCommand(eventType:String):voidDeregisters a MyMVCCommand class (or a class array) with the given event name from the Front Controller. This method can be used to deregister a single command or a sequence command.
ParameterseventType:String — The name of the event
|