Class View
In: src/org/puremvc/ruby/core/view.rb
Parent: Object

In PureMVC, the View class assumes these responsibilities:

  • Maintain a cache of IMediator instances.
  • Provide methods for registering, retrieving, and removing Mediators.
  • Notifiying Mediators when they are registered or removed.
  • Managing the observer lists for each Notification in the application.
  • Providing a method for attaching Observers to an Notification‘s observer list.
  • Providing a method for broadcasting an Notification.
  • Notifying the Observers of a given Notification when it broadcast.

Methods

Included Modules

Singleton

Attributes

mediator_map  [RW] 
observer_map  [RW] 

Public Class methods

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

Public Instance methods

Check if a Mediator is registered or not.

returns whether a Mediator is registered with the given name.

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

Notify the Observers for a particular Notification.

All previously attached Observers for this Notification‘s list are notified and are passed a reference to the Notification in the order in which they were registered.

Register a Mediator instance with the View.

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 Notifiation name to be notified about, an Observer is created encapsulating the Mediator instance‘s handle_notification method and registering it as an Observer for all Notifications the Mediator is interested in.

Register an Observer to be notified of Notifications with a given name.

Remove a Mediator from the View.

returns the Mediator that was removed.

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

Retrieve a mediator from the View.

returns the previously registered Mediator with the given name.

[Validate]