org-puremvc-php-multicore
[ class tree: org-puremvc-php-multicore ] [ index: org-puremvc-php-multicore ] [ all elements ]

Class: View

Source Location: /org/puremvc/php/multicore/core/View.php

Class Overview


A Multiton IView implementation.


Author(s):

Implements interfaces:

Variables

Constants

Methods



Class Details

[line 49]
A Multiton IView implementation.

In PureMVC, the View class assumes these responsibilities:

  • Maintain a cache of IMediator instances.
  • Provide methods for registering, retrieving, and removing IMediators.
  • Notifiying IMediators when they are registered or removed.
  • Managing the observer lists for each INotification<b> in the application. - Providing a method for attaching <b>IObservers to an INotification's observer list.
  • Providing a method for broadcasting an INotification.
  • Notifying the IObservers of a given INotification when it broadcast.




Tags:

see:  Notification
see:  Observer
see:  Mediator


[ Top ]


Class Variables

static $instanceMap = array()

[line 79]

The Multiton instances stack



Tags:

access:  protected

Type:   array


[ Top ]

$mediatorMap = array()

[line 61]

Mapping of mediatorNames to IMediator references



Tags:

access:  protected

Type:   array


[ Top ]

$multitonKey =  NULL

[line 73]

The Multiton Key for this Core



Tags:

access:  protected

Type:   string


[ Top ]

$observerMap = array()

[line 67]

Mapping of Notification names to Observer lists



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


static method getInstance [line 133]

static IView getInstance( string $key)

View Factory method.

This IView implementation is a Multiton so this method MUST be used to get acces, or create, IViews.




Tags:

return:  The instance for this Multiton key.
access:  public


Parameters:

string   $key   Unique key for this instance.

[ Top ]

static method removeView [line 356]

static void removeView( string $key)

Remove View

Remove an IView instance by key.




Tags:

access:  public


Parameters:

string   $key   The multitonKey of IView instance to remove

[ Top ]

constructor __construct [line 97]

IView __construct( string $key)

Constructor.

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

  1.  View::getInstance'multitonKey' );




Tags:

return:  Instance for this key
throws:  Exception if instance for this key has already been constructed.
access:  protected


Parameters:

string   $key   Unique key for this instance.

[ Top ]

method hasMediator [line 343]

bool hasMediator( string $mediatorName)

Has Mediator

Check if a IMediator is registered or not.




Tags:

return:  Boolean: Whether a IMediator is registered with the given mediatorName.
access:  public



Implementation of:
IView::hasMediator()
Has Mediator

Parameters:

string   $mediatorName   The name of the IMediator to check for.

[ Top ]

method initializeView [line 120]

void initializeView( )

Initialize the Singleton View instance.

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




Tags:

access:  protected


[ Top ]

method notifyObservers [line 177]

void notifyObservers( INotification $notification)

Notify Observers

Notify the IObservers for a particular INotification.

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.




Tags:

access:  public



Implementation of:
IView::notifyObservers()
Notify Observers

Parameters:

INotification   $notification   The INotification to notify IObservers of.

[ Top ]

method registerMediator [line 255]

void registerMediator( IMediator $mediator)

Register Mediator

Register an IMediator instance with the View.

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.




Tags:

access:  public



Implementation of:
IView::registerMediator()
Register Mediator

Parameters:

IMediator   $mediator   Reference to the IMediator instance.

[ Top ]

method registerObserver [line 152]

void registerObserver( string $notificationName, IObserver $observer)

Register Observer

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




Tags:

access:  public



Implementation of:
IView::registerObserver()
Register Observer

Parameters:

string   $notificationName   The name of the INotifications to notify this IObserver of.
IObserver   $observer   The IObserver to register.

[ Top ]

method removeMediator [line 309]

IMediator removeMediator( string $mediatorName)

Remove Mediator

Remove a previously registered IMediator instance from the View.




Tags:

return:  The IMediator instance previously registered with the given mediatorName.
access:  public



Implementation of:
IView::removeMediator()
Remove Mediator

Parameters:

string   $mediatorName   Name of the IMediator instance to be removed.

[ Top ]

method removeObserver [line 209]

void removeObserver( string $notificationName, mixed $notifyContext)

Remove Observer

Remove a group of observers from the observer list for a given Notification name.




Tags:

access:  public



Implementation of:
IView::removeObserver()
Remove Observer

Parameters:

string   $notificationName   Which observer list to remove from.
mixed   $notifyContext   Remove the observers with this object as their notifyContext

[ Top ]

method retrieveMediator [line 296]

IMediator retrieveMediator( string $mediatorName)

Retreive Mediator

Retrieve a previously registered IMediator instance from the View.




Tags:

return:  The IMediator previously registered with the given mediatorName.
access:  public



Implementation of:
IView::retrieveMediator()
Retreive Mediator

Parameters:

string   $mediatorName   Name of the IMediator instance to retrieve.

[ Top ]


Class Constants

MULTITON_MSG =  "View instance for this Multiton key already constructed!"

[line 55]

Define the message content for the duplicate instance exception


[ Top ]



Documentation generated on Mon, 03 Aug 2009 04:58:04 +0000 by phpDocumentor 1.4.2