JTree re-build - need to save the expanded / collapsed state of node



Hi All,

I have the following problem:
I'm using the JTree object in my application.
Some of the nodes have dynamic children that are being refreshed from
time to time.
The refresh operation removes all the children from the node and build
them from scratch.
I'm saving the state of all the nodes and sub-nodes (expanded /
collapsed) and when I want to re-build the tree according to the state
using the collapsePath & expandPath methods, the tree doesn't expand
collapse correctly (I can see that it "sends" the correct operation but
the tree is not being updated accordingly.

Did someone have to deal with it?
Is there a better way to do it?

Thanks.

.



Relevant Pages

  • Re: automatic refreshing of JTree not working
    ... I'm having a hell of a time trying to get a JTree to automatically refresh to show that a node has been moved from one parent node to another. ... I tried the reloadmethod of the tree model and of course when I do that the entire tree collapses and that isn't what I want method useful). ... And *that* issue is due to how JNDI sends search requests to a server. ... I thought if I go back to simplifying my code to make the JTree update itself then I wouldn't even have to go back to my data source, at least for refreshing the node that had one of its children removed. ...
    (comp.lang.java.gui)
  • HList example using Entry, Label, and virtual Checkbuttons (part II)
    ... I always wanted my Tree to have widgets ... (callback function that refresh the gui:) ...
    (comp.lang.perl.tk)
  • Re: treeview refresh
    ... FormName.TreeViewname to refer to the control). ... If you want to learn lots about Treeview controls, ... > best way to refresh the treeview after changes are made? ... > I have one many to many relationship in the tree the keys may change. ...
    (microsoft.public.access.formscoding)
  • Re: Treeview events
    ... I won't load the entire tree at beginning too, ... If you insist on relying on user input to decide when to refresh, ... One final option, if you insist on this redundant behavior, is to handle   ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Fragile Fences
    ... >as warnings/errors/whatever in the compile tree until you refresh. ... you are treating the flat files as the ... However, in either case, the copy that counts for Eclipse is its ...
    (comp.lang.java.programmer)