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
IMediatorinstances. - Provide methods for registering, retrieving, and removing
IMediators. - Managing the observer lists for each
INotificationin the application. - Providing a method for attaching
IObserversto anINotification's observer list. - Providing a method for broadcasting an
INotification. - Notifying the
IObserversof a givenINotificationwhen it broadcast.
- See Also:
IMediator,IObserver,INotification
-
Method Summary
Modifier and Type Method Description booleanhasMediator(java.lang.String mediatorName)Check if a Mediator is registered or notvoidnotifyObservers(INotification notification)Notify theIObserversfor a particularINotification.voidregisterMediator(IMediator mediator)Register anIMediatorinstance with theView.voidregisterObserver(java.lang.String notificationName, IObserver observer)Register anIObserverto be notified ofINotificationswith a given name.IMediatorremoveMediator(java.lang.String mediatorName)Remove anIMediatorfrom theView.voidremoveObserver(java.lang.String notificationName, java.lang.Object notifyContext)Remove a group of observers from the observer list for a given Notification name.IMediatorretrieveMediator(java.lang.String mediatorName)Retrieve anIMediatorfrom theView.
-
Method Details
-
registerObserver
Register an
IObserverto be notified ofINotificationswith a given name.- Parameters:
notificationName- the name of theINotificationsto notify thisIObserverofobserver- theIObserverto 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
IObserversfor a particularINotification.All previously attached
IObserversfor thisINotification's list are notified and are passed a reference to theINotificationin the order in which they were registered.- Parameters:
notification- theINotificationto notifyIObserversof.
-
registerMediator
Register an
IMediatorinstance with theView.Registers the
IMediatorso that it can be retrieved by name, and further interrogates theIMediatorfor itsINotificationinterests.If the
IMediatorreturns anyINotificationnames to be notified about, anObserveris created encapsulating theIMediatorinstance'shandleNotificationmethod and registering it as anObserverfor allINotificationstheIMediatoris interested in.- Parameters:
mediator- a reference to theIMediatorinstance
-
retrieveMediator
Retrieve an
IMediatorfrom theView.- Parameters:
mediatorName- the name of theIMediatorinstance to retrieve.- Returns:
- the
IMediatorinstance previously registered with the givenmediatorName.
-
removeMediator
Remove an
IMediatorfrom theView.- Parameters:
mediatorName- name of theIMediatorinstance to be removed.- Returns:
- the
IMediatorthat 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.
-