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: ViewComponent registry  (Read 3999 times)
inconduit
Newbie
*
Posts: 9


View Profile Email
« on: February 20, 2009, 11:32:01 »

i'm new to pureMVC, so tell me if i'm going in the completely wrong direction.

i'm wondering if i need a ViewComponent registry, similar to the registries for mediators and proxies.

i have a custom view component, MediaPlaybackUI. i create them dynamically at runtime, there can be multiple instance.  i do the construction of MediaPlaybackUI in a Command, then send a Notification of this new instance.

elsewhere, a Mediator is listening for this notification.  the Mediator has a reference to a class i've called MediaDisplayUIsLayoutManager, which deals with the visual layout of all the MediaPlaybackUI instances. 

should i store the MediaPlaybackUI instance in a view component registry, and then retrieve it when the notification of the new instance gets to the Mediator?  or should i pass a reference the new MediaPlaybackUI instance inside the body of the Notification?

if a ViewComponent registry is the right way to go, should i add registerView/removeView/retrieveView  to ApplicationFacade, and cast facade to ApplicationFacade each time i need to access the view component registry?

thanks for the help
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 22, 2009, 09:32:00 »

Unless there's some other reason for it, I'd skip the registry idea and just send the newly created view component in the body of the note and cast it in the Mediator when it hands the reference off to the layout component. The registry would just be one more place keeping a reference to the component that you'd need to worry about getting rid of so the component can be garbage collected when if its removed.

-=Cliff>
Logged
Pages: [1]
Print