On 03/22/2013 01:06 AM, Kris wrote:
Hi, I am trying to load some data for a ListBox on startup..

I have this in the onModuleLoad method

private final PrintProviderMockServiceAsync ppmockService =
GWT.create(PrintProviderMockService.class);
....
....

ppmockService.getPrintProviders(new
AsyncCallback<ArrayList<PrintProviderMock>>() {

@Override
public void onSuccess(ArrayList<PrintProviderMock> arg0) {
for (PrintProviderMock printProviderMock : arg0) {
comboBox.addItem(printProviderMock.getName());
}
}

@Override
public void onFailure(Throwable t) {
t.printStackTrace();
}
});

Anyone got some good ideas how to load data into various widgets on
startup ??


--
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
[email protected].
To post to this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


I'm not entirely sure of what did you mean by load data into widgets at startup, but in my case I use MVP framework do handle this kind of problem.

Where the presenter fetches data from service and assign values to the view accordingly, is that what you want?

Example:

// Presenter code

        @Override
        protected void onReset() {
                super.onReset();
                // Add your RPC code here
ppmockService.getPrintProviders(new AsyncCallback<ArrayList<PrintProviderMock>>() {

                @Override
                public void onSuccess(ArrayList<PrintProviderMock> arg0) {
                for (PrintProviderMock printProviderMock : arg0) {
                        
getView().addItemToComboList(printProviderMock.getName()); // notice this
                }
                }

                @Override
                public void onFailure(Throwable t) {
                        t.printStackTrace();
                }
                });             
                
        }

// Presenter code

You can use GWTP (GWT Platform for MVP)

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to