I think you'll have to do something like this:
public class MyEntryPoin implements EntryPoint {
private boolean alreadyAddedWidget;
public void onModuleLoad() {
alreadyAddedWidget = true;
MyService service = GWT.create(MyService.class);
service.someCall(args, new AsyncCallback<Foo>() {
public void onFailure(Throwable caught) {}
public void onSuccess(Foo result) {
if (alreadyAddedWidget)
return;
alreadyAddedWidget = true;
RootPanel.get().add(...);
}
}
service.anotherCall(args, new AsyncCallback<Bar>() {
public void onFailure(Throwable caught) {}
public void onSuccess(Bar result) {
if (alreadyAddedWidget)
return;
alreadyAddedWidget = true;
RootPanel.get().add(...);
}
}
}
}
On Mon, Aug 1, 2011 at 1:23 PM, Deepak Singh <[email protected]>wrote:
> I am making 2 seperate RPC calls.
> Whichever is finished first, i would add RootPanel.get("id").add(widget)
> into onSuccess.
>
> I can not add same widgets two times in both onSuccess(). So i am out of
> mind how to resolve this.
>
> Any logic pls.
>
>
> On Mon, Aug 1, 2011 at 9:08 PM, Jens <[email protected]> wrote:
>
>> Its not possible to stop execution as RPC requests are async. The only
>> thing you can do is to put your code that has to wait into the onSuccess
>> method of your RPC call.
>>
>> -- J.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-web-toolkit/-/hgRZHjACARUJ.
>>
>> 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.
>>
>
> --
> 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.
>
--
Magno Machado Paulo
http://blog.magnomachado.com.br
http://code.google.com/p/emballo/
--
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.