Hi,
thanks to all.
Yes, using the onSuccess method is the way to go. But it requires
additional member variables and - if there were more such cases - this
could get a little bit ugly.
But it's ok for now.
Magnus
--
You received this message because you are subscribed to the Google Groups
"G
I think the big advantage of Promises/Futures is that you can pass a
Future/Promise around. It also makes handling multiple asynchronous easier
than with callbacks (chaining vs nested callbacks).
Of course they have to be non-blocking.
Java8 and it's lambda constructs would make things much less v
> In general these kind of scenarios would be a good fit for
> Futures/Promises especially if you depend on multiple asynchronous calls.
> https://code.google.com/p/gwt-async-future/
IMHO Futures don't buy you anything in GWT. In Java Future.get() blocks
until the result is available, in GWT
I think this solution is the right one.
In general these kind of scenarios would be a good fit for Futures/Promises
especially if you depend on multiple asynchronous calls.
https://code.google.com/p/gwt-async-future/
https://code.google.com/p/gwtquery/wiki/Promises
On Tuesday, July 9, 2013
If inviter is a required information then make it a constructor arg:
private final AsyncCallback> loadUsersCallback;
public InvitationForm(final int inviter) {
loadUsersCallback = new AsyncCallback>() {
void onSuccess(final List users) {
fillList(users);
select(inviter);
}
Hi Jens,
yes, there are many options, but as I wrote, there are always some annoying
things that make the code unattractive somehow.
The options 2) and 3) require an additional member variable to hold the
inviter's value until the server call returns, and finally you end up in
redundancy: The
Somewhat depends on the concrete case, there is probably not the one
solution that always fits.
1.) Dependency Inject: Load the list externally, e.g. new
InvitationForm(users). As setInviter() depends on the list its not a good
idea to use invitationForm.setUsers() because then you still need t
Hi,
I use a form called "InvitationForm" to let the user create an invitation
for a game, like this:
InvitationForm f = new InvitationForm();
...
f.setInviter(...);
In this case, the call to setInviter selects an entry in a list of users.
Unfortunately, the list of users is fetched by an asynch