All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JTreeModel

java.lang.Object
   |
   +----com.sun.java.swing.JTreeModel

public class JTreeModel
extends Object
implements TreeModel
A simple tree data model that uses TreeNodes.


Variable Index

 o asksAllowsChildren
Whether or not isLeaf or getAllowsChildren is messaged to determine leafness with regard to TreeModel.
 o listenerList
 o root

Constructor Index

 o JTreeModel(TreeNode)
 o JTreeModel(TreeNode, boolean)

Method Index

 o addTreeModelListener(TreeModelListener)
 o asksAllowsChildren()
Returns whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes.
 o getChild(Object, int)
 o getChildCount(Object)
 o getPathToRoot(TreeNode)
Builds the parents of child up to, and including, the root node.
 o getPathToRoot(TreeNode, int)
 o getRoot()
 o isLeaf(Object)
 o nodeChanged(TreeNode)
Invoke this method after you've changed how node is to be represented in the tree.
 o nodesChanged(TreeNode, int[])
Invoke this method after you've changed how the children identified by childIndicies are to be represented in the tree.
 o nodeStructureChanged(TreeNode)
Invoke this method if you've totally changed the children of node and its childrens children...
 o nodesWereInserted(TreeNode, int[])
Invoke this method after you've inserted some TreeNodes into node.
 o nodesWereRemoved(TreeNode, int[])
Invoke this method after you've removed some TreeNodes from node.
 o reload()
Invoke this method if you've modified the TreeNodes upon which this model depends.
 o reload(TreeNode)
Invoke this method if you've modified the TreeNodes upon which this model depends.
 o removeTreeModelListener(TreeModelListener)
 o setAsksAllowsChildren(boolean)
Sets whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes.
 o valueForPathChanged(JTreePath, Object)
This sets the user object of the TreeNode identified by path and posts a node changed.

Variables

 o root
 protected TreeNode root
 o listenerList
 protected TreeModelListener listenerList
 o asksAllowsChildren
 protected boolean asksAllowsChildren
Whether or not isLeaf or getAllowsChildren is messaged to determine leafness with regard to TreeModel.

Constructors

 o JTreeModel
 public JTreeModel(TreeNode root)
 o JTreeModel
 public JTreeModel(TreeNode root,
                   boolean asksAllowsChildren)

Methods

 o setAsksAllowsChildren
 public void setAsksAllowsChildren(boolean newValue)
Sets whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes. If newvalue is true, getAllowsChildren() is messaged, otherwise isLeaf() is messaged.

 o asksAllowsChildren
 public boolean asksAllowsChildren()
Returns whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes.

 o getRoot
 public Object getRoot()
 o getChild
 public Object getChild(Object parent,
                        int index)
 o getChildCount
 public int getChildCount(Object parent)
 o isLeaf
 public boolean isLeaf(Object node)
 o reload
 public void reload()
Invoke this method if you've modified the TreeNodes upon which this model depends. The model will notify all of its listeners that the model has changed.

 o valueForPathChanged
 public void valueForPathChanged(JTreePath 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.

 o reload
 public void reload(TreeNode node)
Invoke this method if you've modified the TreeNodes upon which this model depends. The model will notify all of its listeners that the model has changed below the node node (PENDING).

 o nodesWereInserted
 public void nodesWereInserted(TreeNode node,
                               int childIndices[])
Invoke this method after you've inserted some TreeNodes into node. childIndices should be the index of the new elements and must be sorted in ascending order.

 o nodesWereRemoved
 public void nodesWereRemoved(TreeNode node,
                              int childIndices[])
Invoke this method after you've removed some TreeNodes from node. childIndices should be the index of the removed elements and must be sorted in ascending order.

 o nodeChanged
 public void nodeChanged(TreeNode node)
Invoke this method after you've changed how node is to be represented in the tree.

 o nodesChanged
 public void nodesChanged(TreeNode node,
                          int childIndices[])
Invoke this method after you've changed how the children identified by childIndicies are to be represented in the tree.

 o nodeStructureChanged
 public void nodeStructureChanged(TreeNode node)
Invoke this method if you've totally changed the children of node and its childrens children... This will post a treeStructureChanged event.

 o getPathToRoot
 public TreeNode[] getPathToRoot(TreeNode child)
Builds the parents of child up to, and including, the root node. child will be the last element in the returned array.

 o getPathToRoot
 protected TreeNode[] getPathToRoot(TreeNode aNode,
                                    int depth)
 o addTreeModelListener
 public void addTreeModelListener(TreeModelListener l)
 o removeTreeModelListener
 public void removeTreeModelListener(TreeModelListener l)

All Packages  Class Hierarchy  This Package  Previous  Next  Index