Mediating Multiple Views with a Common Base Class with a Single Mediator
April 02, 2012
There are many situations where multiple views will need to share a common Mediator class. For example, games may have several on screen elements(views) that have the same behavior but will operate independently.
RobotLegs provides a simple but not very well documented mechanism for achieving
Whereas the following is the syntax for the standard mediator mapping to a view:
mediatorMap.mapView(View Class, Mediator Class )
Mapping multiple views with the same base class to a single mediator you only need to add an additional parameter to the mapping call:
mediatorMap.mapView( View Class, Medaitor Class, View Base Class)
The single mediator class will now mediate each of your various views independently.