PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: ghess on June 04, 2008, 01:14:41



Title: Proxy data not ready when UIComponents are created
Post by: ghess on June 04, 2008, 01:14:41
Hi All,

New to ActionScript, pureMVC and multicore.

My application has a ServerConfigProxy responsible for caching and providing access to a ServerConfigVO. In my Proxies initializeNotifier() I initiate an HTTPService call via a remote stub class, once the result is ready I seed the proxies cache with the constructed ServerConfigVO.

Problem is the UI Mediator requests the ServerConfigVO before the Proxy has received it. How should I be handling this? Should I check if the VO is null, use a Proxy loading flag and display a progress meter, once the loading flag is false get the VO?

Any help much appreciated.

Thanks,

Greg


Title: Re: Proxy data not ready when UIComponents are created
Post by: puremvc on June 04, 2008, 02:13:42
Instead of requesting the VO, why not have the Mediator just be interested in a notification sent by the Proxy when the data is ready. The Proxy could even send the reference in the notification.

-=Cliff>


Title: Re: Proxy data not ready when UIComponents are created
Post by: ghess on June 04, 2008, 02:49:26
Thanks Cliff!

Interesting, I can do that :-). I am just now testing with a real ServerStub and have been using a LocalTestStub while I have been waiting for the server team to finish the web service endpoints. My local test stub was super fast and now am realizing I cant assume the data is ready on initializeNotifier().

The first service call I am integrating is just fetching the ServerConfig and it has a short response time. If I employ the strategy you reference it would be unlikely the EU would ever click on the 'About' link quick enough to see the blank fields.

Do you use this strategy most often? I does feel right due to the asynch nature of a HTTPService call. However, in many, and even this case, I feel my UIComponent should display some sort of progress indicator as I don't want to display an empty form (or worse throw an exception). My next call is fetching a server dir listing to populate a tree that wont be so fast... How do you handle UI dependancies on remote data? Would the proxy send a notification to say "I am loading this VO" then "I have the VO" and the Mediator would be interested in both and display some loading indicator using an alternate state of the component?

Much appreciated,

Greg



Title: Re: Proxy data not ready when UIComponents are created
Post by: puremvc on June 04, 2008, 03:23:52
Sure, you can always have a ViewStack in your main application be showing a splash screen and be updated with progress and data by sending notifications to its mediator. A final 'open the curtain' type notification can tell be used to flip the view stack and show the user the app.

-=Cliff>


Title: Re: Proxy data not ready when UIComponents are created
Post by: ghess on June 04, 2008, 05:20:36
Thanks Cliff,

I like it, once my base object model is loaded I will 'open the curtain'.

Cheers,

Greg