Facade Class Reference

#import <Facade.h>

Inherits IFacade-p.

List of all members.

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


Detailed Description

A base Singleton IFacade implementation.

In PureMVC, the Facade class assumes these responsibilities:

See also:
Model, View, Controller, Notification, Mediator, Proxy, SimpleCommand, MacroCommand

Member Function Documentation

+ (id< IFacade >) getInstance  

Facade Singleton Factory method

Returns:
the Singleton instance of the Facade

- (BOOL) hasCommand: (NSString *)  notificationName   [implementation]

Check if a Command is registered for a given Notification

Parameters:
notificationName 
Returns:
whether a Command is currently registered for the given notificationName.

Reimplemented from < IFacade >.

- (BOOL) hasMediator: (NSString *)  mediatorName   [implementation]

Check if a Mediator is registered or not

Parameters:
mediatorName 
Returns:
whether a Mediator is registered with the given mediatorName.

Reimplemented from < IFacade >.

- (BOOL) hasProxy: (NSString *)  proxyName   [implementation]

Check if a Proxy is registered

Parameters:
proxyName 
Returns:
whether a Proxy is currently registered with the given proxyName.

Reimplemented from < IFacade >.

- (id) init  

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]

Exceptions:
NSException if Singleton instance has already been constructed

- (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..
If you don't want to initialize a different IController, call [super initializeController] at the beginning of your method, then register Commands.

- (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:

  • You wish to initialize a different IModel.
  • You have Proxys to register with the Model that do not retrieve a reference to the Facade at construction time.
If you don't want to initialize a different 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.

- (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 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.

- (void) notifyObservers: (id<INotification>)  notification   [implementation]

Notify Observers.

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.

Parameters:
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.

Parameters:
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.

Parameters:
mediator a reference to the IMediator

Reimplemented from < IFacade >.

- (void) registerProxy: (id<IProxy>)  proxy   [implementation]

Register an IProxy with the Model by name.

Parameters:
proxy the IProxy instance to be registered with the Model.

Reimplemented from < IFacade >.

- (void) removeCommand: (NSString *)  notificationName   [implementation]

Remove a previously registered ICommand to INotification mapping from the Controller.

Parameters:
notificationName the name of the INotification to remove the ICommand mapping for

Reimplemented from < IFacade >.

- (id< IMediator >) removeMediator: (NSString *)  mediatorName   [implementation]

Remove an IMediator from the View.

Parameters:
mediatorName name of the IMediator to be removed.
Returns:
the IMediator that was removed from the View

Reimplemented from < IFacade >.

- (id< IProxy >) removeProxy: (NSString *)  proxyName   [implementation]

Remove an IProxy from the Model by name.

Parameters:
proxyName the IProxy to remove from the Model.
Returns:
the IProxy that was removed from the Model

Reimplemented from < IFacade >.

- (id< IMediator >) retrieveMediator: (NSString *)  mediatorName   [implementation]

Retrieve an IMediator from the View.

Parameters:
mediatorName 
Returns:
the IMediator previously registered with the given mediatorName.

Reimplemented from < IFacade >.

- (id< IProxy >) retrieveProxy: (NSString *)  proxyName   [implementation]

Retrieve an IProxy from the Model by name.

Parameters:
proxyName the name of the proxy to be retrieved.
Returns:
the 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.

Parameters:
notificationName the name of the notiification to send
body the body of the notification
type the type of the notification

Reimplemented from < IFacade >.


Generated on Wed Dec 24 14:19:08 2008 for PureMVC Objective-C by  doxygen 1.5.7.1