Hi there,
I wonder if anyone can help me. Basically, I have a for loop which
relies on the result of a previous for loop. However, the fact that
GWT uses asynchronous calls is messing the contents of the arraylists
up. Here is my code:
try{
for(int i = 0; i<typeList.getItemCount(); i++){
if(data.itemType.equals(typeList.getItemText(i))){
typeList.setSelectedIndex(i);
if(data.itemType.toString().equals("Drink")){
changedTypeValue =
typeList.getValue
(typeList.getSelectedIndex());
ServerService rpc = new
ServerService();
rpc.getItemCategoryData(changedTypeValue, callback);
//callback.onSuccess(result);
//rpc.wait();
}
}
}
}
catch (Exception e){
System.out.println("Modify: " +e.getMessage());
}
for(int i = 0; i<categoryList.getItemCount(); i++){
System.out.println("Category Count: " +i );
if(data.itemCategory.equals(categoryList.getItemText(i)))
{
categoryList.setSelectedIndex(i);
}
}
So the second for loop does not wait for the first one to finish
executing. Is there a way to get the call to wait. As you can see I
have commented out an rpc.wait() call. This just throws an error when
I call it.
If anyone can provide a solution to my problem, it would be much
appreciated.
Regards,
Jack
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---