CellList/CellBrowser and reload data (possible bug?)

80 views
Skip to first unread message

Ümit

unread,
Oct 15, 2010, 8:10:40 AM10/15/10
to Google Web Toolkit
I have been playing around with the new CellBrowser/CellTree Widgets
of GWT 2.1RC. However I ran into a weird problem. I am not sure if
that's a bug or maybe a mistake on my side.

Basically I was followed this tutorial
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellBrowser

I created a TreeViewModel and defined the required cells for all
levels of the tree/browser respectively (in my case there are 3
levels)
I pass a List of my DTOs into the constructor of my
CustomTreeViewModel Class. In the constructor I create a
ListDataProvider with the List of my DTO objects.
At this step everything works just fine. The CellBrowser is populated
with the first level and when I click of one entries the next level is
shown.

As a next step I created a button which should reload the CellBrowser
with new data (actually it's the same data). I did this by calling
setList(List<c>) on my ListDataAdapter in my CustomTreeViewModel. The
CellBrowser is reloaded with the new data and again only the root node/
elements are shown. Here I get a weird problem.
If I previously opened an additional level of the CellBrowser (apart
from the root level) and I reload the data so that again only the root
node/elements are shown and I click on one of the root node elements
to expand/display the second level I get following uncaught
Exception:

14:00:51.322 [ERROR] [gwasclient] Uncaught exception escaped
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at
com.google.gwt.user.cellview.client.CellBrowser.setChildState(CellBrowser.java:
1027)
at
com.google.gwt.user.cellview.client.CellBrowser.setChildState(CellBrowser.java:
990)
at com.google.gwt.user.cellview.client.CellBrowser.access
$7(CellBrowser.java:972)
at com.google.gwt.user.cellview.client.CellBrowser
$BrowserCellList.doKeyboardSelection(CellBrowser.java:325)
at
com.google.gwt.user.cellview.client.CellList.onBrowserEvent2(CellList.java:
389)
at com.google.gwt.user.cellview.client.CellBrowser
$BrowserCellList.onBrowserEvent2(CellBrowser.java:231)
at
com.google.gwt.user.cellview.client.AbstractHasData.onBrowserEvent(AbstractHasData.java:
454)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)


This happens in the setChildState function of the CellBrowser where
nodes get closed and opened. It seems that the when the new Data is
set and the CellBrowser get redrawn it forgets to reset the nodes
which are shown or hidden and when it tries to reset the collapse/open
status of these nodes it throws this exception.

So i am not sure if this is a bug or I choose the wrong approach to
reload the data of the CellBrowser

Maybe somebody has an idea what might be the problem here

Uemit

Ümit

unread,
Oct 15, 2010, 9:16:07 AM10/15/10
to Google Web Toolkit
I have attached a Sample Application (used the CellBrowserExample2
Code from the tutorial) with which one can reproduce the problem.

http://rapidshare.com/files/425238420/CellBrowserSample.zip

Uemit

John LaBanca

unread,
Oct 15, 2010, 12:02:30 PM10/15/10
to Google Web Toolkit
Thanks for catching this. I submitted a fix for review:
http://gwt-code-reviews.appspot.com/1012801/show

Ümit

unread,
Oct 17, 2010, 6:41:52 AM10/17/10
to Google Web Toolkit
Cool thanks for the fix ;-)

Keep up the good work.
Reply all
Reply to author
Forward
0 new messages