Class Mediator
public class Mediator extends Notifier implements IMediator
A base IMediator implementation.
- See Also:
View
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringmediatorNamestatic java.lang.StringNAMEThe name of theMediator.protected java.lang.ObjectviewComponent -
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.lang.StringgetMediatorName()Get the name of theMediator.java.lang.ObjectgetViewComponent()Get theMediator's view component.voidhandleNotification(INotification notification)HandleINotifications.java.lang.String[]listNotificationInterests()List theINotificationnames thisMediatoris interested in being notified of.voidonRegister()Called by the View when the Mediator is registeredvoidonRemove()Called by the View when the Mediator is removedvoidsetViewComponent(java.lang.Object viewComponent)Set theIMediator's view component.Methods inherited from class org.puremvc.java.patterns.observer.Notifier
sendNotification, sendNotification, sendNotificationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.puremvc.java.interfaces.INotifier
sendNotification, sendNotification, sendNotification
-
Field Details
-
NAME
public static final java.lang.String NAMEThe name of the
Mediator.Typically, a
Mediatorwill be written to serve one specific control or group controls and so, will not have a need to be dynamically named.- See Also:
- Constant Field Values
-
mediatorName
protected java.lang.String mediatorName -
viewComponent
protected java.lang.Object viewComponent
-
-
Constructor Details
-
Mediator
public Mediator(java.lang.String mediatorName, java.lang.Object viewComponent)Constructor.
- Parameters:
mediatorName- mediator nameviewComponent- view component
-
Mediator
public Mediator(java.lang.String mediatorName)Constructor.
- Parameters:
mediatorName- mediator name
-
Mediator
public Mediator()Constructor.
-
-
Method Details
-
listNotificationInterests
public java.lang.String[] listNotificationInterests()List the
INotificationnames thisMediatoris interested in being notified of.- Specified by:
listNotificationInterestsin interfaceIMediator- Returns:
- Array the list of
INotificationnames
-
handleNotification
Handle
INotifications.Typically this will be handled in a switch statement, with one 'case' entry per
INotificationtheMediatoris interested in.- Specified by:
handleNotificationin interfaceIMediator- Parameters:
notification- theINotificationto be handled
-
onRegister
public void onRegister()Called by the View when the Mediator is registered
- Specified by:
onRegisterin interfaceIMediator
-
onRemove
public void onRemove()Called by the View when the Mediator is removed
-
getMediatorName
public java.lang.String getMediatorName()Get the name of the
Mediator.- Specified by:
getMediatorNamein interfaceIMediator- Returns:
- the Mediator name
-
getViewComponent
public java.lang.Object getViewComponent()Get the
Mediator's view component.Additionally, an implicit getter will usually be defined in the subclass that casts the view object to a type, like this:
public javax.swing.JComboBox getViewComponent() { return viewComponent; }- Specified by:
getViewComponentin interfaceIMediator- Returns:
- the view component
-
setViewComponent
public void setViewComponent(java.lang.Object viewComponent)Set the
IMediator's view component.- Specified by:
setViewComponentin interfaceIMediator- Parameters:
viewComponent- the view component
-