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

## org.jdesktop.swingx.tree
Class TreeModelSupport

    java.lang.Object
      org.jdesktop.swingx.tree.TreeModelSupport

    public final class TreeModelSupport

extends java.lang.Object

Support for change notification, usable by `TreeModel`s. The changed/inserted/removed is expressed in terms of a `TreePath`, it's up to the client model to build it as appropriate. This is inspired by `AbstractTreeModel` from Christian Kaufhold, www.chka.de. TODO - implement and test precondition failure of added/removed notification

Author:
  JW

Field Summary
`protected javax.swing.event.EventListenerList` | `listeners`

Constructor Summary
`TreeModelSupport(javax.swing.tree.TreeModel model)` Creates the support class for the given `TreeModel`.

Method Summary
`void` | `addTreeModelListener(javax.swing.event.TreeModelListener l)`
`void` | `fireChildAdded(javax.swing.tree.TreePath parentPath, int index, java.lang.Object child)` Notifies registered TreeModelListeners that the child has been added to the the node identified by the given parent path at the given position.
`void` | `fireChildChanged(javax.swing.tree.TreePath parentPath, int index, java.lang.Object child)` Notifies registered TreeModelListeners that the given child of the node identified by the given parent path has been modified.
`void` | `fireChildRemoved(javax.swing.tree.TreePath parentPath, int index, java.lang.Object child)` Notifies registered TreeModelListeners that the child has been removed from the node identified by the given parent path from the given position.
`void` | `fireChildrenAdded(javax.swing.tree.TreePath parentPath, int[] indices, java.lang.Object[] children)` Notifies registered TreeModelListeners that the given children have been added to the the node identified by the given parent path at the given locations.
`void` | `fireChildrenChanged(javax.swing.tree.TreePath parentPath, int[] indices, java.lang.Object[] children)` Notifies registered TreeModelListeners that the given children of the node identified by the given parent path have been modified.
`void` | `fireChildrenRemoved(javax.swing.tree.TreePath parentPath, int[] indices, java.lang.Object[] children)` Notifies registered TreeModelListeners that the given children have been removed to the the node identified by the given parent path from the given locations.
`void` | `fireNewRoot()` Notifies registered TreeModelListeners that the tree's root has been replaced.
`void` | `firePathChanged(javax.swing.tree.TreePath path)` Notifies registered TreeModelListeners that the the node identified by the given path has been modified.
`void` | `firePathLeafStateChanged(javax.swing.tree.TreePath path)` Call when a node has changed its leaf state.
`void` | `fireTreeStructureChanged(javax.swing.tree.TreePath subTreePath)` Notifies registered TreeModelListeners that the structure below the node identified by the given path has been completely changed.
`javax.swing.event.TreeModelListener[]` | `getTreeModelListeners()`
`void` | `removeTreeModelListener(javax.swing.event.TreeModelListener l)`

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

Field Detail

### listeners

    protected javax.swing.event.EventListenerList listeners

Constructor Detail

### TreeModelSupport

    public TreeModelSupport(javax.swing.tree.TreeModel model)

  Creates the support class for the given `TreeModel`.

  Parameters:
    `model` - the model to support
  Throws:
    `java.lang.NullPointerException` - if `model` is `null`

Method Detail

### fireNewRoot

    public void fireNewRoot()

  Notifies registered TreeModelListeners that the tree's root has been replaced. Can cope with a null root.

### firePathLeafStateChanged

    public void firePathLeafStateChanged(javax.swing.tree.TreePath path)

  Call when a node has changed its leaf state.

  PENDING: rename? Do we need it?

  Parameters:
    `path` - the path to the node with changed leaf state.

### fireTreeStructureChanged

    public void fireTreeStructureChanged(javax.swing.tree.TreePath subTreePath)

  Notifies registered TreeModelListeners that the structure below the node identified by the given path has been completely changed.

  NOTE: the subtree path maybe null if the root is null. If not null, it must contain at least one element (the root).

  Parameters:
    `subTreePath` - the path to the root of the subtree whose structure was changed.
  Throws:
    `java.lang.NullPointerException` - if the path is not null but empty or contains null elements.

