org.puremvc.php.patterns.facade

# Class: Facade Source Location: /patterns/facade/Facade.php
### Class Overview
A base Singleton IFacade implementation. #### Author(s): Implements interfaces: IFacade | ### Variables $controller $instance $model $view | ### Methods __construct getInstance hasCommand hasMediator hasProxy initializeController initializeFacade initializeModel initializeView notifyObservers registerCommand registerMediator registerProxy removeCommand removeMediator removeProxy retrieveMediator retrieveProxy sendNotification
### Child classes: ApplicationFacade ApplicationFacade for the BasicDemo starts the Model, View Controller for the application.
### Class Details [line 49] A base Singleton IFacade implementation. In PureMVC, the Facade class assumes these responsibilities: Initializing the Model , View and Controller Singletons. Providing all the methods defined by the IModel, IView, & IController interfaces. Providing the ability to override the specific Model , View and Controller Singletons created. Providing a single point of contact to the application for registering Commands and notifying Observers #### Tags:
see: | org.puremvc.php.patterns.proxy.Proxy Proxy
see: | org.puremvc.php.patterns.command.SimpleCommand SimpleCommand
see: | org.puremvc.php.patterns.command.MacroCommand MacroCommand
see: | org.puremvc.php.patterns.mediator.Mediator Mediator
see: | org.puremvc.php.patterns.observer.Notification Notification
see: | org.puremvc.php.core.View View
see: | org.puremvc.php.core.Controller Controller
see: | org.puremvc.php.core.Model Model
[ Top ] ### Class Variables #### static $instance = [line 58] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $controller = [line 53] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $model = [line 54] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $view = [line 55] #### Tags:
access: | protected
Type: | mixed
[ Top ] ### Class Methods ### static method getInstance [line 96]
`static the getInstance( )`
Facade Singleton Factory method #### Tags:
return: | Singleton instance of the Facade
access: | public
Overridden in child classes as: ApplicationFacade::getInstance() Instance getter for the ApplicationFacade, this method starts the Facade. [ Top ] ### constructor __construct [line 71]
`Facade __construct( )`
Constructor. This IFacade implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton Factory method Facade.getInstance() #### Tags:
throws: | Error Error if Singleton instance has already been constructed
access: | protected
[ Top ] ### method hasCommand [line 219]
`whether hasCommand( notificationName $notificationName)`
Check if a Command is registered for a given Notification #### Tags:
return: | a Command is currently registered for the given notificationName .
access: | public
#### Parameters:
notificationName | $notificationName |
[ Top ] ### method hasMediator [line 294]
`void hasMediator( mediatorName $mediatorName)`
Check to see if a Mediator is registered with the View. #### Tags:
access: | public
#### Parameters:
mediatorName | $mediatorName | name of the IMediator instance to check for.
[ Top ] ### method hasProxy [line 251]
`void hasProxy( proxyName $proxyName)`
Check to see if a Proxy is registered with the Model. #### Tags:
access: | public
#### Parameters:
proxyName | $proxyName | name of the IProxy instance to check for.
[ Top ] ### method initializeController [line 118]
`void initializeController( )`
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: You wish to initialize a different IController . You have Commands to register with the Controller at startup.</code>. If you don't want to initialize a different IController , call super.initializeController() at the beginning of your method, then register Command s. #### Tags:
access: | protected
Overridden in child classes as: ApplicationFacade::initializeController() Initializes the controller and gives you an opportunity to register application specific commands that extend SimpleCommand or MacroCommand with the PureMVC framework. [ Top ] ### method initializeFacade [line 84]
`void initializeFacade( )`
Initialize the Singleton Facade instance. Called automatically by the constructor. Override in your subclass to do any subclass specific initializations. Be sure to call super.initializeFacade() , though. #### Tags:
access: | protected
[ Top ] ### method initializeModel [line 147]
`void initializeModel( )`
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: You wish to initialize a different IModel . You have Proxy s to register with the Model that do not retrieve a reference to the Facade at construction time.</code> If you don't want to initialize a different IModel , call super.initializeModel() at the beginning of your method, then register Proxy s. Note: This method is rarely overridden; in practice you are more likely to use a Command to create and register Proxy s with the Model , since Proxy s with mutable data will likely need to send INotification s and thus will likely want to fetch a reference to the Facade during their construction. #### Tags:
access: | protected
[ Top ] ### method initializeView [line 176]
`void initializeView( )`
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: You wish to initialize a different IView . You have Observers to register with the View If you don't want to initialize a different IView , 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 Mediator s with the View , since IMediator instances will need to send INotification s and thus will likely want to fetch a reference to the Facade during their construction. #### Tags:
access: | protected
[ Top ] ### method notifyObservers [line 187]
`void notifyObservers( $notification)`
Notify Observer s. #### Tags:
access: | public
#### Parameters:
notification | $notification | the INotification to have the View notify Observers of.
[ Top ] ### method registerCommand [line 198]
`void registerCommand( notificationName $notificationName, commandClassRef $commandClassRef)`
Register an ICommand with the Controller by Notification name. #### Tags:
access: | public
#### Parameters:
notificationName | $notificationName | the name of the INotification to associate the ICommand with
commandClassRef | $commandClassRef | a reference to the Class of the ICommand
[ Top ] ### method registerMediator [line 273]
`void registerMediator( $mediator, mediator 1)`
Register a IMediator with the View . #### Tags:
access: | public
#### Parameters:
mediator | 1 | a reference to the IMediator
mediatorName | $mediator | the name to associate with this IMediator
[ Top ] ### method registerProxy [line 230]
`void registerProxy( $proxy, proxy 1)`
Register an IProxy with the Model by name. #### Tags:
access: | public
#### Parameters:
proxy | 1 | the IProxy instance to be registered with the Model .
proxyName | $proxy | the name of the IProxy .
[ Top ] ### method removeCommand [line 208]
`void removeCommand( notificationName $notificationName)`
Remove a previously registered ICommand to INotification mapping from the Controller. #### Tags:
access: | public
#### Parameters:
notificationName | $notificationName | the name of the INotification to remove the ICommand mapping for
[ Top ] ### method removeMediator [line 304]
`void removeMediator( mediatorName $mediatorName)`
Remove an IMediator from the View . #### Tags:
access: | public
#### Parameters:
mediatorName | $mediatorName | name of the IMediator to be removed.
[ Top ] ### method removeProxy [line 261]
`void removeProxy( proxyName $proxyName)`
Remove an IProxy from the Model by name. #### Tags:
access: | public
#### Parameters:
proxyName | $proxyName | the IProxy to remove from the Model .
[ Top ] ### method retrieveMediator [line 284]
`the retrieveMediator( mediatorName $mediatorName)`
Retrieve an IMediator from the View . #### Tags:
return: | IMediator previously registered with the given mediatorName .
access: | public
#### Parameters:
mediatorName | $mediatorName |
[ Top ] ### method retrieveProxy [line 241]
`the retrieveProxy( proxyName $proxyName)`
Retrieve an IProxy from the Model by name. #### Tags:
return: | IProxy instance previously registered with the given proxyName .
access: | public
#### Parameters:
proxyName | $proxyName | the name of the proxy to be retrieved.
[ Top ] ### method sendNotification [line 320]
`void sendNotification( notificationName $notificationName, [body $body = null], [type $type = null])`
Send an INotification . Keeps us from having to construct new notification instances in our implementation code. #### Tags:
access: | public
#### Parameters:
notificationName | $notificationName | the name of the notiification to send
body | $body | the body of the notification (optional)
type | $type | the type of the notification (optional)
[ Top ] Documentation generated on Tue, 30 Sep 2008 08:05:43 -0700 by phpDocumentor 1.4.0