Please take a took to this code
I have written this code to be able to make RPC calls one after
another:
(you can use 'result' value to know if you can continue to next call)
/*ONE*/CustomWaitingOperation.execute(new
CustomWaitingOperation.ResultCallback(){
public void onResult(boolean result, Throwable caught) {
if(result)
{
/*TWO*/CustomWaitingOperation.execute(new
CustomWaitingOperation.ResultCallback(){
public void onResult(boolean result, Throwable
caught) {
if(result)
{
}
}
});
}
}
});
CustomWitingOperation.java
public class CustomWaitingOperation {
/*Fields*/
public interface ResultCallback {
void onResult(boolean result,Throwable caught);
}
public CustomWaitingOperation(/*Parameters Here*/) {
/*Fields=Parameters*/
}
public void onResponse(boolean result,Throwable caught) {
return;
}
public static void execute(/*Parameters Here*/,final ResultCallback
resultCallback){
final AppServicesAsync serviceProxy =
AppParameters.getServiceProxy
();
final CustomWaitingOperation wait = new CustomWaitingOperation(/
*Parameters Here*/){
@Override
public void onResponse(boolean result,Throwable caught) {
resultCallback.onResult(result, caught);
}
};
AsyncCallback<TempObject> callback = new
AsyncCallback<TempObject>()
{
public void onFailure(Throwable caught) {
GWT.log("RPC error!", caught);
wait.onResponse(false, caught);//do not
continue
}
public void onSuccess(final TempObject result) {
wait.onResponse(true, null);//continue
}
}
serviceProxy.executeCustomOperation(/*RPC call arguments*/,
callback);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---