-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5044398
By: draymann
Hi there,
is there a convenient way to update a tree? I want to use drag'n'drop in a tree with a model to move nodes (changing order and attach them to other nodes).
The use of the notifyXYZ methods sometimes is a bit tricky, because you have to distinguish between many different situations.
I tried to circumvent this problem by a brute force refresh of the tree with calling tree.setModel(tree.getModel()). In order to restore the state of the tree you have to memorize the open/closed state of the treeitems beforehand and do appropriate setOpen's afterward. The only problem with this approach (apart from being not that performant for large trees) is, that in the UI the tree is scrolled to the top. Unfortunatley this makes this approach mostly impractical.
So here are my questions: is there a method to easily refresh the tree without the issues mentioned above? Something like tree.rebuild? Is there a way to get and restore the position if the tree is scrolled? Does anyone have another idea (maybe a generic(?) way to use the notifyXYZ methods)?
Let me say that I really am a big fan of this framework and I am sure, that I'll find a good solution for this problem with your help.
Thanks and have a nice weekend,
Dominik
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=5064582
By: waterbottle
Have you ever read this small talk : http://www.zkoss.org/smalltalks/zkTreeModel/
, check code of TreeModelA.java,
fire a appropriate TreeDataEvent should works.
/Dennis
Asked: 2008-06-22 06:50:19 +0800
Seen: 363 times
Last updated: Jul 01 '08