| Package | system.events |
| Class | public class FrontController |
| Inheritance | FrontController Object |
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.
| Method | Defined By | ||
|---|---|---|---|
FrontController(channel:String = null, target:EventDispatcher = null)
Creates a new FrontController instance. | FrontController | ||
add(type:String, listener:*):void
Add a new entry into the FrontController. | FrontController | ||
addBatch(type:String, listener:EventListener = null):void
Adds a new EventListener into an EventListenerBatch in the FrontController. | FrontController | ||
clear():void
Removes all entries in the FrontController. | FrontController | ||
contains(type:String):Boolean
Returns true if the specified type is registered in the FrontController. | FrontController | ||
containsInstance(channel:String):Boolean [static]
Indicates if the specified singleton reference is register. | FrontController | ||
fireEvent(event:*):void
Dispatch an event into the FrontController
| FrontController | ||
flush():void [static]
Flush all global FrontController singletons. | FrontController | ||
getChannels():Array [static]
Returns the Array representation of all channels register in the FrontController factory or null if no singletons are registered. | FrontController | ||
Returns the internal EventDispatcher singleton reference of this FrontController. | FrontController | ||
getInstance(channel:String = null):FrontController [static]
Returns a global FrontController singleton. | FrontController | ||
getListener(type:String):*
Returns the listener register in the frontcontroller with the specified event name. | FrontController | ||
isEventListenerBatch(type:String):Boolean
Indicates if the specified EventListener registered with the specified type in argument is an EventListenerBatch instance. | FrontController | ||
remove(eventName:String):void
Remove an entry into the FrontController. | FrontController | ||
removeInstance(channel:String = null):Boolean [static]
Removes a global FrontController singleton. | FrontController | ||
setEventDispatcher(target:EventDispatcher):void
Sets the EventDispatcher reference of this FrontController. | FrontController | ||
size():int
Returns the number of elements in the controller. | FrontController | ||
| FrontController | () | Constructor |
public function FrontController(channel:String = null, target:EventDispatcher = null)Creates a new FrontController instance.
Parameterschannel: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() ;
|
| add | () | method |
public function add(type:String, listener:*):voidAdd a new entry into the FrontController.
Parameters
type:String — The type used to register the specified listener.
| |
listener:* — A listener Function or an EventListener object.
|
ArgumentError — If the 'type' value in argument is null or undefined.
| |
ArgumentError — If the 'listener' object in argument is null or undefined.
|
| addBatch | () | method |
public function addBatch(type:String, listener:EventListener = null):void
Adds a new EventListener into an EventListenerBatch in the FrontController.
If this listener argument is null' 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
type:String — The type to register the specified listener.
| |
listener:EventListener (default = null) — (optional) The EventListener mapped in the FrontController with the specified event type (This listener is added in an EventListenerBatch).
|
ArgumentError — If the 'type' argument not must be null.
|
| clear | () | method |
public function clear():voidRemoves all entries in the FrontController.
| contains | () | method |
public function contains(type:String):Boolean
Returns true if the specified type is registered in the FrontController.
Parameters
type:String — The search type value.
|
Boolean — true if the specified type is registered in the FrontController.
|
| containsInstance | () | method |
public static function containsInstance(channel:String):BooleanIndicates if the specified singleton reference is register.
Parameters
channel:String — the channel value of the singleton reference register in the factory.
|
Boolean — true If the specified singleton reference is register.
|
| fireEvent | () | method |
public function fireEvent(event:*):voidDispatch an event into the FrontController
Parameters
event:* — A type value who corresponding a event type or an event object.
|
ArgumentError — If the passed-in 'event' argument is not a String or an Event object.
|
| flush | () | method |
public static function flush():voidFlush all global FrontController singletons.
| getChannels | () | method |
public static function getChannels():Array
Returns the Array representation of all channels register in the FrontController factory or null if no singletons are registered.
Array — the Array representation of all channels register in the FrontController factory or null if no singletons are registered.
|
| getEventDispatcher | () | method |
public function getEventDispatcher():EventDispatcherReturns the internal EventDispatcher singleton reference of this FrontController.
ReturnsEventDispatcher — 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).
|
FrontController — a global FrontController singleton.
|
| getListener | () | method |
public function getListener(type:String):*Returns the listener register in the frontcontroller with the specified event name.
Parameters
type:String — The type of the listener register.
|
* — an EventListener or a event callback Function.
|
| isEventListenerBatch | () | method |
public function isEventListenerBatch(type:String):Boolean
Indicates if the specified EventListener registered with the specified type in argument is an EventListenerBatch instance.
Parameters
type:String — The type to indicates if an EventListenerBatch is registered.
|
Boolean — true if the specified EventListener or listener function registered with the 'eventName' value in argument is an EventListenerBatch instance.
|
| remove | () | method |
public function remove(eventName:String):voidRemove an entry into the FrontController.
Parameters
eventName:String — The name of the event type.
|
| removeInstance | () | method |
public static function removeInstance(channel:String = null):BooleanRemoves a global FrontController singleton.
Parameters
channel:String (default = null) — The channel of the FrontController to remove.
|
Boolean — true if a singleton is removed with the specified channel.
|
| setEventDispatcher | () | method |
public function setEventDispatcher(target:EventDispatcher):voidSets the EventDispatcher reference of this FrontController.
Parameters
target:EventDispatcher — The EventDispatcher reference of this FrontController.
|
| size | () | method |
public function size():intReturns the number of elements in the controller.
Returnsint — the number of elements in the controller.
|