Packagemvcexpress.core
Classpublic class MediatorMap
InheritanceMediatorMap Inheritance Object
Implements IMediatorMap

Handles application mediators.



Protected Properties
 PropertyDefined By
  mediatorMapOrderRegistry : Dictionary
MediatorMap
  mediatorMappingRegistry : Dictionary
MediatorMap
  mediatorRegistry : Dictionary
MediatorMap
  messenger : Messenger
MediatorMap
  moduleName : String
MediatorMap
  proxyMap : ProxyMap
MediatorMap
  viewProxyMap : ProxyMapForMediator
MediatorMap
Public Methods
 MethodDefined By
  
MediatorMap($moduleName:String, $messenger:Messenger, $proxyMap:ProxyMap)
CONSTRUCTOR
MediatorMap
  
isMapped(viewClass:Class, mediatorClass:Class = null):Boolean
Checks if any or specific mediator class is mapped to view class.
MediatorMap
  
isMediated(viewObject:Object, mediatorClass:Class = null):Boolean
Checks if view object is mediated by any or specific mediator.
MediatorMap
  
listMappings(verbose:Boolean = true):String
Returns String of all view classes that are mapped to mediator classes.
MediatorMap
  
map(viewClass:Class, mediatorClass:Class, injectClass:Class = null, ... restClassPairs):void
Maps one or more mediator classes to view class.
MediatorMap
  
mediate(viewObject:Object):void
Mediates provided viewObject with all mapped mediator.
MediatorMap
  
mediateWith(viewObject:Object, mediatorClass:Class, injectClass:Class = null):void
Mediates viewObject with specified mediator class.
MediatorMap
  
unmap(viewClass:Class, mediatorClass:Class = null):void
Unmaps all or specific mediator class from mediating given view class.
MediatorMap
  
unmediate(viewObject:Object, mediatorClass:Class = null):void
Stops view object mediation by all or specific mediator.
MediatorMap
Property Detail
mediatorMapOrderRegistryproperty
protected var mediatorMapOrderRegistry:Dictionary

mediatorMappingRegistryproperty 
protected var mediatorMappingRegistry:Dictionary

mediatorRegistryproperty 
protected var mediatorRegistry:Dictionary

messengerproperty 
protected var messenger:Messenger

moduleNameproperty 
protected var moduleName:String

proxyMapproperty 
protected var proxyMap:ProxyMap

viewProxyMapproperty 
protected var viewProxyMap:ProxyMapForMediator

Constructor Detail
MediatorMap()Constructor
public function MediatorMap($moduleName:String, $messenger:Messenger, $proxyMap:ProxyMap)

CONSTRUCTOR

Parameters
$moduleName:String
 
$messenger:Messenger
 
$proxyMap:ProxyMap
Method Detail
isMapped()method
public function isMapped(viewClass:Class, mediatorClass:Class = null):Boolean

Checks if any or specific mediator class is mapped to view class.

Parameters

viewClass:Class — view class that has to be mediated by mediator class then mediate(viewObject) is called.
 
mediatorClass:Class (default = null) — Optional Mediator class, if provided will check if viewClass is mapped to this specific mediator class.

Returns
Boolean — true if view class is already mapped to mediator class.
isMediated()method 
public function isMediated(viewObject:Object, mediatorClass:Class = null):Boolean

Checks if view object is mediated by any or specific mediator.

Parameters

viewObject:Object — View object to check if it is mediated.
 
mediatorClass:Class (default = null) — optional parameter to check if view is mediated by specific mediator.

Returns
Boolean
listMappings()method 
public function listMappings(verbose:Boolean = true):String

Returns String of all view classes that are mapped to mediator classes. (for debugging)

Parameters

verbose:Boolean (default = true) — if set to true, will return readable string, false will return pairs of view class definition and mediator class list(separated by ',') definition separated by '>', all pairs are separated by ';'.

Returns
String — Text with all mapped mediators.
map()method 
public function map(viewClass:Class, mediatorClass:Class, injectClass:Class = null, ... restClassPairs):void

Maps one or more mediator classes to view class.

Parameters

viewClass:Class — view class that has to be mediated by mediator class then mediate() is called on the view object.
 
mediatorClass:Class — mediator class that will be instantiated then viewClass object is passed to mediate() function.
 
injectClass:Class (default = null) — inject view into mediator as this class.
 
... restClassPairs — rest or mediatorClass and injectClass pairs if you want your view mediated by more then one mediator.

mediate()method 
public function mediate(viewObject:Object):void

Mediates provided viewObject with all mapped mediator. Automatically instantiates mediator class(es), handles all injections(including view object injection), and calls onRegister function.

Throws error if no mediator classes are mapped to viewObject class.

Parameters

viewObject:Object — view object to mediate.

mediateWith()method 
public function mediateWith(viewObject:Object, mediatorClass:Class, injectClass:Class = null):void

Mediates viewObject with specified mediator class.

This function will mediate your view without mapping view class to mediator class. It is usually better practice to use 2 step mediation(map() then mediate()) instead of this function. But sometimes it is not possible/useful.

Parameters

viewObject:Object — view object to mediate.
 
mediatorClass:Class — mediator class that will be instantiated and used to mediate view object
 
injectClass:Class (default = null) — inject mediator as this class.

unmap()method 
public function unmap(viewClass:Class, mediatorClass:Class = null):void

Unmaps all or specific mediator class from mediating given view class. If view is not mapped - it will fail silently.

Parameters

viewClass:Class — view class to remove mapped mediator class from.
 
mediatorClass:Class (default = null) — optional parameter if you want to unmap specific mediator. If this is not set - all mediators mediating view class will be unmapped.

unmediate()method 
public function unmediate(viewObject:Object, mediatorClass:Class = null):void

Stops view object mediation by all or specific mediator.

If any mediator is mediating this viewObject - onRemove mediator function is called, all message handlers and all event listeners(adedd with addListener) are removed automatically, and mediator is disposed.

Parameters

viewObject:Object — view object witch mediator will be destroyed.
 
mediatorClass:Class (default = null) — optional parameter to unmediate specific mediator class. If this not set - all mediators will be removed.