#import <Controller.h>
Inherits IController-p.
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 |
IController implementation.
In PureMVC, the Controller class follows the 'Command and Controller' strategy, and assumes these responsibilities:
ICommands are intended to handle which INotifications. IObserver with the View for each INotification that it has an ICommand mapping for. ICommand to handle a given INotification when notified by the View. ICommand's execute method, passing in the INotification.
Your application must register ICommands with the Controller.
The simplest way is to subclass Facade, and use its initializeController method to add your registrations.
| - (void) executeCommand: | (id<INotification>) | notification | [implementation] |
If an ICommand has previously been registered to handle a the given INotification, then it is executed.
| notification | an INotification |
Reimplemented from < IController >.
| + (id< IController >) getInstance |
| - (BOOL) hasCommand: | (NSString *) | notificationName | [implementation] |
Check if a Command is registered for a given Notification
| notificationName |
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]
| 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]; }
| - (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.
| 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.
| notificationName | the name of the INotification to remove the ICommand mapping for |
Reimplemented from < IController >.
1.5.7.1