save Selection on UI page for later retrieval??

19 views
Skip to first unread message

malekobaid

unread,
Jun 13, 2007, 4:30:39 PM6/13/07
to Google Web Toolkit
Dear All,
I am using the same skeleton of the KitchenSink Project. I have a
page in which an interface of listboxes and RadioButtons, etc. and
specifications in this Interface can lead to a specific xml. which can
be saved as 'metric' of xml.
In another Page, the saved metrics are displayed, after selecting a
metric, click 'Modify' will lead to the first page of interface, and I
want to display the selections on the interface lisboxes. Is there any
way to save what selections has been made in the first place???
if not, whats the solution because I even have a problem in making
simply selection on the interface, If I simply add
listbox1.setSelectionItem(2,true) in the first page constructor before
the initWidget, it gives me an error ''Failed to Load the #main
Module# ''
so if I want the page to be loaded with some specific selection on the
Interface, how can it be done?
thank you..in advance..

---------------------------------
the exact error in the hosted mode when i pre-specify
something :Failed to create an instance of
'de.kisters.commonMetrics.client.CommonMetrics' via deferred binding
java.lang.IndexOutOfBoundsException: null
at com.google.gwt.user.client.ui.ListBox.checkIndex(ListBox.java:300)
at com.google.gwt.user.client.ui.ListBox.setItemSelected(ListBox.java:
228)
at
de.kisters.commonMetrics.client.CommonMetricsPage.initPage(CommonMetricsPage.java:
743)
at
de.kisters.commonMetrics.client.CommonMetricsPage.<init>(CommonMetricsPage.java:
110)
at
de.kisters.commonMetrics.client.CommonMetrics.<init>(CommonMetrics.java:
22)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:
175)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:135)
at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:
313)

Sumit Chandel

unread,
Jun 23, 2007, 9:45:04 PM6/23/07
to Google-We...@googlegroups.com
Hi malekobaid,

The reason why you're receiving this error is because you are indexing an item in the ListBox that doesn't exist.  Keep in mind that items in a ListBox are 0-indexed (that is, the first item in a ListBox corresponds to index = 0).  The most likely reason why you're getting an IndexOutOfBoundsException is because you may be referring to the items in the ListBox as if they were 1-indexed.  Also, make sure that all the items in your listbox have been added before attempting to refer to user selections using setSelectionItem(int, boolean).

Calling initWidget(listBox1) before or after the listBox1.setSelectionItem(1, true) is not a problem, as long as it's called before your composite is added to any other widgets in your client code.

Hope that helps,
-Sumit Chandel

On 6/13/07, malekobaid <malek...@gmail.com> wrote:

Dear All,
I am using the same skeleton of the KitchenSink Project. I have a
page in which an interface of listboxes and RadioButtons, etc. and
specifications in this Interface can lead to a specific xml. which can
be saved as 'metric' of xml.
In another Page, the saved metrics are displayed, after selecting a
metric, click 'Modify' will lead to the first page of interface, and I
want to display the selections on the interface lisboxes. Is there any
way to save what selections has been made in the first place???
if not, whats the solution because I even have a problem in making
simply selection on the interface, If I simply add
listbox1.setSelectionItem (2,true) in the first page constructor before
Reply all
Reply to author
Forward
0 new messages