Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Multiple mediators for a single view?  (Read 3472 times)
TripleToe
Newbie
*
Posts: 9


View Profile Email
« on: February 22, 2009, 02:22:15 »

I'm building a framework where the user creates a configuration file that defines how the Flex application is constructed.  One part of this framework allows the user to define a data visualization along with the components used in the construction.  Now I'm adding the ability to define and add filter logic so that once the visualization is created, it can be filtered dynamically at run-time.  I currently build the visualization from the configuration file and create/register mediators for the view components when the application starts.  For the filtering, I was thinking I could encapsulate the logic and functionality in a separate mediator that would point to a view that is already being mediated.    This would allow me to have one mediator manipulate the view's regular state, events, etc and then have another mediator handle the filtering notifications being applied.  Obviously, I could use one mediator to do both tasks but this means that my existing mediators have to be made even more complex with the addition of filtering behavior methods, etc.

So, does it make any sense to try to use more than one mediator for a single view if the functions being handled by each mediator on that view are clearly defined? 

Thanks
:)
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 22, 2009, 05:18:39 »

The role of the mediator is to be the single point of contact in the system for a given view component. It should listen for notes on behalf of the component as well as listen for events from the component on behalf of the system.

If a mediator becomes too large it is a sign your view component is a bit complex and you probably need more  granularity in terms of mediators for sub components of the view component in question.

-=Cliff>
Logged
Pages: [1]
Print