Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.custom.tree.model
Class DefaultTreeModel

    java.lang.Object
      org.apache.myfaces.custom.tree.model.DefaultTreeModel

All Implemented Interfaces:
  TreeModel

public class DefaultTreeModel
extends java.lang.Object
implements TreeModel

Version:
  $Revision: 169651 $ $Date: 2005-05-11 12:14:23 -0400 (Wed, 11 May 2005) $
Author:
  Oliver Rossmueller

Constructor Summary
`DefaultTreeModel()`
`DefaultTreeModel(TreeNode root)`

Method Summary
`protected void` | `fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)` Notify all listeners of a node change.
`protected void` | `fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)` Notify all listeners of structure change.
`protected void` | `fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)` Notify all listeners of structure change.
`protected void` | `fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)` Notify all listeners of structure change.
`protected void` | `fireTreeStructureChanged(java.lang.Object source, TreePath path)` Notify all listeners of structure change.
`java.lang.Object` | `getChild(java.lang.Object parent, int index)` Return the child of `parent` at index `index` in the parent's child array.
`int` | `getChildCount(java.lang.Object parent)` Answer the number of children of `parent`.
`int` | `getIndexOfChild(java.lang.Object parent, java.lang.Object child)` Return the index of child in parent.
`TreeNode[]` | `getPathToRoot(TreeNode node)` Collect all parent nodes up to the root node.
`protected TreeNode[]` | `getPathToRoot(TreeNode node, int depth)` Recursivly collect parent nodes up the the root node.
`java.lang.Object` | `getRoot()` Return the root of the tree.
`java.util.Collection` | `getTreeModelListeners()` Answer the mutable collection of tree model listeners.
`boolean` | `isLeaf(java.lang.Object node)` Answer `true` if `node` is a leaf.
`void` | `nodeChanged(TreeNode node)` Invoke this method after you've changed how node is to be represented in the tree.
`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.
`void` | `nodeStructureChanged(TreeNode node)` Invoke this method if you've totally changed the children of node and its childrens children...
`void` | `nodesWereInserted(TreeNode node, int[] childIndices)` Invoke this method after you've inserted some TreeNodes into node.
`void` | `nodesWereRemoved(TreeNode node, int[] childIndices, java.lang.Object[] removedChildren)` Invoke this method after you've removed some TreeNodes from node.
`void` | `valueForPathChanged(TreePath path, java.lang.Object newValue)` Called when the value for the item identified by `path` has changed to `newValue`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultTreeModel

    public DefaultTreeModel()

### DefaultTreeModel

    public DefaultTreeModel(TreeNode root)

Method Detail

### getRoot

    public java.lang.Object getRoot()

  Description copied from interface: `TreeModel`
  Return the root of the tree.

  Specified by:
    `getRoot` in interface `TreeModel`
  Returns:
    the root of the tree or null, it this tree has no nodes

### getChild

    public java.lang.Object getChild(java.lang.Object parent,
                                     int index)

  Description copied from interface: `TreeModel`
  Return the child of `parent` at index `index` in the parent's child array.

  Specified by:
    `getChild` in interface `TreeModel`
  Parameters:
    `parent` - a node in the tree
  Returns:
    the child of `parent` at index `index`

### getChildCount

    public int getChildCount(java.lang.Object parent)

  Description copied from interface: `TreeModel`
  Answer the number of children of `parent`.

  Specified by:
    `getChildCount` in interface `TreeModel`
  Parameters:
    `parent` - a node in the tree
  Returns:
    the number of children of the node `parent`

### isLeaf

    public boolean isLeaf(java.lang.Object node)

  Description copied from interface: `TreeModel`
  Answer `true` if `node` is a leaf.

  Specified by:
    `isLeaf` in interface `TreeModel`
  Parameters:
    `node` - a node in the tree
  Returns:
    true if `node` is a leaf

### valueForPathChanged

    public void valueForPathChanged(TreePath path,
                                    java.lang.Object newValue)

  Description copied from interface: `TreeModel`
  Called when the value for the item identified by `path` has changed to `newValue`. If `newValue` signifies a truly new value the model should post a `treeNodesChanged` event.

  Specified by:
    `valueForPathChanged` in interface `TreeModel`
  Parameters:
    `path` - path to the node that has been altered
    `newValue` - the new value from the TreeCellEditor

### getIndexOfChild

    public int getIndexOfChild(java.lang.Object parent,
                               java.lang.Object child)

  Description copied from interface: `TreeModel`
  Return the index of child in parent.

  Specified by:
    `getIndexOfChild` in interface `TreeModel`
  Parameters:
    `parent` - a node in the tree
    `child` - the node we are interested in
  Returns:
    the index of the child in the parent, or -1 if either `child` or `parent` are `null`

### getTreeModelListeners

    public java.util.Collection getTreeModelListeners()

  Description copied from interface: `TreeModel`
  Answer the mutable collection of tree model listeners.

  Specified by:
    `getTreeModelListeners` in interface `TreeModel`
  Returns:
    Collection

### nodeChanged

    public void nodeChanged(TreeNode node)

  Invoke this method after you've changed how node is to be represented in the tree.

### 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.

### 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,
                                 java.lang.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.

### getPathToRoot

    public TreeNode[] getPathToRoot(TreeNode node)

  Collect all parent nodes up to the root node.

  Parameters:
    `node` - the TreeNode to get the path for

### getPathToRoot

    protected TreeNode[] getPathToRoot(TreeNode node,
                                       int depth)

  Recursivly collect parent nodes up the the root node.

  Parameters:
    `node` - the TreeNode to get the path for
    `depth` - number of steps already taken towards the root (on recursive calls)
  Returns:
    an array giving the path from the root to the specified node

### fireTreeNodesChanged

    protected void fireTreeNodesChanged(java.lang.Object source,
                                        java.lang.Object[] path,
                                        int[] childIndices,
                                        java.lang.Object[] children)

  Notify all listeners of a node change.

  Parameters:
    `source` - the node being changed
    `path` - the path to the root node
    `childIndices` - the indices of the changed elements
    `children` - the changed elements

### fireTreeNodesInserted

    protected void fireTreeNodesInserted(java.lang.Object source,
                                         java.lang.Object[] path,
                                         int[] childIndices,
                                         java.lang.Object[] children)

  Notify all listeners of structure change.

  Parameters:
    `source` - the node where new elements are being inserted
    `path` - the path to the root node
    `childIndices` - the indices of the new elements
    `children` - the new elements

### fireTreeNodesRemoved

    protected void fireTreeNodesRemoved(java.lang.Object source,
                                        java.lang.Object[] path,
                                        int[] childIndices,
                                        java.lang.Object[] children)

  Notify all listeners of structure change.

  Parameters:
    `source` - the node where elements are being removed
    `path` - the path to the root node
    `childIndices` - the indices of the removed elements
    `children` - the removed elements

### fireTreeStructureChanged

    protected void fireTreeStructureChanged(java.lang.Object source,
                                            java.lang.Object[] path,
                                            int[] childIndices,
                                            java.lang.Object[] children)

  Notify all listeners of structure change.

  Parameters:
    `source` - the node where the tree model has changed
    `path` - the path to the root node
    `childIndices` - the indices of the affected elements
    `children` - the affected elements

### fireTreeStructureChanged

    protected void fireTreeStructureChanged(java.lang.Object source,
                                            TreePath path)

  Notify all listeners of structure change.

  Parameters:
    `source` - the node where the tree model has changed
    `path` - the path to the root node

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD