Controller Class Reference

#import <Controller.h>

Inherits IController-p.

List of all members.

Public Member Functions

(id) - init
(void) - initializeController
(void) - executeCommand: [implementation]
(BOOL) - hasCommand: [implementation]
(void) - registerCommand:commandClassRef: [implementation]
(void) - removeCommand: [implementation]

Static Public Member Functions

(id< IController >) + getInstance


Detailed Description

A Singleton IController implementation.

In PureMVC, the Controller class follows the 'Command and Controller' strategy, and assumes these responsibilities:

Your application must register ICommands with the Controller.

The simplest way is to subclass Facade, and use its initializeController method to add your registrations.

See also:
View, Observer, Notification, SimpleCommand, MacroCommand

Member Function Documentation

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

If an ICommand has previously been registered to handle a the given INotification, then it is executed.

Parameters:
notification an INotification

Reimplemented from < IController >.

+ (id< IController >) getInstance  

Controller Singleton Factory method.

Returns:
the Singleton instance of Controller

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

- (id) init  

Constructor.

This IController implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton Factory method [Controller getInstance]

Exceptions:
NSException if Singleton instance has already been constructed

- (void) initializeController  

Initialize the Singleton Controller instance.

Called automatically by the constructor.

Note that if you are using a subclass of View in your application, you should also subclass Controller and override the initializeController method in the following way:

                // ensure that the Controller is talking to my IView implementation
                -(void)initializeController {
                        self.view = [MyView getInstance];
                }

Returns:
void

- (void) registerCommand: (NSString *)  notificationName
commandClassRef: (Class)  commandClassRef 
[implementation]

Register a particular ICommand class as the handler for a particular INotification.

If an ICommand has already been registered to handle INotifications with this name, it is no longer used, the new ICommand is used instead.

The Observer for the new ICommand is only created if this the first time an ICommand has been regisered for this Notification name.

Parameters:
notificationName the name of the INotification
commandClassRef the Class of the ICommand

Reimplemented from < IController >.

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

Remove a previously registered ICommand to INotification mapping.

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

Reimplemented from < IController >.


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