Hi there,

Thanks for your reply. Yes my initial reaction is indeed "but i
can't". I should have stated that the code I provided before is in an
inner class, and the callback command is outside of this class.

Therefore, if i place the second loop outside of this class it wont be
able to call the data. This si the full code:

    AsyncCallback callback = new AsyncCallback()
    {
        public void onFailure(Throwable caught)
        {
                updateItemsRootPanel.add(new HTML("Failed:" +
caught.getMessage()));
        }

        public void onSuccess(Object result)
        {
                ServerSQLData data = (ServerSQLData) result;
                categoryList.clear();

                for (int i = 0; i<data.itemCategoryArrayList.size();i++){
                        System.out.println("Number: " +i);
                        categoryList.addItem(data.itemCategoryArrayList.get
(i).toString());
                }
        }
    };


class ServerStatsUpdater extends AbstractAsyncHandler
        {
                public void handleFailure(Throwable caught){
        }
                public void handleSuccess(Object result){
                        ServerSQLData data = (ServerSQLData) result;

                        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);

                                                }

                                }

                        }

                        }
                        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);
                                        }
                        }


I cant see how I am going to get this to work. Surely there must be a
way around?!

Regards,
Jack


Ian Petersen wrote:
> On Mon, Feb 2, 2009 at 1:17 PM, [email protected]
> <[email protected]> wrote:
> > If anyone can provide a solution to my problem, it would be much
> > appreciated.
>
> Put the second for loop in the body of the onSuccess method in the
> callback.  If that doesn't make sense, or if your reaction is "but I
> can't", search the list's history for "I need a beer", and read the
> analogy there.
>
> You can't wait for RPC results.
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to