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: Interpretting Menu Selection  (Read 10266 times)
Allen
Newbie
*
Posts: 5


View Profile Email
« on: September 04, 2008, 05:43:02 »

Hello.

I have a List that contains a number of icon-buttons. It is kind of a utility bar and each button does something unrelated to the others - one pops open a panel, another resizes the screen, another saves the current setup etc. Each button renderer has a unique ID in its data property.

My question is where does the interpretation of the buttons' ids take place? Should the List's mediator just send an ICON_SELECTED notification with the id as the body and have a Command use a switch statement on the id to decide what action to take?

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



View Profile WWW Email
« Reply #1 on: September 04, 2008, 03:32:44 »

It would be better to move that switch statement to the event handler in the mediator and have it send notifications that are specific to the function you're wanting to trigger. Why? The I'd of the view component is pretty specific to the view component. And consider you might want, for instance, keystrokes from the stage or selections from a context menu to trigger the same actions. Their mediators would evaluate their events send the same use-case specific notifications (like AppFacade.SAVE, AppFacade.RESIZE, etc.

-=Cliff>
Logged
Allen
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: September 11, 2008, 05:11:31 »

Thanks for your reply.

I guess that does make sense. I was thinking that all decision making should be made in the Commands, but I suppose that would make the Mediators redundant beyond relaying info to and from their components.
Logged
Pages: [1]
Print