PureMVC.Core.View Class Reference

A Singleton IView implementation. More...

Inheritance diagram for PureMVC.Core.View:

PureMVC.Interfaces.IView

List of all members.

Public Member Functions

virtual void RegisterObserver (string notificationName, IObserver observer)
 Register an IObserver to be notified of INotifications with a given name.
virtual void NotifyObservers (INotification notification)
 Notify the IObservers for a particular INotification.
virtual void RemoveObserver (string notificationName, object notifyContext)
 Remove the observer for a given notifyContext from an observer list for a given Notification name.
virtual void RegisterMediator (IMediator mediator)
 Register an IMediator instance with the View.
virtual IMediator RetrieveMediator (string mediatorName)
 Retrieve an IMediator from the View.
virtual IMediator RemoveMediator (string mediatorName)
 Remove an IMediator from the View.
virtual bool HasMediator (string mediatorName)
 Check if a Mediator is registered or not.

Protected Member Functions

 View ()
virtual void InitializeView ()
 Initialize the Singleton View instance.

Protected Attributes

IDictionary< string, IMediatorm_mediatorMap
IDictionary< string, IList
< IObserver > > 
m_observerMap
 Mapping of Notification names to Observer lists.
readonly object m_syncRoot = new object()
 Used for locking.

Static Protected Attributes

static volatile IView m_instance
 Singleton instance.
static readonly object m_staticSyncRoot = new object()
 Used for locking the instance calls.

Properties

static IView Instance [get]
 View Singleton Factory method. This method is thread safe.


Detailed Description

A Singleton IView implementation.

In PureMVC, the View class assumes these responsibilities:

PureMVC.Patterns.Mediator PureMVC.Patterns.Observer PureMVC.Patterns.Notification

Constructor & Destructor Documentation

PureMVC.Core.View.View (  )  [protected]

Constructs and initializes a new view

This IView implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton Factory method View.Instance


Member Function Documentation

virtual bool PureMVC.Core.View.HasMediator ( string  mediatorName  )  [virtual]

Check if a Mediator is registered or not.

Parameters:
mediatorName 
Returns:
whether a Mediator is registered with the given
mediatorName
.
This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual void PureMVC.Core.View.InitializeView (  )  [protected, virtual]

Initialize the Singleton View instance.

Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor

virtual void PureMVC.Core.View.NotifyObservers ( INotification  notification  )  [virtual]

Notify the IObservers for a particular INotification.

Parameters:
notification The INotification to notify IObservers of

All previously attached IObservers for this INotification's list are notified and are passed a reference to the INotification in the order in which they were registered

This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual void PureMVC.Core.View.RegisterMediator ( IMediator  mediator  )  [virtual]

Register an IMediator instance with the View.

Parameters:
mediator A reference to the IMediator instance

Registers the IMediator so that it can be retrieved by name, and further interrogates the IMediator for its INotification interests

If the IMediator returns any INotification names to be notified about, an Observer is created encapsulating the IMediator instance's handleNotification method and registering it as an Observer for all INotifications the IMediator is interested in

This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual void PureMVC.Core.View.RegisterObserver ( string  notificationName,
IObserver  observer 
) [virtual]

Register an IObserver to be notified of INotifications with a given name.

Parameters:
notificationName The name of the INotifications to notify this IObserver of
observer The IObserver to register
This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual IMediator PureMVC.Core.View.RemoveMediator ( string  mediatorName  )  [virtual]

Remove an IMediator from the View.

Parameters:
mediatorName The name of the IMediator instance to be removed
This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual void PureMVC.Core.View.RemoveObserver ( string  notificationName,
object  notifyContext 
) [virtual]

Remove the observer for a given notifyContext from an observer list for a given Notification name.

Parameters:
notificationName which observer list to remove from
notifyContext remove the observer with this object as its notifyContext
This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.

virtual IMediator PureMVC.Core.View.RetrieveMediator ( string  mediatorName  )  [virtual]

Retrieve an IMediator from the View.

Parameters:
mediatorName The name of the IMediator instance to retrieve
Returns:
The IMediator instance previously registered with the given mediatorName
This method is thread safe and needs to be thread safe in all implementations.

Implements PureMVC.Interfaces.IView.


Member Data Documentation

volatile IView PureMVC.Core.View.m_instance [static, protected]

Singleton instance.

IDictionary<string, IMediator> PureMVC.Core.View.m_mediatorMap [protected]

Mapping of Mediator names to Mediator instances

IDictionary<string, IList<IObserver> > PureMVC.Core.View.m_observerMap [protected]

Mapping of Notification names to Observer lists.

readonly object PureMVC.Core.View.m_staticSyncRoot = new object() [static, protected]

Used for locking the instance calls.

readonly object PureMVC.Core.View.m_syncRoot = new object() [protected]

Used for locking.


Property Documentation

IView PureMVC.Core.View.Instance [static, get]

View Singleton Factory method. This method is thread safe.


The documentation for this class was generated from the following file:

Generated on Thu Jan 1 16:26:45 2009 for PureMVC by  doxygen 1.5.8