org.apache.myfaces.custom.tree.model
Class TreeModelEvent

java.lang.Object
  extended by org.apache.myfaces.custom.tree.model.TreeModelEvent

public class TreeModelEvent
extends Object

Version:
$Revision: 472638 $ $Date: 2006-11-08 15:54:13 -0500 (Wed, 08 Nov 2006) $
Author:
Oliver Rossmueller

Constructor Summary
TreeModelEvent(Object source, Object[] path)
          Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.
TreeModelEvent(Object source, Object[] path, int[] childIndices, Object[] children)
          Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as an array of Objects.
TreeModelEvent(Object source, TreePath path)
          Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.
TreeModelEvent(Object source, TreePath path, int[] childIndices, Object[] children)
          Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.
 
Method Summary
 int[] getChildIndices()
          Returns the values of the child indexes.
 Object[] getChildren()
          Return the objects that are children of the node identified by the path of this event at the locations specified by getChildIndices.
 Object getSource()
          Answer the source of this event
 TreePath getTreePath()
          For all events, except treeStructureChanged, returns the parent of the changed nodes.
 String toString()
          Returns a string that displays and identifies this object's properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeModelEvent

public TreeModelEvent(Object source,
                      Object[] path,
                      int[] childIndices,
                      Object[] children)
Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as an array of Objects. All of the modified objects are siblings which are direct descendents (not grandchildren) of the specified parent. The positions at which the inserts, deletes, or changes occurred are specified by an array of int. The indexes in that array must be in order, from lowest to highest.

Parameters:
source - the Object responsible for generating the event
path - an array of Object identifying the path to the parent of the modified item(s)
childIndices - array that specifies the index values of the removed items. The indices must be in sorted order, from lowest to highest
children - an array containing the inserted, removed, or changed objects

TreeModelEvent

public TreeModelEvent(Object source,
                      TreePath path,
                      int[] childIndices,
                      Object[] children)
Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.

Parameters:
source - the Object responsible for generating the event
path - a TreePath object that identifies the path to the parent of the modified item(s)
childIndices - array that specifies the index values of the modified items
children - an array containing the inserted, removed, or changed objects
See Also:
TreeModelEvent(Object,Object[],int[],Object[])

TreeModelEvent

public TreeModelEvent(Object source,
                      Object[] path)
Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.

Parameters:
source - the Object responsible for generating the event
path - an array of Object identifying the path to the parent of the modified item(s)

TreeModelEvent

public TreeModelEvent(Object source,
                      TreePath path)
Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.

Parameters:
source - the Object responsible for generating the event
path - a TreePath object that identifies the path to the parent of the modified item(s)
Method Detail

getSource

public Object getSource()
Answer the source of this event

Returns:
the source of this event

getTreePath

public TreePath getTreePath()
For all events, except treeStructureChanged, returns the parent of the changed nodes. For treeStructureChanged events, returns the ancestor of the structure that has changed. This and getChildIndices are used to get a list of the effected nodes.

The one exception to this is a treeNodesChanged event that is to identify the root, in which case this will return the root and getChildIndices will return null.

Returns:
the TreePath used in identifying the changed nodes.

getChildren

public Object[] getChildren()
Return the objects that are children of the node identified by the path of this event at the locations specified by getChildIndices. If this is a removal event the returned objects are no longer children of the parent node.

Returns:
an array of Object containing the children specified by the event

getChildIndices

public int[] getChildIndices()
Returns the values of the child indexes. If this is a removal event the indexes point to locations in the initial list where items were removed. If it is an insert, the indices point to locations in the final list where the items were added. For node changes, the indices point to the locations of the modified nodes.

Returns:
an array containing index locations for the children specified by the event

toString

public String toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString in class Object
Returns:
a String representation of this object


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.