Class AsyncTreeModel

  • Direct Known Subclasses:
    AsyncSwingTreeModel

    public class AsyncTreeModel
    extends java.lang.Object
    Tree model, which dynamically represents running components.
    • Field Detail

      • root

        protected ITreeNode root
        The root node.
      • listeners

        protected final java.util.List<TreeModelListener> listeners
        The tree listeners.
      • nodelisteners

        protected final java.util.List<INodeListener> nodelisteners
        The node listeners.
      • nodes

        protected final java.util.Map<java.lang.Object,​ITreeNode> nodes
        The node lookup table.
      • added

        protected final java.util.Map<java.lang.Object,​ITreeNode> added
        The added nodes.
      • zombies

        protected final java.util.Map<java.lang.Object,​java.lang.Integer> zombies
        The zombie node ids (id->remove counter).
      • overlays

        protected final java.util.List<INodeHandler> overlays
        The icon overlays.
    • Constructor Detail

      • AsyncTreeModel

        public AsyncTreeModel()
        Create a component tree model.
    • Method Detail

      • getRoot

        public ITreeNode getRoot()
        Get the root node.
      • getChild

        public ITreeNode getChild​(java.lang.Object parent,
                                  int index)
        Get the given child of a node.
      • getChildCount

        public int getChildCount​(java.lang.Object parent)
        Get the number of children of a node.
      • getIndexOfChild

        public int getIndexOfChild​(java.lang.Object parent,
                                   java.lang.Object child)
        Get the index of a child.
      • isLeaf

        public boolean isLeaf​(java.lang.Object node)
        Test if the node is a leaf.
      • addTreeModelListener

        public void addTreeModelListener​(TreeModelListener l)
        Add a listener.
      • removeTreeModelListener

        public void removeTreeModelListener​(TreeModelListener l)
        Remove a listener.
      • setRoot

        public void setRoot​(ITreeNode root)
        Set the root node.
      • fireTreeChanged

        public void fireTreeChanged​(ITreeNode node)
        Inform listeners that tree has changed from given node on.
      • fireNodeChanged

        public void fireNodeChanged​(ITreeNode node)
        Inform listeners that a node has changed.
      • fireNodeRemoved

        public void fireNodeRemoved​(ITreeNode parent,
                                    ITreeNode child,
                                    int index)
        Inform listeners that a node has been removed
      • fireNodesRemoved

        public void fireNodesRemoved​(ITreeNode parent,
                                     ITreeNode[] childs,
                                     int[] indices)
        Inform listeners that a node has been removed
      • fireNodeAdded

        public void fireNodeAdded​(ITreeNode parent,
                                  ITreeNode child,
                                  int index)
        Inform listeners that a node has been added
      • buildTreePath

        public java.util.List<ITreeNode> buildTreePath​(ITreeNode node)
        Build a tree path to the given node.
        Parameters:
        desc - The node.
        Returns:
        The path items.
      • registerNode

        public void registerNode​(ITreeNode node)
        Register a node. Nodes can be registered for easy access.
      • addNode

        public void addNode​(ITreeNode node)
        Add a node. Informs listeners.
      • getNode

        public ITreeNode getNode​(java.lang.Object id)
        Get a node by its id.
      • getAddedNode

        public ITreeNode getAddedNode​(java.lang.Object id)
        Get a node by its id.
      • deregisterNode

        public void deregisterNode​(ITreeNode node)
        Remove a node registration.
      • addNodeHandler

        public void addNodeHandler​(INodeHandler overlay)
        Add a node handler.
      • getNodeHandlers

        public INodeHandler[] getNodeHandlers()
        Get the node handlers.
      • addNodeListener

        public void addNodeListener​(INodeListener listener)
        Register a node listener.
      • removeNodeListener

        public void removeNodeListener​(INodeListener listener)
        Deregister a node listener.
      • isZombieNode

        public boolean isZombieNode​(java.lang.Object id)
        Check, if a node is a zombie.
      • dispose

        public void dispose()
        Called when the tree is removed.
      • getNodeOrAddZombie

        public ITreeNode getNodeOrAddZombie​(java.lang.Object id)
        Get a node for removal. Add a zombie node, if node does not exist.
      • addZombieNode

        public void addZombieNode​(java.lang.Object id)
        Add a zombie node or increase the counter.
      • removeZombieNode

        public void removeZombieNode​(ITreeNode node)
        Remove a zombie node.