Packageorg.pranaframework.cairngorm
Classpublic class CairngormFrontController
InheritanceCairngormFrontController Inheritance com.adobe.cairngorm.control.FrontController

The CairngormFrontController extends Cairngorm's FrontController and adds the ability to pass in commands to the constructor.

The object with the command definitions must have the following form:

var commands:Object = {
    "myFirstEvent": "com.domain.command.MyFirstCommand",
    "mySecondEvent": "com.domain.command.MySecondCommand"
  };
  
  // instantiate a front controller and pass in the commands objects
  var controller:FrontController = new CairngormFrontController(commands);

...where the key in the commands object is the name of the event that the frontcontroller will listen to and the value is the fully qualified class name of the command that will be executed.

Notice that the constructor takes a second optional argument specifying the package where the commands reside. By passing in this argument it is not needed to specify fully qualified classnames for the command classes. Only the classnames themselves need to be specified then.

var commands:Object = {
    "myFirstEvent": "MyFirstCommand",
    "mySecondEvent": "MySecondCommand"
  };
  
  var controller:FrontController = new CairngormFrontController(commands, "com.domain.command");
The following is the xml definition of the controller instance:
 <object id="controller" class="org.pranaframework.ioc.util.CairngormFrontController">
    <constructor-arg>
      <object>
        <property name="myFirstEvent" value="MyFirstCommand"/>
        <property name="mySecondEvent" value="MySecondCommand"/>
      </object>
    </constructor-arg>
    <constructor-arg value="com.domain.command"/>
  </object>



Public Properties
 PropertyDefined by
  commandMap : Object
[write-only]
CairngormFrontController
  commandPackage : String
CairngormFrontController
Public Methods
 MethodDefined by
  
CairngormFrontController(commands:Object, commandPackage:String = "")
Creates a new CairngormFrontController instance.
CairngormFrontController
  
addCommand(commandName:String, commandRef:Class, useWeakReference:Boolean = true):void
Adds an extra check to see if the command class implements ICommand.
CairngormFrontController
  
[static]
CairngormFrontController
Protected Methods
 MethodDefined by
  
executeCommand(event:CairngormEvent):void
CairngormFrontController
Property detail
commandMapproperty
commandMap:Object  [write-only]Implementation
    public function set commandMap(value:Object):void
commandPackageproperty 
commandPackage:String  [read-write]Implementation
    public function get commandPackage():String
    public function set commandPackage(value:String):void
Constructor detail
CairngormFrontController()constructor
public function CairngormFrontController(commands:Object, commandPackage:String = "")

Creates a new CairngormFrontController instance.

Parameters
commands:Object — an object containing key/value pairs with the event names and the command classes
 
commandPackage:String (default = "") — the package where the commands reside
Method detail
addCommand()method
public override function addCommand(commandName:String, commandRef:Class, useWeakReference:Boolean = true):void

Adds an extra check to see if the command class implements ICommand.

Parameters
commandName:String
 
commandRef:Class
 
useWeakReference:Boolean (default = true)
executeCommand()method 
protected override function executeCommand(event:CairngormEvent):voidParameters
event:CairngormEvent
getInstance()method 
public static function getInstance():CairngormFrontController

Returns
CairngormFrontController