| Package | org.puremvc.as3.multicore.patterns.facade |
| Class | public class Facade |
| Implements | IFacade |
IFacade implementation.
See also
| Property | Defined by | ||
|---|---|---|---|
| controller : IController | Facade | ||
| instanceMap : Array [static]
| Facade | ||
| model : IModel | Facade | ||
| multitonKey : String | Facade | ||
| view : IView | Facade | ||
| Method | Defined by | ||
|---|---|---|---|
|
Facade(key:String)
Constructor.
| Facade | ||
|
getInstance(key:String):IFacade
[static]
Facade Multiton Factory method
| Facade | ||
|
hasCommand(notificationName:String):Boolean
Check if a Command is registered for a given Notification
| Facade | ||
|
hasMediator(mediatorName:String):Boolean
Check if a Mediator is registered or not
| Facade | ||
|
hasProxy(proxyName:String):Boolean
Check if a Proxy is registered
| Facade | ||
|
initializeNotifier(key:String):void
Set the Multiton key for this facade instance.
| Facade | ||
|
notifyObservers(notification:INotification):void
Notify
Observers. | Facade | ||
|
registerCommand(notificationName:String, commandClassRef:Class):void
Register an
ICommand with the Controller by Notification name. | Facade | ||
|
registerMediator(mediator:IMediator):void
Register a
IMediator with the View. | Facade | ||
|
registerProxy(proxy:IProxy):void
Register an
IProxy with the Model by name. | Facade | ||
|
removeCommand(notificationName:String):void
Remove a previously registered
ICommand to INotification mapping from the Controller. | Facade | ||
|
removeCore(key:String):void
Remove a Core
| Facade | ||
|
removeMediator(mediatorName:String):IMediator
Remove an
IMediator from the View. | Facade | ||
|
removeProxy(proxyName:String):IProxy
Remove an
IProxy from the Model by name. | Facade | ||
|
retrieveMediator(mediatorName:String):IMediator
Retrieve an
IMediator from the View. | Facade | ||
|
retrieveProxy(proxyName:String):IProxy
Retrieve an
IProxy from the Model by name. | Facade | ||
|
sendNotification(notificationName:String, body:Object = null, type:String = null):void
Create and send an
INotification. | Facade | ||
| Method | Defined by | ||
|---|---|---|---|
|
initializeController():void
Initialize the
Controller. | Facade | ||
|
initializeFacade():void
Initialize the Multiton
Facade instance. | Facade | ||
|
initializeModel():void
Initialize the
Model. | Facade | ||
|
initializeView():void
Initialize the
View. | Facade | ||
| Constant | Defined by | ||
|---|---|---|---|
| MULTITON_MSG : String = "Facade instance for this Multiton key already constructed!" | Facade | ||
| controller | property |
protected var controller:IController
| instanceMap | property |
protected static var instanceMap:Array
| model | property |
protected var model:IModel
| multitonKey | property |
protected var multitonKey:String
| view | property |
protected var view:IView
| Facade | () | constructor |
public function Facade(key:String)Constructor.
This IFacade implementation is a Multiton,
so you should not call the constructor
directly, but instead call the static Factory method,
passing the unique key for this instance
Facade.getInstance( multitonKey )
key:String |
— Error if instance for this Multiton key has already been constructed
|
| getInstance | () | method |
public static function getInstance(key:String):IFacadeFacade Multiton Factory method
Parameterskey:String |
IFacade —
the Multiton instance of the Facade
|
| hasCommand | () | method |
public function hasCommand(notificationName:String):BooleanCheck if a Command is registered for a given Notification
ParametersnotificationName:String |
Boolean — whether a Command is currently registered for the given notificationName.
|
| hasMediator | () | method |
public function hasMediator(mediatorName:String):BooleanCheck if a Mediator is registered or not
ParametersmediatorName:String |
Boolean — whether a Mediator is registered with the given mediatorName.
|
| hasProxy | () | method |
public function hasProxy(proxyName:String):BooleanCheck if a Proxy is registered
ParametersproxyName:String |
Boolean — whether a Proxy is currently registered with the given proxyName.
|
| initializeController | () | method |
protected function initializeController():void
Initialize the Controller.
Called by the initializeFacade method.
Override this method in your subclass of Facade
if one or both of the following are true:
IController.Commands to register with the Controller at startup.. IController,
call super.initializeController() at the beginning of your
method, then register Commands.
| initializeFacade | () | method |
protected function initializeFacade():void
Initialize the Multiton Facade instance.
Called automatically by the constructor. Override in your
subclass to do any subclass specific initializations. Be
sure to call super.initializeFacade(), though.
| initializeModel | () | method |
protected function initializeModel():void
Initialize the Model.
Called by the initializeFacade method.
Override this method in your subclass of Facade
if one or both of the following are true:
IModel.Proxys to register with the Model that do not
retrieve a reference to the Facade at construction time.IModel,
call super.initializeModel() at the beginning of your
method, then register Proxys.
Note: This method is rarely overridden; in practice you are more
likely to use a Command to create and register Proxys
with the Model, since Proxys with mutable data will likely
need to send INotifications and thus will likely want to fetch a reference to
the Facade during their construction.
| initializeNotifier | () | method |
public function initializeNotifier(key:String):voidSet the Multiton key for this facade instance.
Not called directly, but instead from the constructor when getInstance is invoked. It is necessary to be public in order to implement INotifier.
Parameterskey:String |
| initializeView | () | method |
protected function initializeView():void
Initialize the View.
Called by the initializeFacade method.
Override this method in your subclass of Facade
if one or both of the following are true:
IView.Observers to register with the ViewIView,
call super.initializeView() at the beginning of your
method, then register IMediator instances.
Note: This method is rarely overridden; in practice you are more
likely to use a Command to create and register Mediators
with the View, since IMediator instances will need to send
INotifications and thus will likely want to fetch a reference
to the Facade during their construction.
| notifyObservers | () | method |
public function notifyObservers(notification:INotification):void
Notify Observers.
This method is left public mostly for backward compatibility, and to allow you to send custom notification classes using the facade.
P> Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself. Parametersnotification:INotification — the INotification to have the View notify Observers of.
|
| registerCommand | () | method |
public function registerCommand(notificationName:String, commandClassRef:Class):void
Register an ICommand with the Controller by Notification name.
notificationName:String — the name of the INotification to associate the ICommand with
|
|
commandClassRef:Class — a reference to the Class of the ICommand
|
| registerMediator | () | method |
public function registerMediator(mediator:IMediator):void
Register a IMediator with the View.
mediator:IMediator — the name to associate with this IMediator
|
| registerProxy | () | method |
public function registerProxy(proxy:IProxy):void
Register an IProxy with the Model by name.
proxy:IProxy — the name of the IProxy.
|
| removeCommand | () | method |
public function removeCommand(notificationName:String):void
Remove a previously registered ICommand to INotification mapping from the Controller.
notificationName:String — the name of the INotification to remove the ICommand mapping for
|
| removeCore | () | method |
public function removeCore(key:String):voidRemove a Core
Parameterskey:String — of the Core to remove
|
| removeMediator | () | method |
public function removeMediator(mediatorName:String):IMediator
Remove an IMediator from the View.
mediatorName:String — name of the IMediator to be removed.
|
IMediator —
the IMediator that was removed from the View
|
| removeProxy | () | method |
public function removeProxy(proxyName:String):IProxy
Remove an IProxy from the Model by name.
proxyName:String — the IProxy to remove from the Model.
|
IProxy —
the IProxy that was removed from the Model
|
| retrieveMediator | () | method |
public function retrieveMediator(mediatorName:String):IMediator
Retrieve an IMediator from the View.
mediatorName:String |
IMediator —
the IMediator previously registered with the given mediatorName.
|
| retrieveProxy | () | method |
public function retrieveProxy(proxyName:String):IProxy
Retrieve an IProxy from the Model by name.
proxyName:String — the name of the proxy to be retrieved.
|
IProxy —
the IProxy instance previously registered with the given proxyName.
|
| sendNotification | () | method |
public function sendNotification(notificationName:String, body:Object = null, type:String = null):void
Create and send an INotification.
Keeps us from having to construct new notification instances in our implementation code.
ParametersnotificationName:String — the name of the notiification to send
|
|
body:Object (default = null) — the body of the notification (optional)
|
|
type:String (default = null) — the type of the notification (optional)
|
| MULTITON_MSG | constant |
protected const MULTITON_MSG:String = "Facade instance for this Multiton key already constructed!"