PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: inconduit on February 20, 2009, 11:32:01



Title: ViewComponent registry
Post by: inconduit 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


Title: Re: ViewComponent registry
Post by: puremvc 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>