Class TreeState

  • All Implemented Interfaces:
    Serializable

    public class TreeState
    extends Object
    implements Serializable
    Used to capture the state of a JTree. Useful if treemodel is changing and one doesn't want tree selections and node expansions to be lost. Could also be used to restore a JTree in between application invocations. Identify lead selection, selected elements and expanded paths. Since selection paths are stored (rather than rows), restoration should remain possible after simplistic tree updates such as node deletion, insertion and rearrangement. TODO: Improve deletion handling, general debugging, anchor path, handle anchor/lead
    See Also:
    Serialized Form
    • Constructor Detail

      • TreeState

        public TreeState​(JTree pTree)
    • Method Detail

      • getSelectionPaths

        public TreePath[] getSelectionPaths()
      • restoreState

        public boolean restoreState​(JTree pTree)
        Returns:
        State was restored perfectly