Package puremvc :: Package patterns :: Module mediator :: Class Mediator
[hide private]
[frames] | no frames]

Class Mediator

source code

          object --+        
                   |        
interfaces.INotifier --+    
                       |    
       observer.Notifier --+
                           |
          object --+       |
                   |       |
interfaces.INotifier --+   |
                       |   |
    interfaces.IMediator --+
                           |
                          Mediator

A base IMediator implementation.


See Also: View

Instance Methods [hide private]
 
__init__(self, mediatorName=None, viewComponent=None)
Mediator Constructor
source code
 
getMediatorName(self)
Get the name of the Mediator.
source code
 
setViewComponent(self, viewComponent)
Set the IMediator's view component.
source code
 
getViewComponent(self)
Get the Mediator's view component.
source code
 
listNotificationInterests(self)
List the INotification names this Mediator is interested in being notified of.
source code
 
handleNotification(self, notification)
Handle INotifications.
source code
 
onRegister(self)
Called by the View when the Mediator is registered
source code
 
onRemove(self)
Called by the View when the Mediator is removed
source code

Inherited from observer.Notifier: initializeNotifier, sendNotification

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  NAME = 'Mediator'

Inherited from observer.Notifier: MULTITON_MSG

Properties [hide private]

Inherited from observer.Notifier: facade

Inherited from object: __class__

Method Details [hide private]

__init__(self, mediatorName=None, viewComponent=None)
(Constructor)

source code 

Mediator Constructor

Typically, a Mediator will be written to serve one specific control or group controls and so, will not have a need to be dynamically named.

Overrides: object.__init__

getMediatorName(self)

source code 

Get the name of the Mediator.

Returns:
the Mediator name
Overrides: interfaces.IMediator.getMediatorName

setViewComponent(self, viewComponent)

source code 

Set the IMediator's view component.

Parameters:
  • viewComponent - the view component
Overrides: interfaces.IMediator.setViewComponent

getViewComponent(self)

source code 

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;
   }
Returns:
the view component
Overrides: interfaces.IMediator.getViewComponent

listNotificationInterests(self)

source code 

List the INotification names this Mediator is interested in being notified of.

Returns:
List the list of INotification names
Overrides: interfaces.IMediator.listNotificationInterests

handleNotification(self, notification)

source code 

Handle INotifications.

Typically this will be handled in a if/else statement, with one 'comparison' entry per INotification the Mediator is interested in.

Parameters:
  • notification - the INotification to be handled
Overrides: interfaces.IMediator.handleNotification

onRegister(self)

source code 

Called by the View when the Mediator is registered

Overrides: interfaces.IMediator.onRegister

onRemove(self)

source code 

Called by the View when the Mediator is removed

Overrides: interfaces.IMediator.onRemove