IFacade Interface
The interface definition for a PureMVC MultiCore Facade.
The Facade Pattern suggests providing a single class to act as a central point of communication for a subsystem.
In PureMVC, the IFacade acts as an interface between the core MVC actors IModel, IView, IController, and the rest of your application, which (aside from view components and data objects) is mostly expressed with ICommands, IMediators, and IProxys.
This means you don't need to communicate with the IModel, IView, IController instances directly, you can just go through the IFacade. And conveniently, ICommands, IMediators, and IProxys all have a built-in reference to their IFacade after initialization, so they're all plugged in and ready to communicate with each other.
See IModel, IView, IController, IProxy, IMediator, ICommand, INotification
Extends
Implemented by
Methods
Code IController get controller() #
IController get controller();
Code void set controller(IController controllerInstance) #
This IFacade's IController
void set controller( IController controllerInstance );
Code bool hasCommand(String noteName) #
Check if an ICommand is registered for a given INotification name with the IController.
- Param noteName - the name of the INotification.
- Returns
bool
- whether an ICommand is currently registered for the given noteName.
bool hasCommand( String noteName );
Code void set multitonKey(String key) #
This IFacade's Multiton key
void set multitonKey( String key );
Code void notifyObservers(INotification notification) #
Notify IObservers.
This method allows you to send custom INotification classes using the IFacade.
Usually you should just call sendNotification
and pass the parameters,
never having to construct an INotification yourself.
- Param
note
the INotification to have the View notifyObservers
of.
void notifyObservers( INotification notification );
Code void registerCommand(String noteName, Function commandFactory) #
Register an INotification to ICommand mapping with the IController.
- Param noteName - the name of the INotification to associate the ICommand with.
- Param commandFactory - a function that creates a new instance of the ICommand.
void registerCommand( String noteName, Function commandFactory );
Code void registerMediator(IMediator mediator) #
Register an IMediator instance with the IView.
Registers the IMediator so that it can be retrieved by name, and interrogates the IMediator for its INotification interests.
If the IMediator returns a list of INotification
names to be notified about, an Observer is created encapsulating
the IMediator instance's handleNotification
method
and registering it as an IObserver for all INotifications the
IMediator is interested in.
- Param mediator - a reference to the IMediator instance.
void registerMediator( IMediator mediator );
Code void registerObserver(String noteName, IObserver observer) #
Register an IObserver to be notified of INotifications with a given name.
- Param noteName - the name of the INotification to notify this IObserver of.
- Param observer - the IObserver to register.
void registerObserver( String noteName, IObserver observer );
Code void removeCommand(String noteName) #
Remove a previously registered INotification to ICommand mapping from the IController.
- Param noteName - the name of the INotification to remove the ICommand mapping for.
void removeCommand( String noteName );
Code void removeObserver(String noteName, Object notifyContext) #
Remove an IObserver from the list for a given INotification name.
- Param noteName - which IObserver list to remove from.
- Param notifyContext - remove IObservers with this object as the notifyContext.
void removeObserver( String noteName, Object notifyContext );