PDA

View Full Version : [FIXED] GXT B4: Trees + TreeStore



joshb
11 Jun 2008, 6:51 AM
I think I have found a bug, and have spent an hour or so going through source. Actually two bugs - but please correct me if I'm wrong.

Bug #1: TreeBuilder does not bind the BaseTreeModel to the TreeItem. Perhaps it is not supposed to, but I don't see why this would be a problem, and given that you can pass a TreeModel into it, it would be the expected behaviour (at least by me!)

Bug #2: TreeStore + Binder (but no TreeLoader) - Does not add children of children of Model.
I've created a BaseTreeLoader, and bound it using a TreeBinder to a tree. I then do an RPC call to fetch the TreeModel, at which point I add the Root to the store.

Eventually it calls


private void insert(TreeModel parent, List<TreeModel> children, int index, boolean supressEvent) on line 504 of Beta4 TreeStore.java

This method cycles through the children and inserts the children of the Model into the tree, but it does not recursively go through its children. I'm pretty sure this is an oversight, and wouldn't be picked up in any of the Explorer examples. As a result, the Tree is only one level deep when I believe it should build it all out, as TreeBuilder does (and as I said, I tried to use TreeBuilder but found that it loses the relationship with the Model.

Can someone please confirm? Darryl?

Thanks

darrellmeyer
11 Jun 2008, 10:07 AM
1. TreeBuilder now calls item.setData(model) on newly created tree items.
2. The 4 add and 4 insert methods in TreeStore have a new addChildren param. When set to true, the children of the models are added recursively.

Changes are in SVN.

joshb
11 Jun 2008, 11:48 AM
Thanks Darrell!