PDA

View Full Version : The following method does not work: replaceSubTree in class TreeStore.



rfrate
27 Feb 2014, 4:40 AM
The following method does not work: replaceSubTree in class TreeStore. After his call, you can not collapse or expand the tree nodes. Thanks

branflake2267
4 Mar 2014, 2:10 PM
I'm investigating and will get back shortly.

Brandon

branflake2267
4 Mar 2014, 2:58 PM
I'm not able to replicate the issue yet. Could you provide some more information to help us drill?

1. Could I see your code configuration that has the issue?
2. How are you getting the TreeNode children to add to the replaceSubTree?

Thanks,
Brandon

rfrate
4 Mar 2014, 10:47 PM
Here is a simple example:


FolderDto folder = new FolderDto(1, 0, "ROOT");
List<BaseDto> children = new ArrayList<BaseDto>();
ChildrenDto childrenDto = new ChildrenDto(2, 1, "test 2222");
children.add(childrenDto);
ChildrenDto childrenDto2 = new ChildrenDto(3, 1, "test 3333");
children.add(childrenDto2);
folder.setChildren(children);
store.add(folder);
store.add(folder,children);
store.replaceSubTree(folder, children); After his call, you can not collapse or expand the tree nodes.

branflake2267
5 Mar 2014, 10:13 AM
I wouldn't expect that to work because children should be of type 'List<? extends TreeNode<M>> children'. There is an unwrap function immediately after that. I would suspect some other routine would need to be used if using the model type directly.

Maybe replaceChildren(M parent, List<M> children) would be the best choice.

Would the other method work for you?

Brandon

branflake2267
10 Mar 2014, 1:36 PM
Looks like I had an oversight and BaseDto extends TreeNode. Looks like this may be a bug. I'll take another look. Brandon