It seems that the new CellTree data presentation widget has several
issues:
1) There's no way to programatically expand/collapse tree nodes.
In my application, I want the tree's top level to be expanded by
default. I've had to resort to native JSNI methods to tinker with the
CellTree's nodes and invoke a private method 'setOpen(boolean)'
2) Updating any non-leaf node's data causes the node's sub-tree to
collapse.
The classic example is a tree representing a users's mailbox. When an
message is read, the unread count displayed in the tree needs to be
updated (decremented). Currently the updated folder's sub-tree is
collapsed when the value is updated.
Here's the code that I'm using to update the data:
private class FolderListViewAdapter extends
ListViewAdapter<MailFolder> {
public FolderListViewAdapter() {
}
public void updateViewData(int index, MailFolder folder) {
this.getList().set(index, folder);
}
}
.... And the calling code:
public void updateFolder(MailFolder folder) {
Integer index = folderIndexMap.get(folder.id);
if (index != null) {
FolderListViewAdapter x = folderModel.folderAdapterMap
.get(folder.parentId);
x.updateViewData(index, folder);
}
}
Is this the proper way to update the data in a tree cell?
I looked into using a ValueUpdater for updating the cell's value, but
it seems that ValueUpdaters are only used in response to browser
events (eg: clicking on the cell). There doesn't seem to be any other
way to attach a ValueUpdater to a cell except through the
onBrowserEvent() method on the cell itself.
Thanks,
--gpan
--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment