#import <Facade.h>
Inherits IFacade-p.
Public Member Functions | |
(id) | - init |
(void) | - initializeFacade |
(void) | - initializeController |
(void) | - initializeView |
(void) | - initializeModel |
(void) | - sendNotification:body:type: [implementation] |
(BOOL) | - hasCommand: [implementation] |
(BOOL) | - hasMediator: [implementation] |
(BOOL) | - hasProxy: [implementation] |
(void) | - notifyObservers: [implementation] |
(void) | - registerCommand:commandClassRef: [implementation] |
(void) | - registerMediator: [implementation] |
(void) | - registerProxy: [implementation] |
(void) | - removeCommand: [implementation] |
(id< IMediator >) | - removeMediator: [implementation] |
(id< IProxy >) | - removeProxy: [implementation] |
(id< IMediator >) | - retrieveMediator: [implementation] |
(id< IProxy >) | - retrieveProxy: [implementation] |
Static Public Member Functions | |
(id< IFacade >) | + getInstance |
IFacade
implementation.
In PureMVC, the Facade
class assumes these responsibilities:
Model
, View
and Controller
Singletons. IModel, IView, & IController
interfaces. Model
, View
and Controller
Singletons created. Commands
and notifying Observers
+ (id< IFacade >) getInstance |
- (BOOL) hasCommand: | (NSString *) | notificationName | [implementation] |
Check if a Command is registered for a given Notification
notificationName |
notificationName
. Reimplemented from < IFacade >.
- (BOOL) hasMediator: | (NSString *) | mediatorName | [implementation] |
Check if a Mediator is registered or not
mediatorName |
mediatorName
. Reimplemented from < IFacade >.
- (BOOL) hasProxy: | (NSString *) | proxyName | [implementation] |
Check if a Proxy is registered
proxyName |
proxyName
. Reimplemented from < IFacade >.
- (id) init |
- (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:
IController
. Commands
to register with the Controller
at startup.. IController
, call [super initializeController]
at the beginning of your method, then register Command
s.
- (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.
- (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:
IModel
. Proxy
s 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 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.
- (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:
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.
- (void) notifyObservers: | (id<INotification>) | notification | [implementation] |
Notify Observer
s.
This method is left public mostly for backward compatibility, and to allow you to send custom notification classes using the facade.
Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself.
notification | the INotification to have the View notify Observers of. |
Reimplemented from < IFacade >.
- (void) registerCommand: | (NSString *) | notificationName | ||
commandClassRef: | (Class) | commandClassRef | ||
[implementation] |
Register an ICommand
with the Controller
by Notification name.
notificationName | the name of the INotification to associate the ICommand with | |
commandClassRef | a reference to the Class of the ICommand |
Reimplemented from < IFacade >.
- (void) registerMediator: | (id<IMediator>) | mediator | [implementation] |
Register a IMediator
with the View
.
mediator | a reference to the IMediator |
Reimplemented from < IFacade >.
- (void) registerProxy: | (id<IProxy>) | proxy | [implementation] |
- (void) removeCommand: | (NSString *) | notificationName | [implementation] |
Remove a previously registered ICommand
to INotification
mapping from the Controller.
notificationName | the name of the INotification to remove the ICommand mapping for |
Reimplemented from < IFacade >.
- (id< IMediator >) removeMediator: | (NSString *) | mediatorName | [implementation] |
- (id< IProxy >) removeProxy: | (NSString *) | proxyName | [implementation] |
- (id< IMediator >) retrieveMediator: | (NSString *) | mediatorName | [implementation] |
Retrieve an IMediator
from the View
.
mediatorName |
IMediator
previously registered with the given mediatorName
. Reimplemented from < IFacade >.
- (id< IProxy >) retrieveProxy: | (NSString *) | proxyName | [implementation] |
Retrieve an IProxy
from the Model
by name.
proxyName | the name of the proxy to be retrieved. |
IProxy
instance previously registered with the given proxyName
. Reimplemented from < IFacade >.
- (void) sendNotification: | (NSString *) | notificationName | ||
body: | (id) | body | ||
type: | (NSString *) | type | ||
[implementation] |
Create and send an INotification
.
Keeps us from having to construct new notification instances in our implementation code.
notificationName | the name of the notiification to send | |
body | the body of the notification | |
type | the type of the notification |
Reimplemented from < IFacade >.