PureMVC AS3 Framework - [Standard Version] | All Packages | All Classes | Index | Frames No Frames |
Class Mediator

Package | org.puremvc.as3.patterns.mediator
Class | public class Mediator
Inheritance | Mediator Notifier
Implements | IMediator, INotifier

A base `IMediator` implementation.

See also

View

Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined by
--- | --- | ---
|  | facade : IFacade | Notifier
|  | mediatorName : String | Mediator
|  | viewComponent : Object | Mediator

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | Mediator(mediatorName:String = null, viewComponent:Object = null) Constructor. | Mediator
|  | getMediatorName():String Get the name of the `Mediator`. | Mediator
|  | getViewComponent():Object Get the `Mediator`'s view component. | Mediator
|  | handleNotification(notification:INotification):void Handle `INotification`s. | Mediator
|  | listNotificationInterests():Array List the `INotification` names this `Mediator` is interested in being notified of. | Mediator
|  | onRegister():void Called by the View when the Mediator is registered | Mediator
|  | onRemove():void Called by the View when the Mediator is removed | Mediator
|  | sendNotification(notificationName:String, body:Object = null, type:String = null):void Create and send an `INotification`. | Notifier
|  | setViewComponent(viewComponent:Object):void Set the `IMediator`'s view component. | Mediator

Public Constants

| Constant | Defined by
--- | --- | ---
|  | NAME : String = "Mediator" [static] The name of the `Mediator`. | Mediator

Property detail

mediatorName | property

`protected var mediatorName:String`

viewComponent | property |

`protected var viewComponent:Object`
Constructor detail

Mediator | () | constructor

`public function Mediator(mediatorName:String = null, viewComponent:Object = null)`

Constructor.

Parameters

| `mediatorName:String` (default = `null`)``
| `viewComponent:Object` (default = `null`)``

Method detail

getMediatorName | () | method

`public function getMediatorName():String`

Get the name of the `Mediator`.

Returns

| `String` — the Mediator name

getViewComponent | () | method |

`public function getViewComponent():Object`

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

| `Object` — the view component

handleNotification | () | method |

`public function handleNotification(notification:INotification):void`

Handle `INotification`s.

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

Parameters

| `notification:INotification`

listNotificationInterests | () | method |

`public function listNotificationInterests():Array`

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

Returns

| `Array` — Array the list of `INotification` names

onRegister | () | method |

`public function onRegister():void`

Called by the View when the Mediator is registered

onRemove | () | method |

`public function onRemove():void`

Called by the View when the Mediator is removed

setViewComponent | () | method |

`public function setViewComponent(viewComponent:Object):void`

Set the `IMediator`'s view component.

Parameters

| `viewComponent:Object` — the view component

Constant detail

NAME | constant

`public static const NAME:String = "Mediator"`

The name of the `Mediator`.

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.