NAME

org::puremvc::perl5::core::View

Singleton responsible for implementing the MVC View pattern.


DESCRIPTION

In PureMVC, the View class assumes these responsibilities:


INTERFACE

Methods

getInstance

sub getInstance();

Returns the singleton instance of the View.

Returns

org::puremvc::perl5::core::View - The singleton instance of the View.

initializeView

sub initializeView();

Initialize the singleton instance of the View. This method is automatically called during singleton instantiation.

This is where you will achieve your View subclass specific initializations if your application actually overrides pureMVC View class.

registerObserver

sub registerObserver( $notification_name, $observer );

Register an observer to be notified of notifications with a given name.

Parameters

notifyObservers

sub notifyObservers( $notification );

Notify the observer for a particular notification.

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

Parameters

removeObserver

sub removeObserver( $notification_name, $observer );

Remove the observer from the observers list for a given notification name.

Parameters

registerMediator

sub registerMediator( $mediator );

Register a Mediator instance with the View. During registration mediator's getMediatorName method is called by View singleton to map $mediator instance with its name.

Any registered mediator is afterwards retrieved, removed or checked by its name.

Registers the mediator so that it can be retrieved by name, and further interrogates the mediator for its notification interests.

If the mediator returns any notification name to be notified about, an observer is created encapsulating the mediator instance's handleNotification method and registering it as an observer for all notifications the mediator is interested in.

Parameters

retrieveMediator

sub retrieveMediator( $mediator_name );

Retrieve from the View a mediator registered with name $mediator_name.

Parameters

Returns

org::puremvc::perl5::patterns::mediator::Mediator - The Mediator instance retrieved from the View.

removeMediator

sub removeMediator( $mediator_name );

Remove from the View a mediator registered with name $mediator_name.

Parameters

Returns

org::puremvc::perl5::patterns::mediator::Mediator - The Mediator instance removed from the View.

hasMediator

sub hasMediator( $mediator_name );

Check whether a mediator is registered with name $mediator_name or not.

Parameters

Returns

scalar - 1 if a Mediator instance is registered with the View with name $mediator_name, "" otherwise.

Properties

_mediators

Array reference on registered mediators with the View. You should not have to access it and must not update it in normal usage.

_observers

Array reference on registered observers with the View. You should not have to access it and must not update it in normal usage.


SEE ALSO

org::puremvc::perl5::core::Model

org::puremvc::perl5::core::Controller

org::puremvc::perl5::patterns::facade::Facade

org::puremvc::perl5::patterns::observer::Notification

org::puremvc::perl5::patterns::proxy::Proxy

org::puremvc::perl5::patterns::mediator::Mediator

org::puremvc::perl5::patterns::command::SimpleCommand

org::puremvc::perl5::patterns::command::MacroCommand

org::puremvc::perl5::patterns::observer::Notifier

org::puremvc::perl5::patterns::observer::Observer