Class TreeModelNode

java.lang.Object
uk.ac.starlink.datanode.tree.TreeModelNode

public class TreeModelNode extends Object
Object used to store information about items in the DataNodeTreeModel hierarchy. This plays a role somewhat similar to that which TreeNode plays for DefaultTreeModel, but also takes care of some of the duties related to asynhronous expansion of the node.

You should generally synchronize on a TreeModelNode when accessing it in a way which might modify it or be sensitive to modification of it.

To create a TreeModelNode, use the DataNodeTreeModel.makeModelNode(uk.ac.starlink.datanode.nodes.DataNode, uk.ac.starlink.datanode.tree.TreeModelNode) method of DataNodeTreeModel.

Author:
Mark Taylor (Starlink)
  • Method Details

    • getChildren

      public List getChildren()
      Returns the list which contains the children. This list may be modified, but only TreeModelNodes should be elements of the list.
      Returns:
      mutable list of child nodes
    • getParent

      public TreeModelNode getParent()
      Returns the parent of this node. Will be null for the root.
      Returns:
      parent node
    • getDataNode

      public DataNode getDataNode()
      Returns the DataNode managed by this TreeModelNode.
      Returns:
      data node
    • setExpander

      public void setExpander(NodeExpander expander)
      Installs a NodeExpander object to take charge of locating this node's children. Any existing NodeExpander owned by this node will be uninstalled. NodeExpanders behave in such a way that such uninstallation will (at least may) cause them to stop expanding, so an expander should not be deinstalled and installed again later.

      It is the responsibility of the calling code to ensure that the new expander starts doing its expansion work.

      Parameters:
      expander - new node expander
    • getExpander

      public NodeExpander getExpander()
      Returns the object which is currently in charge of locating this nodes children. If null, no node expansion has been attempted on this node.
      Returns:
      the expander which has started (and may have finished) locating this node's children