On Tue, Mar 10, 2009 at 6:01 PM, mikedshaffer <[email protected]>wrote:

> Lothar's original suggestion
>
> "Do the UI-update in a method called updateUI where you check if all
> necessary data (e.g. above lists) are present and call this method
> in every onSuccess-method of the different AsyncCallback-classes. "
>
> is the way to go.
>

I agree, 3 requests, 3 ui components fills, so the ui feels responsive and
some kind of "magic" that impress users.

2 questions:

1) not only async is the way to go, but the only way to go? Due one-thread
nature of javascript you can't do

request.send(callbackObject);
while (field == null) Timer.sleep(100);
field.use()

because javascript is really frozen doing that sleep, there is no way to
process the response. You have no notify() (yeah, no threads), nor
continuations and setTimeout is no better, but worse.

2) Is it feasible to do some kind of "request chaingun"?. Adding request to
a list, process responses with a generic callback and calling custom
callback when all finish:

List<Request> chain = new ArrayList<Request>();
chain.add(service.getData1(arg));
chain.add(service.getData2(arg));
chain.add(service.getData3(arg));
gun.fire(chain, new ChainGunCallback {
  onSuccess(List<Object> results) {
   // do casts and stuff
  }
  onFailure(WhatEver cause) {
    // crash!
  }
});

...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to