org.puremvc.java.multicore.patterns.mediator
Class Mediator

java.lang.Object
  extended by org.puremvc.java.multicore.patterns.observer.Notifier
      extended by org.puremvc.java.multicore.patterns.mediator.Mediator
All Implemented Interfaces:
IMediator, INotifier

public class Mediator
extends Notifier
implements IMediator, INotifier

A base IMediator implementation.

See Also:
View

Field Summary
protected  String mediatorName
          The name of the Mediator.
static String NAME
          The default name of the Mediator.
protected  Object viewComponent
          The view component
 
Fields inherited from class org.puremvc.java.multicore.patterns.observer.Notifier
multitonKey
 
Constructor Summary
Mediator()
          Default constructor.
Mediator(String mediatorName, Object viewComponent)
          Constructor.
 
Method Summary
 String getMediatorName()
          Get the name of the Mediator.
 Object getViewComponent()
          Get the Mediator's view component.
 void handleNotification(INotification notification)
          Handle INotifications.
 void init(String mediatorName, Object viewComponent)
           
 String[] listNotificationInterests()
          List the INotification names this Mediator is interested in being notified of.
 void onRegister()
          Called by the View when the Mediator is registered.
 void onRemove()
          Called by the View when the Mediator is removed.
 void setViewComponent(Object viewComponent)
          Set the IMediator's view component.
 
Methods inherited from class org.puremvc.java.multicore.patterns.observer.Notifier
getFacade, initializeNotifier, sendNotification, sendNotification, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.puremvc.java.multicore.interfaces.INotifier
initializeNotifier, sendNotification, sendNotification, sendNotification
 

Field Detail

NAME

public static final String NAME
The default name of the Mediator.

See Also:
Constant Field Values

mediatorName

protected String mediatorName
The name of the Mediator.


viewComponent

protected Object viewComponent
The view component

Constructor Detail

Mediator

public Mediator()
Default constructor. JavaFX class only extends Java class with default constructor.


Mediator

public Mediator(String mediatorName,
                Object viewComponent)
Constructor.

Parameters:
mediatorName -
viewComponent -
Method Detail

init

public void init(String mediatorName,
                 Object viewComponent)

getMediatorName

public final String getMediatorName()
Get the name of the Mediator.

Specified by:
getMediatorName in interface IMediator
Returns:
the name

setViewComponent

public void setViewComponent(Object viewComponent)
Set the IMediator's view component.

Specified by:
setViewComponent in interface IMediator
Parameters:
Object - the view component

getViewComponent

public 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:

private function get comboBox : mx.controls.ComboBox { return viewComponent as mx.controls.ComboBox; }

Specified by:
getViewComponent in interface IMediator
Returns:
the view component

handleNotification

public void handleNotification(INotification notification)
Handle INotifications.

Typically this will be handled in a switch statement, with one 'case' entry per INotification the Mediator is interested in.

Specified by:
handleNotification in interface IMediator
Parameters:
notification -

listNotificationInterests

public String[] listNotificationInterests()
List the INotification names this Mediator is interested in being notified of.

Specified by:
listNotificationInterests in interface IMediator
Returns:
String[] the list of INotification names

onRegister

public void onRegister()
Called by the View when the Mediator is registered.

Specified by:
onRegister in interface IMediator

onRemove

public void onRemove()
Called by the View when the Mediator is removed.

Specified by:
onRemove in interface IMediator


Copyright © 2010. All Rights Reserved.