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: Mediator with multiple views, toolbar stack ?  (Read 9276 times)
coulix
Full Member
***
Posts: 23


View Profile Email
« on: November 25, 2008, 04:40:16 »

Hi guys,

I am facing a design problem i havent encountered before.

I have a BoardView with a boardMediator
a boardToolbarView with boardToolbarMediator, the toolbar it a tile of several Shapes.

Each Shape should be associated to a toolbar for its type (rectangle, circle, etc).

Instead of creating a RectangeToolbarMediator, CircleToolbarMediator etc ...
for each type can i create just one ShapeToolbarMediator registering several views CircleToolbarView, RectangeToolbarView etc.


Then when my boardToolMediator send a toolchange notification, ShapeToolbarMediator will listen for it and display the appropriate shapeToolbarView.

How would you do such a thing ?

-------------------
|                      H |     H: boardToolBar
|                      H |     x: shapeToolBar
|             xxx     H |
-------------------

Thanks


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



View Profile WWW Email
« Reply #1 on: November 25, 2008, 06:50:44 »

Depends on haw much granularity you actually need. Will each shape toolbar be dispatching a bunch of events that could bubble and have the board toolbar mediator handle? Perhaps it hears the shape type and which toolbar function and triggers a different command? 

-=Cliff>
Logged
coulix
Full Member
***
Posts: 23


View Profile Email
« Reply #2 on: November 25, 2008, 07:03:02 »

Each Shape property toolbar will be dispatching events to be handle by the Property Toolbar mediator (fill color, line color) which in turn sends a notification to the BoardMediator.
Board Mediator being responsible for creating the shapes on the board.

The BoardToolBar mediator only handles the tool choices: select, pen, rectangle, circle ...
The PropertyToolbar mediator will take care of the property details of the current tool (fill ...)

I am trying to use a view stack as the propertyToolbarView for now.

I dont think i need a mediator for each property toolbar.
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #3 on: November 25, 2008, 07:07:08 »

If you are using Flex, why not make one toolbar and use States to to manage the different types of toolbars? This works particularly well if you have common buttons that span all the different toolbars. Use your selected shape type (circle, square, etc) as the state name, dispatching it to the toolbar component to change states.
« Last Edit: November 25, 2008, 07:08:50 by jasonmac » Logged
coulix
Full Member
***
Posts: 23


View Profile Email
« Reply #4 on: November 25, 2008, 07:19:25 »

I did not know about states looking at it right now,
Thanks  :D
« Last Edit: November 25, 2008, 07:22:25 by coulix » Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #5 on: November 25, 2008, 07:32:28 »

I did not know about states looking at it right now,
Thanks  :D

Glad I could help :)
Logged
Pages: [1]
Print