You would have your presenter listen for both local data and RPC data on the event bus.
You would have the RPC system and the local data system both listen for data requests on the event bus.
When you display the producer and it needs data, the producer would send a data request on the event bus.
The producer should then receive the local data quickly on the bus, and the RPC data later when the call completes. Responses from both could be read by the same code in the producer.
This also lets other systems (logging, caching, other presenters) listen on the event bus and also use the data when it comes in.
On Tuesday, February 5, 2013 4:53:22 PM UTC+2, andy_p1 wrote:
I read it and heard it from GWT gurus that because of the nature of AJAX apps, we should embrace the asynchronous nature of the calls. I understand the concept but I am not 100% sure about how to design the following requirement:--
My View displays some data that is produced using the combination of some data from an RPC call and some data from local (it's a mobile app, so it gets some data from local file or db). The Presenter is supposed to get all the required data and refresh the view.
Now, I want to wrap all these individual calls (one call to RPC and one call to fetch local data), into a single call in a Facade. So ideally, in my Presenter, i want to call :facade.getAllData( new MyCallBackHander(){
void onFailure(){ }
void onSuccess(){
update the model and call refresh on the view
}
} );
I am not sure if this is the right approach. I would like to use this pattern for all the calls made by various Presenters and I am not sure how to make it generic and how to code the getAllData method in the facade.
Please help.
thank you!
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment