Class AbstractTreeModel

java.lang.Object
net.thevpc.common.swing.tree.AbstractTreeModel
All Implemented Interfaces:
TreeModel

public abstract class AbstractTreeModel extends Object implements TreeModel
Author:
thevpc
  • Field Details

  • Constructor Details

    • AbstractTreeModel

      public AbstractTreeModel()
  • Method Details

    • valueForPathChanged

      public void valueForPathChanged(TreePath path, Object newValue)
      This sets the user object of the TreeNode identified by path and posts a node changed. If you use custom user objects in the TreeModel you're going to need to subclass this and set the user object of the changed node to something meaningful.
      Specified by:
      valueForPathChanged in interface TreeModel
    • valueForPathChangedImpl

      public void valueForPathChangedImpl(TreePath path, Object newValue)
    • insertNodeInto

      public void insertNodeInto(Object newChild, Object parent, int index)
      Invoked this to insert newChild at location index in parents children. This will then message nodesWereInserted to create the appropriate event. This is the preferred way to add children as it will create the appropriate event.
    • isLeaf

      public boolean isLeaf(Object node)
      Specified by:
      isLeaf in interface TreeModel
    • insertNodeIntoImpl

      protected abstract void insertNodeIntoImpl(Object parent, Object newChild, int index)
    • removeNodeFromParentImpl

      protected abstract void removeNodeFromParentImpl(Object parent, int childIndex)
    • removeNodeFromParent

      public void removeNodeFromParent(Object node)
    • nodeChanged

      public void nodeChanged(Object node)
    • nodesWereInserted

      public void nodesWereInserted(Object node, int[] childIndices)
    • nodesWereRemoved

      public void nodesWereRemoved(Object node, int[] childIndices, Object[] removedChildren)
    • nodesChanged

      public void nodesChanged(Object node, int[] childIndices)
    • nodeStructureChanged

      public void nodeStructureChanged(Object node)
    • getPathToRoot

      public Object[] getPathToRoot(Object aNode)
    • getPathToRoot

      protected Object[] getPathToRoot(Object aNode, int depth)
    • addTreeModelListener

      public void addTreeModelListener(TreeModelListener l)
      Specified by:
      addTreeModelListener in interface TreeModel
    • removeTreeModelListener

      public void removeTreeModelListener(TreeModelListener l)
      Specified by:
      removeTreeModelListener in interface TreeModel
    • getTreeModelListeners

      public TreeModelListener[] getTreeModelListeners()
    • fireTreeNodesChanged

      protected void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)
    • fireTreeStructureChanged

      protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)
    • fireTreeNodesInserted

      protected void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)
    • fireTreeStructureChanged

      protected void fireTreeStructureChanged(Object source, TreePath path)
    • getListeners

      public <T extends EventListener> T[] getListeners(Class<T> listenerType)
    • fireTreeNodesRemoved

      protected void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)
    • breadthFirstEnumeration

      public Enumeration<Object> breadthFirstEnumeration()
    • getChildren

      public List<Object> getChildren(Object parent)
    • getParent

      public abstract Object getParent(Object target)
    • getLevel

      public int getLevel(Object target)
    • isNodeChild

      public boolean isNodeChild(Object first, Object next)
    • getIndexOfChild

      public int getIndexOfChild(Object parent, Object child)
      Specified by:
      getIndexOfChild in interface TreeModel
    • copyNode

      public abstract Object copyNode(Object node)