### firePathChanged

    public void firePathChanged(javax.swing.tree.TreePath path)

  Notifies registered TreeModelListeners that the the node identified by the given path has been modified.

  Parameters:
    `path` - the path to the node that has been modified, must not be null and must not contain null path elements.

### fireChildChanged

    public void fireChildChanged(javax.swing.tree.TreePath parentPath,
                                 int index,
                                 java.lang.Object child)

  Notifies registered TreeModelListeners that the given child of the node identified by the given parent path has been modified. The parent path must not be null, nor empty nor contain null elements.

  Parameters:
    `parentPath` - the path to the parent of the modified children.
    `index` - the position of the child
    `child` - child node that has been modified, must not be null

### fireChildrenChanged

    public void fireChildrenChanged(javax.swing.tree.TreePath parentPath,
                                    int[] indices,
                                    java.lang.Object[] children)

  Notifies registered TreeModelListeners that the given children of the node identified by the given parent path have been modified. The parent path must not be null, nor empty nor contain null elements. Note that the index array must contain the position of the corresponding child in the the children array. The indices must be in ascending order.

  The exception to these rules is if the root itself has been modified (which has no parent by definition). In this case the path must be the path to the root and both indices and children arrays must be null.

  Parameters:
    `parentPath` - the path to the parent of the modified children.
    `indices` - the positions of the modified children
    `children` - the modified children

### fireChildAdded

    public void fireChildAdded(javax.swing.tree.TreePath parentPath,
                               int index,
                               java.lang.Object child)

  Notifies registered TreeModelListeners that the child has been added to the the node identified by the given parent path at the given position. The parent path must not be null, nor empty nor contain null elements.

  Parameters:
    `parentPath` - the path to the parent of added child.
    `index` - the position of the added children
    `child` - the added child

### fireChildRemoved

    public void fireChildRemoved(javax.swing.tree.TreePath parentPath,
                                 int index,
                                 java.lang.Object child)

  Notifies registered TreeModelListeners that the child has been removed from the node identified by the given parent path from the given position. The parent path must not be null, nor empty nor contain null elements.

  Parameters:
    `parentPath` - the path to the parent of removed child.
    `index` - the position of the removed children before the removal
    `child` - the removed child

### fireChildrenAdded

    public void fireChildrenAdded(javax.swing.tree.TreePath parentPath,
                                  int[] indices,
                                  java.lang.Object[] children)

  Notifies registered TreeModelListeners that the given children have been added to the the node identified by the given parent path at the given locations. The parent path and the child array must not be null, nor empty nor contain null elements. Note that the index array must contain the position of the corresponding child in the the children array. The indices must be in ascending order.

  Parameters:
    `parentPath` - the path to the parent of the added children.
    `indices` - the positions of the added children.
    `children` - the added children.

### fireChildrenRemoved

    public void fireChildrenRemoved(javax.swing.tree.TreePath parentPath,
                                    int[] indices,
                                    java.lang.Object[] children)

  Notifies registered TreeModelListeners that the given children have been removed to the the node identified by the given parent path from the given locations. The parent path and the child array must not be null, nor empty nor contain null elements. Note that the index array must contain the position of the corresponding child in the the children array. The indices must be in ascending order.

  Parameters:
    `parentPath` - the path to the parent of the removed children.
    `indices` - the positions of the removed children before the removal
    `children` - the removed children

### addTreeModelListener

    public void addTreeModelListener(javax.swing.event.TreeModelListener l)

### getTreeModelListeners

    public javax.swing.event.TreeModelListener[] getTreeModelListeners()

### removeTreeModelListener

    public void removeTreeModelListener(javax.swing.event.TreeModelListener l)

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

Copyright © 2010. All Rights Reserved.