Interface IView
- All Known Implementing Classes:
View
public interface IView
The interface definition for a PureMVC View.
In PureMVC, IView
implementors assume these responsibilities:
In PureMVC, the View
class assumes these responsibilities:
- Maintain a cache of
IMediator
instances. - Provide methods for registering, retrieving, and removing
IMediators
. - Managing the observer lists for each
INotification
in the application. - Providing a method for attaching
IObservers
to anINotification
's observer list. - Providing a method for broadcasting an
INotification
. - Notifying the
IObservers
of a givenINotification
when it broadcast.
- See Also:
IMediator
,IObserver
,INotification
-
Method Summary
Modifier and Type Method Description boolean
hasMediator(java.lang.String mediatorName)
Check if a Mediator is registered or notvoid
notifyObservers(INotification notification)
Notify theIObservers
for a particularINotification
.void
registerMediator(IMediator mediator)
Register anIMediator
instance with theView
.void
registerObserver(java.lang.String notificationName, IObserver observer)
Register anIObserver
to be notified ofINotifications
with a given name.IMediator
removeMediator(java.lang.String mediatorName)
Remove anIMediator
from theView
.void
removeObserver(java.lang.String notificationName, java.lang.Object notifyContext)
Remove a group of observers from the observer list for a given Notification name.IMediator
retrieveMediator(java.lang.String mediatorName)
Retrieve anIMediator
from theView
.
-
Method Details
-
registerObserver
Register an
IObserver
to be notified ofINotifications
with a given name.- Parameters:
notificationName
- the name of theINotifications
to notify thisIObserver
ofobserver
- theIObserver
to register
-
removeObserver
void removeObserver(java.lang.String notificationName, java.lang.Object notifyContext)Remove a group of observers from the observer list for a given Notification name.
- Parameters:
notificationName
- which observer list to remove fromnotifyContext
- removed the observers with this object as their notifyContext
-
notifyObservers
Notify the
IObservers
for a particularINotification
.All previously attached
IObservers
for thisINotification
's list are notified and are passed a reference to theINotification
in the order in which they were registered.- Parameters:
notification
- theINotification
to notifyIObservers
of.
-
registerMediator
Register an
IMediator
instance with theView
.Registers the
IMediator
so that it can be retrieved by name, and further interrogates theIMediator
for itsINotification
interests.If the
IMediator
returns anyINotification
names to be notified about, anObserver
is created encapsulating theIMediator
instance'shandleNotification
method and registering it as anObserver
for allINotifications
theIMediator
is interested in.- Parameters:
mediator
- a reference to theIMediator
instance
-
retrieveMediator
Retrieve an
IMediator
from theView
.- Parameters:
mediatorName
- the name of theIMediator
instance to retrieve.- Returns:
- the
IMediator
instance previously registered with the givenmediatorName
.
-
removeMediator
Remove an
IMediator
from theView
.- Parameters:
mediatorName
- name of theIMediator
instance to be removed.- Returns:
- the
IMediator
that was removed from theView
-
hasMediator
boolean hasMediator(java.lang.String mediatorName)Check if a Mediator is registered or not
- Parameters:
mediatorName
- mediator name- Returns:
- whether a Mediator is registered with the given
mediatorName
.
-