Packagecom.soma.control
Classpublic class SomaController
InheritanceSomaController Inheritance FrontController

Author: Romuald Quantin - www.soundstep.com

Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0

Copyright:

The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.

The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.

Usage:
SomaController is the internal controller used by the framework.

The command registered are:

You can extend the FrontController to create your own controller. Soma Singleton can be extended to overwrite the initController methods to add your own (not a requirement, you controller class can be initialized anywhere).

The SomaController is a static class and can be used to add your own commands (SomaController.addCommand).

See also

Soma
FrontController


Protected Properties
 PropertyDefined by
 Inheritedcommands : Dictionary
[static] Dictionary of event name to command class mappings
FrontController
Public Methods
 MethodDefined by
  
Creates a SomaController instance but makes no sense (static class)
SomaController
  
addCommand(commandName:String, commandRef:Class, useWeakReference:Boolean = true):void
[static] Registers a ICommand class with the Front Controller, against an event name and listens for events with that name.
SomaController
  
init():void
[static] Initializes the controller and add the commands to the FrontController.
SomaController
  
removeCommand(commandName:String):void
[static] Deregisters an ICommand class with the given event name from the Front Controller
SomaController
Protected Methods
 MethodDefined by
  
[static] Executes the command
SomaController
  
getCommand(commandName:String):Class
[static] Returns the command class registered with the command name.
SomaController
Constructor detail
SomaController()constructor
public function SomaController()

Creates a SomaController instance but makes no sense (static class)

Method detail
addCommand()method
public static function addCommand(commandName:String, commandRef:Class, useWeakReference:Boolean = true):void

Registers a ICommand class with the Front Controller, against an event name and listens for events with that name.

When an event is broadcast that matches commandName, the ICommand class referred to by commandRef receives control of the application, by having its execute() method invoked.

Parameters
commandName:String — The name of the event that will be broadcast by the when a particular user gesture occurs, eg "login"
 
commandRef:Class — An ICommand Class reference upon which execute() can be called when the Front Controller hears an event broadcast with commandName. Typically, this argument is passed as "LoginCommand" or similar.
 
useWeakReference:Boolean (default = true) — A Boolean indicating whether the controller should added as a weak reference to the CairngormEventDispatcher, meaning it will eligibile for garbage collection if it is unloaded from the main application.
executeCommand()method 
protected static function executeCommand(event:CairngormEvent):void

Executes the command

Parameters
event:CairngormEvent
getCommand()method 
protected static function getCommand(commandName:String):Class

Returns the command class registered with the command name.

Parameters
commandName:String

Returns
Class
init()method 
public static function init():void

Initializes the controller and add the commands to the FrontController.

removeCommand()method 
public static function removeCommand(commandName:String):void

Deregisters an ICommand class with the given event name from the Front Controller

Parameters
commandName:String — The name of the event that will be broadcast by the when a particular user gesture occurs, eg "login"