org.jppf.ui.treetable
Class AbstractTreeTableModel

java.lang.Object
  extended by org.jppf.ui.treetable.AbstractTreeTableModel
All Implemented Interfaces:
TreeModel, TreeTableModel
Direct Known Subclasses:
AbstractJPPFTreeTableModel, FileSystemModel

public abstract class AbstractTreeTableModel
extends Object
implements TreeTableModel

An abstract implementation of the TreeTableModel interface, handling the list of listeners.

Version:
%I% %G%
Author:
Philip Milne

Field Summary
protected  EventListenerList listenerList
          The list of event listeners for this tree table model.
protected  Object root
          The tree root.
 
Constructor Summary
AbstractTreeTableModel(Object root)
          Initialize this model with the specified tree root.
 
Method Summary
 void addTreeModelListener(TreeModelListener l)
          
protected  void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)
          Notify all listeners that have registered interest for notification on this event type.
protected  void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)
          Notify all listeners that have registered interest for notification on this event type.
protected  void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)
          Notify all listeners that have registered interest for notification on this event type.
protected  void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)
          Notify all listeners that have registered interest for notification on this event type.
 Class getColumnClass(int column)
          Returns the type for column number column.
 int getIndexOfChild(Object parent, Object child)
          
 Object getRoot()
          
 boolean isCellEditable(Object node, int column)
          By default, make the column with the Tree in it the only editable one.
 boolean isLeaf(Object node)
          
 void removeTreeModelListener(TreeModelListener l)
          
 void setValueAt(Object aValue, Object node, int column)
          Sets the value for node node, at column number column.
 void valueForPathChanged(TreePath path, Object newValue)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jppf.ui.treetable.TreeTableModel
getColumnCount, getColumnName, getValueAt
 
Methods inherited from interface javax.swing.tree.TreeModel
getChild, getChildCount
 

Field Detail

root

protected Object root
The tree root.


listenerList

protected EventListenerList listenerList
The list of event listeners for this tree table model.

Constructor Detail

AbstractTreeTableModel

public AbstractTreeTableModel(Object root)
Initialize this model with the specified tree root.

Parameters:
root - the root of the tree.
Method Detail

getRoot

public Object getRoot()

Specified by:
getRoot in interface TreeModel

isLeaf

public boolean isLeaf(Object node)

Specified by:
isLeaf in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)

Specified by:
valueForPathChanged in interface TreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)

Specified by:
getIndexOfChild in interface TreeModel

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)

Specified by:
addTreeModelListener in interface TreeModel

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)

Specified by:
removeTreeModelListener in interface TreeModel

fireTreeNodesChanged

protected void fireTreeNodesChanged(Object source,
                                    Object[] path,
                                    int[] childIndices,
                                    Object[] children)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the source of the event.
path - the path of the parent node whose children have changed.
childIndices - the indices of the children that changed.
children - an array of the children that changed.
See Also:
EventListenerList

fireTreeNodesInserted

protected void fireTreeNodesInserted(Object source,
                                     Object[] path,
                                     int[] childIndices,
                                     Object[] children)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the source of the event.
path - the path of the parent node whose children have changed.
childIndices - the indices of the children that were inserted.
children - an array of the children that were inserted.
See Also:
EventListenerList

fireTreeNodesRemoved

protected void fireTreeNodesRemoved(Object source,
                                    Object[] path,
                                    int[] childIndices,
                                    Object[] children)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the source of the event.
path - the path of the parent node whose children have changed.
childIndices - the indices of the children that were removed.
children - an array of the children that were removed.
See Also:
EventListenerList

fireTreeStructureChanged

protected void fireTreeStructureChanged(Object source,
                                        Object[] path,
                                        int[] childIndices,
                                        Object[] children)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the source of the event.
path - the path of the parent node whose children have changed.
childIndices - the indices of the children that have changed.
children - an array of the children that chnaged.
See Also:
EventListenerList

getColumnClass

public Class getColumnClass(int column)
Returns the type for column number column.

Specified by:
getColumnClass in interface TreeTableModel
Parameters:
column - the column number.
Returns:
the type of the column.

isCellEditable

public boolean isCellEditable(Object node,
                              int column)
By default, make the column with the Tree in it the only editable one. Making this column editable causes the JTable to forward mouse and keyboard events in the Tree column to the underlying JTree. Indicates whether the the value for node node, at column number column is editable.

Specified by:
isCellEditable in interface TreeTableModel
Parameters:
node - the node to check.
column - the column where the value is.
Returns:
true if the cell is editable, false otherwise.

setValueAt

public void setValueAt(Object aValue,
                       Object node,
                       int column)
Sets the value for node node, at column number column.

Specified by:
setValueAt in interface TreeTableModel
Parameters:
aValue - the value to set.
node - the node for which to set the value.
column - the column where the value is to be set.


Copyright © 2005-2010 JPPF Team.