Tuesday, July 9, 2013

Re: how to defer a method call until the return of an async server call?

If inviter is a required information then make it a constructor arg:

private final AsyncCallback<List<User>> loadUsersCallback;
public InvitationForm(final int inviter) {
  loadUsersCallback = new AsyncCallback<List<User>>() {
    void onSuccess(final List<User> users) {
       fillList(users);
       select(inviter);
    }
  }
}

@Override
protected void onLoad() {
   super.onLoad();
   service.getUsers(loadUsersCallback);
}

That's what I would have done, but maybe I don't get your use case correctly ;-) So far I never really needed this scheduleDeferredWhenServerCallReturned feature, as I already have it.. its the onSuccess() method and I would rethink what I am doing until I can implement onSuccess() the way it should be.

-- J.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment