Thank you. This story is really great. It solved my problem ;) I was still thinking in a wrong way.
Thanks again. Mark On 29 Mai, 17:34, Paul Robinson <[email protected]> wrote: > Take a look at the great beer > story:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa... > > This story should be included in Google's GWT FAQ > > Paul > > > > Mark wrote: > > Hello, > > > I've got a strange (at least for me) problem: > > > Start.java: > > > new RetrieveDeck(deck); // this starts a new query to the server > > where it gets a json object > > System.out.println(deck + " size:" + deck.size()); // get debug > > information > > > RetrieveDeck.java: > > > public RetrieveDeck(FlashCardList deck) { > > this.deck = deck; > > > String url = URL.encode(GWT.getModuleBaseURL() + "sampleDeck"); > > RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); > > > builder.sendRequest(null, new RequestCallback() { > > �...@override > > public void onResponseReceived(Request request, > > Response response) { > > if (200 == response.getStatusCode()) { > > JsArray<FlashCardData> tmp = > > FlashCardData > > > > .asArrayOfFlashCards(response.getText()); > > > getDeck().populate(tmp); // here > > i pass the data to be added in > > a list > > }); > > > protected FlashCardList getDeck() { > > return deck; > > } > > } > > > List.java: > > > public void populate(JsArray<FlashCardData> decks) { > > for (int i = 0; i < decks.length(); i++) { > > add( /* get a lot of infomation and add it to the list */); > > } > > System.out.println(this + " size:" + size()); // get debug > > information > > } > > > This all should work fine (I think) but if I run the program I get the > > following output: > > > .client.cards.flashcardl...@19fdee7 size:0 // this is from Start.java > > .client.cards.flashcardl...@19fdee7 size:2 // this is form List.java > > > As you can see the empty list at the beginning is first printed ... > > How can I make the program stop until the list is populated? > > > Thank you very much. > > Mark -- 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.
