So, you click save, then each field is validated individually via an  
RPC?

One trick is to chain your RPC Calls. I have an abstract Callback that  
implements Command and also has a field to hold an additional Command.  
CommandCallback the execute() method is able to Fire the RPC that is  
handled by the callback, and after onSuccess() is processed any  
command added to the callback is executed (another commandCallback for  
instance) that way you can create a whole chain of RPCs and call  
execute on the first and each will be sent in sequence.

to prevent the save button from being pressed again while these RPCs  
are executing you can disable the button, and enable it again as a  
final command in the chain.

Of course, if you can combine all of these RPCs into a single request  
you'll have better performance.

-jason

On Apr 27, 2009, at 6:33 PM, AirJ wrote:

>
> Hi GWT gurus,
>
> I have a generic questions regarding asynchronous calls. Basically in
> our gwt web application, when user clicks on "save button", the
> application launches a bunch of asynchronous calls(validation, server
> side callbacks).
>
> "Save" should only be invoked when all those asynchronous calls are
> processed.
>
> One way to do it is to call "Save" in the onCallbackSuccess() method
> of those asynchronous calls. But it will make the code very
> unstructured and hard to trace.
>
> Essentially I need a method to flush all the queued asynchronous calls
> before I make a new one. Will
> DeferredCommand.addCommand() solve the problem?
>
> Thanks,
> Di
> >


--~--~---------~--~----~------------~-------~--~----~
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