API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.tree. DefaultTreeModel View Source
Author(s)
Rob Davis
Ray Ryan
Scott Violet
Since
Version
1.57 04/12/06
Serial
Hierarchy
 Object
      DefaultTreeModel
Implements
 Serializable
 TreeModel
Subclasses
Description
public class DefaultTreeModel
  A simple tree data model that uses TreeNodes.
See also:   
Constructors
public DefaultTreeModel (TreeNode root)
  Creates a tree in which any node can have children.
public DefaultTreeModel (TreeNode root, boolean asksAllowsChildren)
  Creates a tree specifying whether any node can have children, or whether only certain nodes can have children.
Methods
Hide/Show inherited methods
public void addTreeModelListener (TreeModelListener l) [Specified in TreeModel]
  Adds a listener for the TreeModelEvent posted after the tree changes.
public boolean asksAllowsChildren ()
  Tells how leaf nodes are determined.
protected void fireTreeNodesChanged (Object source, Object path, int[] childIndices, Object children)
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireTreeNodesInserted (Object source, Object path, int[] childIndices, Object children)
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireTreeNodesRemoved (Object source, Object path, int[] childIndices, Object children)
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireTreeStructureChanged (Object source, Object path, int[] childIndices, Object children)
  Notifies all listeners that have registered interest for notification on this event type.
public Object getChild (Object parent, int index) [Specified in TreeModel]
  Returns the child of parent at index index in the parent's child array.
public int getChildCount (Object parent) [Specified in TreeModel]
  Returns the number of children of parent.
public int getIndexOfChild (Object parent, Object child) [Specified in TreeModel]
  Returns the index of child in parent.
public T getListeners (Class< T> listenerType)
  Returns an array of all the objects currently registered as FooListeners upon this model.
public TreeNode getPathToRoot (TreeNode aNode)
  Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.
protected TreeNode getPathToRoot (TreeNode aNode, int depth)
  Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.
public Object getRoot () [Specified in TreeModel]
  Returns the root of the tree.
public TreeModelListener getTreeModelListeners ()
  Returns an array of all the tree model listeners registered on this model.
public void insertNodeInto (MutableTreeNode newChild, MutableTreeNode parent, int index)
  Invoked this to insert newChild at location index in parents children.
public boolean isLeaf (Object node) [Specified in TreeModel]
  Returns whether the specified node is a leaf node.
public void nodeChanged (TreeNode node)
Invoke this method after you've changed how node is to be represented in the tree.
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.
public void nodeStructureChanged (TreeNode node)
  Invoke this method if you've totally changed the children of node and its childrens children...
public void nodesWereInserted (TreeNode node, int[] childIndices)
  Invoke this method after you've inserted some TreeNodes into node.
public void nodesWereRemoved (TreeNode node, int[] childIndices, Object removedChildren)
  Invoke this method after you've removed some TreeNodes from node.
public void reload ()
  Invoke this method if you've modified the TreeNodes upon which this model depends.
public void reload (TreeNode node)
  Invoke this method if you've modified the TreeNodes upon which this model depends.
public void removeNodeFromParent (MutableTreeNode node)
  Message this to remove node from its parent.
public void removeTreeModelListener (TreeModelListener l) [Specified in TreeModel]
  Removes a listener previously added with addTreeModelListener().
public void setAsksAllowsChildren (boolean newValue)
  Sets whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes.
public void setRoot (TreeNode root)
  Sets the root to root.
public void valueForPathChanged (TreePath path, Object newValue) [Specified in TreeModel]
  This sets the user object of the TreeNode identified by path and posts a node changed.
Fields
Hide/Show inherited fields
protected boolean asksAllowsChildren
  Determines how the isLeaf method figures out if a node is a leaf node.
protected EventListenerList listenerList
Listeners.
protected TreeNode root
Root of the tree.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar