|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.puremvc.java.patterns.facade.Facade
public class Facade
A base Singleton IFacade implementation.
Model,
View,
Controller| Field Summary | |
|---|---|
protected Controller |
controller
Reference to the Controller |
protected static Facade |
instance
The Singleton instance of the Facade |
protected Model |
model
Reference to the Model |
protected View |
view
Reference to the View |
| Constructor Summary | |
|---|---|
protected |
Facade()
Constructor. |
| Method Summary | |
|---|---|
static Facade |
getInstance()
Facade Singleton Factory method |
boolean |
hasCommand(java.lang.String notificationName)
Check if a Command is registered for a given Notification |
boolean |
hasMediator(java.lang.String mediatorName)
Check if a Mediator is registered or not |
boolean |
hasProxy(java.lang.String proxyName)
Check if a Proxy is registered |
protected void |
initializeController()
Initialize the Controller. |
protected void |
initializeFacade()
Initialize the Multiton Facade instance. |
protected void |
initializeModel()
Initialize the Model. |
protected void |
initializeView()
Initialize the View. |
void |
notifyObservers(INotification note)
Notify Observers of an INotification. |
void |
registerCommand(java.lang.String noteName,
ICommand command)
Register an ICommand with the Controller by
Notification name. |
void |
registerMediator(IMediator mediator)
Register a IMediator with the View. |
void |
registerProxy(IProxy proxy)
Register an IProxy with the Model by name. |
void |
removeCommand(java.lang.String notificationName)
Remove a previously registered ICommand to INotification mapping from the Controller. |
IMediator |
removeMediator(java.lang.String mediatorName)
Remove an IMediator from the View. |
IProxy |
removeProxy(java.lang.String proxyName)
Remove an IProxy from the Model by name. |
IMediator |
retrieveMediator(java.lang.String mediatorName)
Retrieve an IMediator from the View. |
IProxy |
retrieveProxy(java.lang.String proxyName)
Retrieve an IProxy from the Model by name. |
void |
sendNotification(java.lang.String notificationName)
Create and send an INotification. |
void |
sendNotification(java.lang.String notificationName,
java.lang.Object body)
Create and send an INotification. |
void |
sendNotification(java.lang.String notificationName,
java.lang.Object body,
java.lang.String type)
Create and send an INotification. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Facade instance
protected Controller controller
protected Model model
protected View view
| Constructor Detail |
|---|
protected Facade()
This IFacade implementation is a Singleton, so you should
not call the constructor directly, but instead call the static Singleton
Factory method Facade.getInstance()
| Method Detail |
|---|
protected void initializeFacade()
Facade instance.
Called automatically by the constructor. Override in your
subclass to do any subclass specific initializations. Be
sure to call super.initializeFacade(), though.
public static Facade getInstance()
protected void initializeController()
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.
protected void initializeModel()
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.
protected void initializeView()
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.
public void registerCommand(java.lang.String noteName,
ICommand command)
ICommand with the Controller by
Notification name.
registerCommand in interface IFacadenoteName - the name of the INotification to associate the
ICommand withcommand - an instance of the ICommandpublic void removeCommand(java.lang.String notificationName)
ICommand to INotification mapping from the Controller.
removeCommand in interface IFacadenotificationName - the name of the INotification to remove the ICommand mapping forpublic boolean hasCommand(java.lang.String notificationName)
hasCommand in interface IFacadenotificationName -
notificationName.public void registerMediator(IMediator mediator)
IMediator with the View.
registerMediator in interface IFacademediator - the name to associate with this IMediatorpublic void registerProxy(IProxy proxy)
IProxy with the Model by name.
registerProxy in interface IFacadeproxy - the name of the IProxy instance to be
registered with the Model.public IMediator removeMediator(java.lang.String mediatorName)
IMediator from the View.
removeMediator in interface IFacademediatorName - name of the IMediator to be removed.
IMediator that was removed from the Viewpublic IProxy removeProxy(java.lang.String proxyName)
IProxy from the Model by name.
removeProxy in interface IFacadeproxyName - the IProxy to remove from the
Model.
IProxy that was removed from the Modelpublic boolean hasProxy(java.lang.String proxyName)
hasProxy in interface IFacadeproxyName -
proxyName.public boolean hasMediator(java.lang.String mediatorName)
hasMediator in interface IFacademediatorName -
mediatorName.public IMediator retrieveMediator(java.lang.String mediatorName)
IMediator from the View.
retrieveMediator in interface IFacademediatorName -
IMediator previously registered with the given
mediatorName.public IProxy retrieveProxy(java.lang.String proxyName)
IProxy from the Model by name.
retrieveProxy in interface IFacadeproxyName - the name of the proxy to be retrieved.
IProxy instance previously registered with the
given proxyName.
public void sendNotification(java.lang.String notificationName,
java.lang.Object body,
java.lang.String type)
INotification.
Keeps us from having to construct new notification instances in our implementation code.
sendNotification in interface INotifiernotificationName - the name of the notification to sendbody - the body of the notification (optional)type - the type of the notification (optional)
public void sendNotification(java.lang.String notificationName,
java.lang.Object body)
INotification.
Keeps us from having to construct new notification instances in our implementation code.
sendNotification in interface INotifiernotificationName - the name of the notification to sendbody - the body of the notification (optional)public void sendNotification(java.lang.String notificationName)
INotification.
Keeps us from having to construct new notification instances in our implementation code.
sendNotification in interface INotifiernotificationName - the name of the notification to sendpublic void notifyObservers(INotification note)
Observers of an INotification.
notifyObservers in interface IFacadenote - the INotification to have the View
notify observers of.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||