Class GTreeSlowLoadingNode

All Implemented Interfaces:
Cloneable, Comparable<GTreeNode>
Direct Known Subclasses:
FSBNode

public abstract class GTreeSlowLoadingNode extends GTreeLazyNode
Base class for nodes that generate their children on demand, but because generating their children is slow, that operation is moved to a background thread. While the children are being generated, an InProgressGTreeNode will appear in the tree until the GTreeSlowLoadingNode.LoadChildrenTask has completed.
  • Constructor Details Link icon

    • GTreeSlowLoadingNode Link icon

      public GTreeSlowLoadingNode()
  • Method Details Link icon

    • generateChildren Link icon

      public abstract List<GTreeNode> generateChildren(TaskMonitor monitor) throws CancelledException
      Subclass must implement this method to generate their children. This operation will always be performed in a background thread (i.e. Not the swing thread)
      Parameters:
      monitor - a TaskMonitor for reporting progress and cancel notification.
      Returns:
      the list of children for this node.
      Throws:
      CancelledException - if the monitor is cancelled
    • generateChildren Link icon

      protected final List<GTreeNode> generateChildren()
      Description copied from class: GTreeLazyNode
      Subclasses must be able to generate their children nodes on demand by implementing this method.
      Specified by:
      generateChildren in class GTreeLazyNode
      Returns:
      the list of GTreeNodes that make up the children for this node.
    • loadAll Link icon

      public int loadAll(TaskMonitor monitor) throws CancelledException
      Description copied from class: GTreeNode
      Causes any lazy or slow loading nodes in the tree to load their children so that the tree is fully loaded. Nodes that are already loaded (including normal nodes which are always loaded) do nothing except recursively call GTreeNode.loadAll(TaskMonitor) on their children.
      Overrides:
      loadAll in class GTreeNode
      Parameters:
      monitor - the TaskMonitor to monitor progress and provide cancel checking
      Returns:
      the total number of nodes in the subtree of this node
      Throws:
      CancelledException - if the operation is cancelled using the monitor
    • getParent Link icon

      public final GTreeNode getParent()
      Returns the parent of this node. Note: this method is deliberately not synchronized (See comments above)
      Returns:
      the parent of this node.
    • isRoot Link icon

      public final boolean isRoot()
      Returns true if this is a root node of a GTree
      Returns:
      true if this is a root node of a GTree
    • children Link icon

      protected final List<GTreeNode> children()
    • doSetChildrenAndFireEvent Link icon

      protected void doSetChildrenAndFireEvent(List<GTreeNode> childList)
      Sets the children of this node to the given list of child nodes and fires the appropriate tree event to kick the tree to update the display. Note: This method must be called from the swing thread because it will notify the underlying JTree.
      Parameters:
      childList - the list of child nodes to assign as children to this node
      See Also:
    • doSetChildren Link icon

      protected void doSetChildren(List<GTreeNode> childList)
      Sets the children of this node to the given list of child nodes, but does not notify the tree. This method does not have to be called from the swing thread. It is intended to be used by background threads that want to populate all or part of the tree, but wait until the bulk operations are completed before notifying the tree.
      Parameters:
      childList - the list of child nodes to assign as children to this node
    • doAddNode Link icon

      protected void doAddNode(GTreeNode node)
      Adds a node to this node's children. Must be called from the swing thread.
      Parameters:
      node - the node to add as a child to this node
    • doAddNode Link icon

      protected void doAddNode(int index, GTreeNode node)
      Adds a node to this node's children at the given index and notifies the tree. Must be called from the swing thread.
      Parameters:
      index - the index at which to add the new node
      node - the node to add as a child to this node
    • doRemoveNode Link icon

      protected void doRemoveNode(GTreeNode node)
      Removes the node from this node's children and notifies the tree. Must be called from the swing thread.
      Parameters:
      node - the node to remove
    • doAddNodes Link icon

      protected void doAddNodes(List<GTreeNode> nodes)
      Adds the given nodes to this node's children. Must be called from the swing thread.
      Parameters:
      nodes - the nodes to add to the children this node
    • clone Link icon

      public GTreeNode clone() throws CloneNotSupportedException
      Creates a clone of this node. The clone should contain a shallow copy of all the node's attributes except that the parent and children are null.
      Overrides:
      clone in class Object
      Returns:
      the clone of this object.
      Throws:
      CloneNotSupportedException - if some implementation prevents itself from being cloned.
    • dispose Link icon

      public void dispose()
    • isInProgress Link icon

      public final boolean isInProgress()
      Returns true if the node is in the process of loading its children. See GTreeSlowLoadingNode
      Returns:
      true if the node is in the process of loading its children.
    • isLoaded Link icon

      public boolean isLoaded()
      True if the children for this node have been loaded yet. Some GTree nodes are lazy in that they don't load their children until needed. Nodes that have the IN_PROGRESS node as it child is considered loaded if in the swing thread, otherwise they are considered not loaded.
      Returns:
      true if the children for this node have been loaded.
    • getTree Link icon

      public GTree getTree()
      Returns the GTree that this node is attached to
      Returns:
      the GTree that this node is attached to
    • doFireNodeAdded Link icon

      protected void doFireNodeAdded(GTreeNode newNode)
    • doFireNodeRemoved Link icon

      protected void doFireNodeRemoved(GTreeNode removedNode, int index)
    • doFireNodeStructureChanged Link icon

      protected void doFireNodeStructureChanged()
    • doFireNodeChanged Link icon

      protected void doFireNodeChanged()