posted 13 years ago
Hello,
I have a Lazyily loaded JTree but I am facing some problems.
I have a JTree which I load lazily using database query (each node). I have a button on the screen and when user clicks the button I perform some insert/update/delete in database and then add the model back in Jtree with only root and its immediate children using an SQL (this collapses the tree and selection and all expanded nodes collapse which is expected since it is a lazily loaded tree)
What I want to accomplish is before user clicks button to insert/update/delete, I read all the expanded state and save it in memory then when I re-initialize the Jtree I loop through those expanded children and call jtree.expandPath but it does not expand the nodes .
I even added a TreeWillExpandListener and in treeWillExpand event I added code to get the children of the node from database and I see that query does get executed to get the childreen but JTree still shows up as collapsed.
I really need your help. Please advise. Here is the code snippet.