topleft topright

Welcome, Guest. Please login or register.
May 20, 2013, 09:04:42 AM
Home Help Search Login Register
News: ATTENTION: Spambots must die! Humans must visit http://contact.futurescale.com to request forum access.

Pages: [1]
Print
Author Topic: Mediator with multiple views, toolbar stack ?  (Read 1948 times)
coulix
Full Member
***
Posts: 23


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

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: 2790



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

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
« Reply #2 on: November 25, 2008, 07:03:02 AM »

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
« Reply #3 on: November 25, 2008, 07:07:08 AM »

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 AM by jasonmac » Logged
coulix
Full Member
***
Posts: 23


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

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


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

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

Glad I could help Smiley
Logged
Pages: [1]
Print
Jump to:  



Login with username, password and session length

Powered by SMF 1.1.11 | SMF © 2006-2007, Simple Machines LLC
Copyright © 2006-2008 Futurescale, Inc.