|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.puremvc.java.core.View
public class View
A Singleton IView
implementation.
In PureMVC, the View
class assumes these responsibilities:
IMediator
instances.IMediators
.INotification
in the
application.IObservers
to an
INotification
's observer list.INotification
.IObservers
of a given
INotification
when it broadcast.
Mediator
,
Observer
,
Notification
Constructor Summary | |
---|---|
protected |
View()
Constructor. |
Method Summary | |
---|---|
static View |
getInstance()
View Singleton Factory method. |
boolean |
hasMediator(java.lang.String mediatorName)
Check if a Mediator is registered or not |
protected void |
initializeView()
Initialize the Singleton View instance. |
void |
notifyObservers(INotification note)
Notify the Observers for a particular
Notification . |
void |
registerMediator(IMediator mediator)
Register an Mediator instance with the View . |
void |
registerObserver(java.lang.String notificationName,
IObserver observer)
Register an Observer to be notified of
INotifications with a given name. |
IMediator |
removeMediator(java.lang.String mediatorName)
Remove an Mediator from the View . |
void |
removeObserver(java.lang.String notificationName,
java.lang.Object notifyContext)
Remove the observer for a given notifyContext from an observer list for a given Notification name. |
IMediator |
retrieveMediator(java.lang.String mediatorName)
Retrieve an Mediator from the View . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected View()
This IView
implementation is a Singleton, so you should
not call the constructor directly, but instead call the static Singleton
Factory method View.getInstance()
java.lang.Error
- Error if Singleton instance has already been constructedMethod Detail |
---|
protected void initializeView()
Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor.
public static View getInstance()
View
public void notifyObservers(INotification note)
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.
notifyObservers
in interface IView
note
- the Notification
to notify
Observers
of.public void removeObserver(java.lang.String notificationName, java.lang.Object notifyContext)
notificationName
- Which observer list to remove fromnotifyContext
- Remove the observer with this object as its notifyContextpublic void registerMediator(IMediator mediator)
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 Notification
names 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.
registerMediator
in interface IView
mediator
- the name to associate with this IMediator
instancepublic void registerObserver(java.lang.String notificationName, IObserver observer)
Observer
to be notified of
INotifications
with a given name.
registerObserver
in interface IView
notificationName
- the name of the Notifications
to notify this
Observer
ofobserver
- the Observer
to registerpublic IMediator removeMediator(java.lang.String mediatorName)
Mediator
from the View
.
removeMediator
in interface IView
mediatorName
- name of the Mediator
instance to be removed.public IMediator retrieveMediator(java.lang.String mediatorName)
Mediator
from the View
.
retrieveMediator
in interface IView
mediatorName
- the name of the Mediator
instance to
retrieve.
Mediator
instance previously registered with
the given mediatorName
.public boolean hasMediator(java.lang.String mediatorName)
hasMediator
in interface IView
mediatorName
-
mediatorName
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |