Packagevegas.events
Classpublic class FrontController
InheritanceFrontController Inheritance CoreObject

The Front Controller pattern defines a single EventDispatcher that is responsible for processing application requests.

A front controller centralizes functions such as view selection, security, and templating, and applies them consistently across all pages or views. Consequently, when the behavior of these functions need to change, only a small part of the application needs to be changed: the controller and its helper classes.



Public Methods
 MethodDefined by
  
FrontController(channel:String = null, target:EventDispatcher = null)
Creates a new FrontController instance.
FrontController
  
clear():void
Removes all entries in the FrontController.
FrontController
  
contains(eventName:String):Boolean
Returns 'true' if the eventName is registered in the FrontController.
FrontController
  
fireEvent(e:*):void
Dispatch an event into the FrontController
FrontController
  
flush():void
[static] Flush all global FrontController singletons.
FrontController
  
Returns the internal EventDispatcher singleton reference of this FrontController.
FrontController
  
getInstance(channel:String = null):FrontController
[static] Returns a global FrontController singleton.
FrontController
  
getListener(eventName:String):*
Returns a EventListener
FrontController
 Inherited
Returns the internal ILogger reference of this ILogable object.
CoreObject
 Inherited
hashCode():uint
Returns a hashcode value for the object.
CoreObject
  
insert(eventName:String, listener:*):void
Add a new entry into the FrontController.
FrontController
  
insertBatch(eventName:String, listener:EventListener):void
Adds a new EventListener into an EventListenerBatch in the FrontController.
FrontController
  
isEventListenerBatch(eventName:String):Boolean
Indicates if the specified eventlistener registered with the 'eventName' value in argument is an EventListenerBatch instance.
FrontController
  
remove(eventName:String):void
Remove an entry into the FrontController.
FrontController
  
removeInstance(channel:String):Boolean
[static] Removes a global FrontController singleton.
FrontController
  
Sets the EventDispatcher reference of this FrontController.
FrontController
 Inherited
setLogger(log:ILogger = null):void
Sets the internal ILogger reference of this ILogable object.
CoreObject
  
size():int
Returns the number of elements in the controller.
FrontController
 Inherited
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
CoreObject
 Inherited
toString():String
Returns the string representation of this instance.
CoreObject
Constructor detail
FrontController()constructor
public function FrontController(channel:String = null, target:EventDispatcher = null)

Creates a new FrontController instance.

Parameters
channel:String (default = null) — the channel of this FrontController.
 
target:EventDispatcher (default = null) — the EventDispatcher reference to switch with the default EventDispatcher singleton in the controller.

Example :

         var controller:FrontController = new FrontController() ;
         
Method detail
clear()method
public function clear():void

Removes all entries in the FrontController.

contains()method 
public function contains(eventName:String):Boolean

Returns 'true' if the eventName is registered in the FrontController.

Parameters
eventName:String

Returns
Boolean
fireEvent()method 
public function fireEvent(e:*):void

Dispatch an event into the FrontController

Parameters
e:*
flush()method 
public static function flush():void

Flush all global FrontController singletons.

getEventDispatcher()method 
public function getEventDispatcher():EventDispatcher

Returns the internal EventDispatcher singleton reference of this FrontController.

Returns
EventDispatcher — the internal EventDispatcher singleton reference of this FrontController.
getInstance()method 
public static function getInstance(channel:String = null):FrontController

Returns a global FrontController singleton.

Parameters
channel:String (default = null) — The channel of the FrontController (default the EventDispatcher.DEFAULT_SINGLETON_NAME value).

Returns
FrontController — a global FrontController singleton.
getListener()method 
public function getListener(eventName:String):*

Returns a EventListener

Parameters
eventName:String — eventName:String

Returns
* — an EventListener or a event callback Function.
insert()method 
public function insert(eventName:String, listener:*):void

Add a new entry into the FrontController.

Parameters
eventName:String
 
listener:* — or listener:Function

Throws
— If the 'eventName' value in argument is null or undefined.
 
— If the 'listener' object in argument is null or undefined.
insertBatch()method 
public function insertBatch(eventName:String, listener:EventListener):void

Adds a new EventListener into an EventListenerBatch in the FrontController. If this listener argument is 'null' or 'undefined' and if the eventName argument isn't register with an EventListenerBatch in the FrontController, an empty EventListenerBatch is created and register in the FrontController with the specified 'eventName'.

Parameters
eventName:String — The name of the event type.
 
listener:EventListener — (optional) The EventListener mapped in the FrontController with the specified event type (This listener is added in an EventListenerBatch).

Throws
— If the 'eventName' value in argument not must be 'null' or 'undefined'.
isEventListenerBatch()method 
public function isEventListenerBatch(eventName:String):Boolean

Indicates if the specified eventlistener registered with the 'eventName' value in argument is an EventListenerBatch instance.

Parameters
eventName:String

Returns
Booleantrue if the specified eventlistener registered with the 'eventName' value in argument is an EventListenerBatch instance.
remove()method 
public function remove(eventName:String):void

Remove an entry into the FrontController.

Parameters
eventName:String — The name of the event type.
removeInstance()method 
public static function removeInstance(channel:String):Boolean

Removes a global FrontController singleton.

Parameters
channel:String — The channel of the FrontController to remove.

Returns
Boolean
setEventDispatcher()method 
public function setEventDispatcher(target:EventDispatcher):void

Sets the EventDispatcher reference of this FrontController.

Parameters
target:EventDispatcher — The EventDispatcher reference of this FrontController.
size()method 
public function size():int

Returns the number of elements in the controller.

Returns
int — the number of elements in the controller.