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: Who takes ownership of the views and the notifications?  (Read 7756 times)
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« on: September 25, 2009, 12:57:30 »

I have a navigation view which then creates sub views (or buttons):

component
/navView
/buttonView

Should the events bubble from the buttonView -> navView-> navViewMediator or is it best to let each buttonView talk directly to the Mediator?

The buttonView pretty much creates a complex view that is several lines of code and that is why I decided to create a viewClass of its own, but nothing else is going on in there other than the complexity and dispatching events (rollover/rollout/click).
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 27, 2009, 06:28:00 »

The mediator should not know much about the internals of its view component. Certainly not enough to place listeners on its buttons. This breaks encapsulation. As you described, bubbling events up through the parent into the Mediator is probably the best way to go.

-=Cliff>
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #2 on: September 28, 2009, 03:44:35 »

Thanks and it does makes sense, but in the case that we need to let the Mediator know what specific button was accessed (via ID or Name) how do we pass that information to the Mediator without tying each view to the PureMVC paradigm? After all the application needs to know who initiated the request.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: September 30, 2009, 09:44:57 »

Why does some other part of the system need to know about specific buttons on this Mediator's component? That breaks OOP encapsulation, not just PureMVC. What is it you're trying to achieve with this particular interaction with the button components?

-=Cliff>
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #4 on: September 30, 2009, 08:50:08 »

All I was trying to retrieve was the ID of the button in action by the mediator than then can be used by other elements on the application, by reading another one of your replies I was able to understand perfectly what I was not understanding.

http://forums.puremvc.org/index.php?topic=1473.0

so it was my fault all along.
Logged
Pages: [1]
Print