Class GTreeSlowLoadingNode

  • All Implemented Interfaces:
    GTreeNode, java.lang.Comparable<GTreeNode>, java.lang.Iterable<GTreeNode>
    Direct Known Subclasses:
    FSBDirNode, FSBRootNode

    public abstract class GTreeSlowLoadingNode
    extends AbstractGTreeNode
    Base class for GTNodes that want to use a lazy loading approach, but the loading may be slow and therefor should be done in another thread. By using SlowLoadingNode nodes, you don't have to create all the nodes up front and the nodes will only be created as needed. If you extend this base class, you have to implement one additional method than if you extended AbstractGTreeNode and that is generateChildren(TaskMonitor monitor). The generateChildren(TaskMonitor monitor) method will be called automatically from a task thread when needed. While the loading is taking place, An "In Progress" node will be displayed.
    • Constructor Detail

      • GTreeSlowLoadingNode

        public GTreeSlowLoadingNode()
    • Method Detail

      • loadChildren

        protected final void loadChildren()
        Description copied from class: AbstractGTreeNode
        This will be called when it is time to load children. Some subclasses may not use this method, but may instead have children externally added.
        Overrides:
        loadChildren in class AbstractGTreeNode
      • swingSetChildren

        protected void swingSetChildren​(java.util.List<GTreeNode> childList,
                                        boolean notify,
                                        boolean onlyIfInProgress)
      • addNode

        public void addNode​(int index,
                            GTreeNode node)
        Note: you cannot call this method from the Swing thread, as the data may not have been loaded. Instead, this method should be called from a GTreeTask.
        Specified by:
        addNode in interface GTreeNode
        Overrides:
        addNode in class AbstractGTreeNode
        Parameters:
        index - The index where the node should be inserted
        node - The node to insert
      • getParent

        public GTreeNode getParent()
        Description copied from interface: GTreeNode
        Returns the parent of this node.
        Specified by:
        getParent in interface GTreeNode
        Returns:
        the parent of this node.
      • dispose

        public void dispose()
        Description copied from interface: GTreeNode
        Disposes this node and all of its descendants.
        Specified by:
        dispose in interface GTreeNode
      • isInProgress

        public boolean isInProgress()
        Description copied from interface: GTreeNode
        Returns true if this node is currently being modified.
        Specified by:
        isInProgress in interface GTreeNode
        Returns:
        true if this node is currently being modified.
      • setInProgress

        protected void setInProgress()
      • isChildrenLoadedOrInProgress

        public boolean isChildrenLoadedOrInProgress()
      • isChildrenLoaded

        protected boolean isChildrenLoaded()
      • doGetChildCount

        protected int doGetChildCount()
      • doGetAllChildCount

        protected int doGetAllChildCount()
      • doGetAllChildren

        protected java.util.List<GTreeNode> doGetAllChildren()
      • doGetActiveChildren

        protected java.util.List<GTreeNode> doGetActiveChildren()
      • doGetChild

        protected GTreeNode doGetChild​(int index)
      • doGetIndexOfChild

        protected int doGetIndexOfChild​(GTreeNode node)
      • doGetIndexOfChild

        protected int doGetIndexOfChild​(GTreeNode node,
                                        java.util.List<GTreeNode> children)
        Subclasses can override this method to perform faster lookups of a node; for example, if the subclass has a sorted list of children, then a binary search can be used.
        Parameters:
        node - the node whose index we seek
        children - the children who contain the given node (may be null)
        Returns:
        the index of the given child in the given list
      • doAddNode

        protected void doAddNode​(int index,
                                 GTreeNode child)
      • removeNode

        public void removeNode​(GTreeNode node)
        Description copied from interface: GTreeNode
        Remove the given node from this node.
        Specified by:
        removeNode in interface GTreeNode
        Parameters:
        node - the to be removed.
      • doSetChildren

        protected void doSetChildren​(java.util.List<GTreeNode> childList,
                                     boolean notify)
      • doSetActiveChildren

        protected void doSetActiveChildren​(java.util.List<GTreeNode> childList)
      • doResetActiveChildren

        protected void doResetActiveChildren()
        Convenience method to clear any filtered items by restoring the active children of this node to be the complete set of children.
      • fireNodeChanged

        public void fireNodeChanged​(GTreeNode parentNode,
                                    GTreeNode node)
        Description copied from interface: GTreeNode
        Notifies the tree that a node has changed.
        Specified by:
        fireNodeChanged in interface GTreeNode
        Parameters:
        parentNode - the node that contains the node that was changed.
        node - the that changed.
      • fireNodeStructureChanged

        public void fireNodeStructureChanged​(GTreeNode node)
        Description copied from interface: GTreeNode
        Notifies the tree that the node has different children. This method
        Specified by:
        fireNodeStructureChanged in interface GTreeNode
        Parameters:
        node - the node that has changed.