All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.tree.DefaultTreeModel
java.lang.Object
|
+----com.sun.java.swing.tree.DefaultTreeModel
- public class DefaultTreeModel
- extends Object
- implements Serializable, TreeModel
A simple tree data model that uses TreeNodes.
-
asksAllowsChildren
- Whether or not isLeaf or getAllowsChildren is messaged to determine
leafness with regard to TreeModel.
-
listenerList
- Listeners.
-
root
- Root of the tree.
-
DefaultTreeModel(TreeNode)
-
-
DefaultTreeModel(TreeNode, boolean)
-
-
addTreeModelListener(TreeModelListener)
-
-
asksAllowsChildren()
- Returns whether or not to test leafness by asking getAllowsChildren()
or isLeaf() to the TreeNodes.
-
fireTreeNodesChanged(Object, Object[], int[], Object[])
-
-
fireTreeNodesInserted(Object, Object[], int[], Object[])
-
-
fireTreeNodesRemoved(Object, Object[], int[], Object[])
-
-
fireTreeStructureChanged(Object, Object[], int[], Object[])
-
-
getChild(Object, int)
-
-
getChildCount(Object)
-
-
getIndexOfChild(Object, Object)
-
-
getPathToRoot(TreeNode)
- Builds the parents of child up to, and including, the root node.
-
getPathToRoot(TreeNode, int)
-
-
getRoot()
-
-
insertNodeInto(MutableTreeNode, MutableTreeNode, int)
- Invoked this to insert newChild at location index in parents children.
-
isLeaf(Object)
-
-
nodeChanged(TreeNode)
- Invoke this method after you've changed how node is to be
represented in the tree.
-
nodesChanged(TreeNode, int[])
- Invoke this method after you've changed how the children identified by
childIndicies are to be represented in the tree.
-
nodeStructureChanged(TreeNode)
- Invoke this method if you've totally changed the children of
node and its childrens children...
-
nodesWereInserted(TreeNode, int[])
- Invoke this method after you've inserted some TreeNodes into
node.
-
nodesWereRemoved(TreeNode, int[], Object[])
- Invoke this method after you've removed some TreeNodes from
node.
-
reload()
- Invoke this method if you've modified the TreeNodes upon which this
model depends.
-
reload(TreeNode)
- Invoke this method if you've modified the TreeNodes upon which this
model depends.
-
removeNodeFromParent(MutableTreeNode)
- Message this to remove node from its parent.
-
removeTreeModelListener(TreeModelListener)
-
-
setAsksAllowsChildren(boolean)
- Sets whether or not to test leafness by asking getAllowsChildren()
or isLeaf() to the TreeNodes.
-
valueForPathChanged(TreePath, Object)
- This sets the user object of the TreeNode identified by path
and posts a node changed.
root
protected TreeNode root
- Root of the tree.
listenerList
protected EventListenerList listenerList
- Listeners.
asksAllowsChildren
protected boolean asksAllowsChildren
- Whether or not isLeaf or getAllowsChildren is messaged to determine
leafness with regard to TreeModel.
DefaultTreeModel
public DefaultTreeModel(TreeNode root)
DefaultTreeModel
public DefaultTreeModel(TreeNode root,
boolean asksAllowsChildren)
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.
asksAllowsChildren
public boolean asksAllowsChildren()
- Returns whether or not to test leafness by asking getAllowsChildren()
or isLeaf() to the TreeNodes.
getRoot
public Object getRoot()
getIndexOfChild
public int getIndexOfChild(Object parent,
Object child)
getChild
public Object getChild(Object parent,
int index)
getChildCount
public int getChildCount(Object parent)
isLeaf
public boolean isLeaf(Object node)
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.
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.
insertNodeInto
public void insertNodeInto(MutableTreeNode newChild,
MutableTreeNode 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.
removeNodeFromParent
public void removeNodeFromParent(MutableTreeNode node)
- Message this to remove node from its parent. This will message
nodesWereRemoved to create the appropriate event. This is the
preferred way to remove a node as it handles the event creation
for you.
nodeChanged
public void nodeChanged(TreeNode node)
- Invoke this method after you've changed how node is to be
represented in the tree.
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).
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.
nodesWereRemoved
public void nodesWereRemoved(TreeNode node,
int childIndices[],
Object removedChildren[])
- 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. And removedChildren should be
the array of the children objects that were removed.
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.
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.
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.
getPathToRoot
protected TreeNode[] getPathToRoot(TreeNode aNode,
int depth)
addTreeModelListener
public void addTreeModelListener(TreeModelListener l)
removeTreeModelListener
public void removeTreeModelListener(TreeModelListener l)
fireTreeNodesChanged
protected void fireTreeNodesChanged(Object source,
Object path[],
int childIndices[],
Object children[])
fireTreeNodesInserted
protected void fireTreeNodesInserted(Object source,
Object path[],
int childIndices[],
Object children[])
fireTreeNodesRemoved
protected void fireTreeNodesRemoved(Object source,
Object path[],
int childIndices[],
Object children[])
fireTreeStructureChanged
protected void fireTreeStructureChanged(Object source,
Object path[],
int childIndices[],
Object children[])
All Packages Class Hierarchy This Package Previous Next Index