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: Proxy data not ready when UIComponents are created  (Read 9489 times)
ghess
Courseware Beta
Jr. Member
***
Posts: 12


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
ghess
Courseware Beta
Jr. Member
***
Posts: 12


View Profile Email
« Reply #2 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

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



View Profile WWW Email
« Reply #3 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>
Logged
ghess
Courseware Beta
Jr. Member
***
Posts: 12


View Profile Email
« Reply #4 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
Logged
Pages: [1]
Print