IFacade implementation.
More...

Public Member Functions | |
| void | RegisterProxy (IProxy proxy) |
Register an IProxy with the Model by name. | |
| IProxy | RetrieveProxy (string proxyName) |
Retrieve a IProxy from the Model by name. | |
| IProxy | RemoveProxy (string proxyName) |
Remove an IProxy instance from the Model by name. | |
| bool | HasProxy (string proxyName) |
| Check if a Proxy is registered. | |
| void | RegisterCommand (string notificationName, Type commandType) |
Register an ICommand with the Controller. | |
| void | RemoveCommand (string notificationName) |
Remove a previously registered ICommand to INotification mapping from the Controller. | |
| bool | HasCommand (string notificationName) |
| Check if a Command is registered for a given Notification. | |
| void | RegisterMediator (IMediator mediator) |
Register an IMediator instance with the View. | |
| IMediator | RetrieveMediator (string mediatorName) |
Retrieve an IMediator instance from the View. | |
| IMediator | RemoveMediator (string mediatorName) |
Remove a IMediator instance from the View. | |
| bool | HasMediator (string mediatorName) |
| Check if a Mediator is registered or not. | |
| void | NotifyObservers (INotification notification) |
Notify Observers of an INotification. | |
| void | SendNotification (string notificationName) |
Send an INotification. | |
| void | SendNotification (string notificationName, object body) |
Send an INotification. | |
| void | SendNotification (string notificationName, object body, string type) |
Send an INotification. | |
Protected Member Functions | |
| Facade () | |
| virtual void | InitializeFacade () |
Initialize the Singleton Facade instance. | |
| virtual void | InitializeController () |
Initialize the Controller. | |
| virtual void | InitializeModel () |
Initialize the Model. | |
| virtual void | InitializeView () |
Initialize the View. | |
Protected Attributes | |
| IController | m_controller |
| IModel | m_model |
| Private reference to the Model. | |
| IView | m_view |
| Private reference to the View. | |
Static Protected Attributes | |
| static volatile IFacade | m_instance |
| The Singleton Facade Instance. | |
| static readonly object | m_staticSyncRoot = new object() |
| Used for locking the instance calls. | |
Properties | |
| static IFacade | Instance [get] |
| Facade Singleton Factory method. This method is thread safe. | |
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 using PureMVC.Patterns; using com.me.myapp.model; using com.me.myapp.view; using com.me.myapp.controller; public class MyFacade : Facade { // Notification constants. The Facade is the ideal // location for these constants, since any part // of the application participating in PureMVC // Observer Notification will know the Facade. public static const string GO_COMMAND = "go"; // we aren't allowed to initialize new instances from outside this class protected MyFacade() {} // we must specify the type of instance static MyFacade() { instance = new MyFacade(); } // Override Singleton Factory method public new static MyFacade getInstance() { return instance as MyFacade; } // optional initialization hook for Facade public override void initializeFacade() { base.initializeFacade(); // do any special subclass initialization here } // optional initialization hook for Controller public override void initializeController() { // call base to use the PureMVC Controller Singleton. base.initializeController(); // Otherwise, if you're implmenting your own // IController, then instead do: // if ( controller != null ) return; // controller = MyAppController.getInstance(); // do any special subclass initialization here // such as registering Commands registerCommand( GO_COMMAND, com.me.myapp.controller.GoCommand ) } // optional initialization hook for Model public override void initializeModel() { // call base to use the PureMVC Model Singleton. base.initializeModel(); // Otherwise, if you're implmenting your own // IModel, then instead do: // if ( model != null ) return; // model = MyAppModel.getInstance(); // do any special subclass initialization here // such as creating and registering Model proxys // that don't require a facade reference at // construction time, such as fixed type lists // that never need to send Notifications. regsiterProxy( new USStateNamesProxy() ); // CAREFUL: Can't reference Facade instance in constructor // of new Proxys from here, since this step is part of // Facade construction! Usually, Proxys needing to send // notifications are registered elsewhere in the app // for this reason. } // optional initialization hook for View public override void initializeView() { // call base to use the PureMVC View Singleton. base.initializeView(); // Otherwise, if you're implmenting your own // IView, then instead do: // if ( view != null ) return; // view = MyAppView.Instance; // do any special subclass initialization here // such as creating and registering Mediators // that do not need a Facade reference at construction // time. registerMediator( new LoginMediator() ); // CAREFUL: Can't reference Facade instance in constructor // of new Mediators from here, since this is a step // in Facade construction! Usually, all Mediators need // receive notifications, and are registered elsewhere in // the app for this reason. } }
PureMVC.Core.Model PureMVC.Core.View PureMVC.Core.Controller PureMVC.Patterns.Notification PureMVC.Patterns.Mediator PureMVC.Patterns.Proxy PureMVC.Patterns.SimpleCommand PureMVC.Patterns.MacroCommand
| PureMVC.Patterns.Facade.Facade | ( | ) | [protected] |
Constructor that initializes the Facade
This IFacade implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton Factory method Facade.Instance
| bool PureMVC.Patterns.Facade.HasCommand | ( | string | notificationName | ) |
Check if a Command is registered for a given Notification.
| notificationName | The name of the INotification to check for. |
notificationName.Implements PureMVC.Interfaces.IFacade.
| bool PureMVC.Patterns.Facade.HasMediator | ( | string | mediatorName | ) |
Check if a Mediator is registered or not.
| mediatorName | The name of the IMediator instance to check for |
mediatorName
Implements PureMVC.Interfaces.IFacade.
| bool PureMVC.Patterns.Facade.HasProxy | ( | string | proxyName | ) |
Check if a Proxy is registered.
| proxyName | The name of the IProxy instance to check for |
proxyName.Implements PureMVC.Interfaces.IFacade.
| virtual void PureMVC.Patterns.Facade.InitializeController | ( | ) | [protected, virtual] |
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
If you don't want to initialize a different IController, call base.initializeController() at the beginning of your method, then register Commands
| virtual void PureMVC.Patterns.Facade.InitializeFacade | ( | ) | [protected, virtual] |
Initialize the Singleton Facade instance.
Called automatically by the constructor. Override in your subclass to do any subclass specific initializations. Be sure to call base.initializeFacade(), though
| virtual void PureMVC.Patterns.Facade.InitializeModel | ( | ) | [protected, virtual] |
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 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 base.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
| virtual void PureMVC.Patterns.Facade.InitializeView | ( | ) | [protected, virtual] |
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 Observers to register with the View
If you don't want to initialize a different IView, call base.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 PureMVC.Patterns.Facade.NotifyObservers | ( | INotification | notification | ) |
Notify Observers of an INotification.
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 |
Implements PureMVC.Interfaces.IFacade.
| void PureMVC.Patterns.Facade.RegisterCommand | ( | string | notificationName, | |
| Type | commandType | |||
| ) |
Register an ICommand with the Controller.
| notificationName | The name of the INotification to associate the ICommand with. | |
| commandType | A reference to the Type of the ICommand |
Implements PureMVC.Interfaces.IFacade.
| void PureMVC.Patterns.Facade.RegisterMediator | ( | IMediator | mediator | ) |
Register an IMediator instance with the View.
| mediator | A reference to the IMediator instance |
Implements PureMVC.Interfaces.IFacade.
| void PureMVC.Patterns.Facade.RegisterProxy | ( | IProxy | proxy | ) |
Register an IProxy with the Model by name.
| proxy | The IProxy to be registered with the Model |
Implements PureMVC.Interfaces.IFacade.
| void PureMVC.Patterns.Facade.RemoveCommand | ( | string | notificationName | ) |
Remove a previously registered ICommand to INotification mapping from the Controller.
| notificationName | TRemove a previously registered ICommand to INotification mapping from the Controller. |
Implements PureMVC.Interfaces.IFacade.
| IMediator PureMVC.Patterns.Facade.RemoveMediator | ( | string | mediatorName | ) |
Remove a IMediator instance from the View.
| mediatorName | The name of the IMediator instance to be removed |
Implements PureMVC.Interfaces.IFacade.
| IProxy PureMVC.Patterns.Facade.RemoveProxy | ( | string | proxyName | ) |
Remove an IProxy instance from the Model by name.
| proxyName | The IProxy to remove from the Model |
Implements PureMVC.Interfaces.IFacade.
| IMediator PureMVC.Patterns.Facade.RetrieveMediator | ( | string | mediatorName | ) |
Retrieve an IMediator instance from the View.
| mediatorName | The name of the IMediator instance to retrieve |
IMediator previously registered with the given mediatorNameImplements PureMVC.Interfaces.IFacade.
| IProxy PureMVC.Patterns.Facade.RetrieveProxy | ( | string | proxyName | ) |
Retrieve a IProxy from the Model by name.
| proxyName | The name of the IProxy instance to be retrieved |
IProxy previously regisetered by proxyName with the ModelImplements PureMVC.Interfaces.IFacade.
| void PureMVC.Patterns.Facade.SendNotification | ( | string | notificationName, | |
| object | body, | |||
| string | type | |||
| ) |
Send an INotification.
| notificationName | The name of the notification to send | |
| body | The body of the notification | |
| type | The type of the notification |
Implements PureMVC.Interfaces.INotifier.
| void PureMVC.Patterns.Facade.SendNotification | ( | string | notificationName, | |
| object | body | |||
| ) |
Send an INotification.
| notificationName | The name of the notification to send | |
| body | The body of the notification |
Implements PureMVC.Interfaces.INotifier.
| void PureMVC.Patterns.Facade.SendNotification | ( | string | notificationName | ) |
Send an INotification.
| notificationName | The name of the notiification to send |
Implements PureMVC.Interfaces.INotifier.
IController PureMVC.Patterns.Facade.m_controller [protected] |
Private reference to the Controller
volatile IFacade PureMVC.Patterns.Facade.m_instance [static, protected] |
The Singleton Facade Instance.
IModel PureMVC.Patterns.Facade.m_model [protected] |
Private reference to the Model.
readonly object PureMVC.Patterns.Facade.m_staticSyncRoot = new object() [static, protected] |
Used for locking the instance calls.
IView PureMVC.Patterns.Facade.m_view [protected] |
Private reference to the View.
IFacade PureMVC.Patterns.Facade.Instance [static, get] |
Facade Singleton Factory method. This method is thread safe.
1.5.8