CellTree "reordering" nodes?

23 views
Skip to first unread message

decitrig

unread,
Oct 31, 2010, 12:04:56 PM10/31/10
to Google Web Toolkit
This problem is a bit tricky to describe; forgive me. I have a cell
tree where nodes are added programmatically by doing a getList().add()
on a ListDataProvider field. However, I found that using
the .add(Object) method would do strange things to the ordering, i.e.
the node *rendered* as "Item 1" would be passed as *value* "Item 2" to
getNodeInfo(), and thus it looked like Item 1 got Item 2's children.

The really strange thing is that if I do .add(0, Object), then
everything works fine.

The actual code can be found here:
http://bitbucket.org/slide_rule/umd-code-review/src/tip/src/edu/umd/review/gwt/view/impl/CommentTrayViewImpl.java

I just want to have list operations reflected in the tree, is this a
bug or have I just screwed this up somehow?

--
rwsims

David Pinn

unread,
Nov 1, 2010, 4:21:29 AM11/1/10
to Google Web Toolkit
I don't know you you've screwed up; but if you have, so have I.

I too have been seeing very strange event-handling behaviour, with
values being passed to getNodeInfo that are not for the node clicked
on. Using your trick with .add(0, Object) made my problem go away too.
Right now I'm really happy because it is just that little bit less
likely that we are both stupid. maybe.

On Nov 1, 3:04 am, decitrig <rws...@gmail.com> wrote:
> This problem is a bit tricky to describe; forgive me. I have a cell
> tree where nodes are added programmatically by doing a getList().add()
> on a ListDataProvider field. However, I found that using
> the .add(Object) method would do strange things to the ordering, i.e.
> the node *rendered* as "Item 1" would be passed as *value* "Item 2" to
> getNodeInfo(), and thus it looked like Item 1 got Item 2's children.
>
> The really strange thing is that if I do .add(0, Object), then
> everything works fine.
>
> The actual code can be found here:http://bitbucket.org/slide_rule/umd-code-review/src/tip/src/edu/umd/r...

rahul vijay shinde

unread,
Nov 1, 2010, 5:17:31 AM11/1/10
to google-web-toolkit
These mail are been wrongly marked to me

Please avoid.

Regards
Rahul Shinde


On Mon, 01 Nov 2010 13:53:51 +0530 David Pinn wrote
>--
>You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
>To post to this group, send email to google-we...@googlegroups.com.
>To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
>For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

John LaBanca

unread,
Nov 1, 2010, 11:23:41 AM11/1/10
to google-we...@googlegroups.com
There is a bug in CellTreeNodeView where it always assumes new data starts at index 0, which of course is not true if the data is being appended.  That explains why it works when you insert at index 0.  Another workaround is to populate the ListDataProvider before creating the CellTree (if that is an option for your app).

I'm working on a fix that will be in the next GWT release.

Thanks,
John LaBanca
jlab...@google.com

David Pinn

unread,
Nov 1, 2010, 7:38:17 PM11/1/10
to Google Web Toolkit
Thanks John. Would another work-around be to call the
ListDataProvider's setList method for each change to the tree?

On Nov 2, 2:23 am, John LaBanca <jlaba...@google.com> wrote:
> There is a bug in CellTreeNodeView where it always assumes new data starts
> at index 0, which of course is not true if the data is being appended.  That
> explains why it works when you insert at index 0.  Another workaround is to
> populate the ListDataProvider before creating the CellTree (if that is an
> option for your app).
>
> I'm working on a fix that will be in the next GWT release.
>
> Thanks,
> John LaBanca
> jlaba...@google.com
> > <http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.co...>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-we...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .

John LaBanca

unread,
Nov 2, 2010, 1:55:33 PM11/2/10
to google-we...@googlegroups.com
Calling ListDataProvider#refresh() or #setList() should force a full refresh, which would fix the problem.

Thanks,
John LaBanca
jlab...@google.com

decitrig

unread,
Nov 9, 2010, 12:25:42 PM11/9/10
to Google Web Toolkit
Since I needed an ordering, I wound up implementing a
TreeSetDataProvider, but I'm not sure it's correct; it seems to be
working ok. It creates new ArrayLists of its elements when it needs to
update row data.

--
rwsims

On Nov 2, 12:55 pm, John LaBanca <jlaba...@google.com> wrote:
> Calling ListDataProvider#refresh() or #setList() should force a full
> refresh, which would fix the problem.
>
> Thanks,
> John LaBanca
> > > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .
> > > > >For more options, visit this group at
> > > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > > <
> >http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.co...>
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Google Web Toolkit" group.
> > > > To post to this group, send email to
> > google-we...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com><google-web-toolkit%2Bunsubs
Reply all
Reply to author
Forward
0 new messages