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: Composite data structures  (Read 8178 times)
dyoo
Newbie
*
Posts: 3


View Profile Email
« on: November 23, 2007, 12:09:59 »

Hi,

Thanks for responding to my previous questions. I'm getting the hang of this.

I'm wondering what the best approach is for the following.

I have multiple view components, each loading remote data via its own proxy. In one of my view components (call it ViewA), I'd like to display a composite data structure composed of parts of data already available in other views.

i.e. ViewB renders ModelB via ProxyB. I want ViewA to render ModelB and ModelC.

Can I create a mediator for ViewA that simply calls facade.retrieveProxy to access the already loaded proxies and underlying data-structures?

Or is it more kosher to create yet another (virtual) model/proxy for the composite data structure?

I guess what I'm asking is are we free to mix and match and reuse proxies/views/models/mediators?

If so, could I create a "meta-mediator" or application-level mediator into which I could load ALL my proxies so that all my data is accessible in one place and register all my views to that one mediator?

Thanks,

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



View Profile WWW Email
« Reply #1 on: November 23, 2007, 06:25:40 »

Hi Danny,

You are perfectly free to access the data from any Proxy inside any Mediator by simply retrieving it and using it as you describe.

Keep in mind that the Mediator doesn't become a final repository for your data, even though they often cache a reference to the Proxies they need to talk to frequently. So the super-mediator idea doesn't really make sense.

However, its perfectly reasonable to consider a Proxy that takes data from other Proxies when called and assembles it into a composite structure if need be. This might be useful for, say, populating a tree control in the view where the data structure needs to be composed of data retrieved from disparate services.

The only problem then is the proxy that made the composite may need to communicate changes to the structure back to the source Proxies for saving back to their services.

-=Cliff>
Logged
Pages: [1]
Print