Cytoscape 3.0.1 API

org.cytoscape.util.swing
Class AbstractTreeTableModel

java.lang.Object
  extended by org.cytoscape.util.swing.AbstractTreeTableModel
All Implemented Interfaces:
TreeModel, TreeTableModel

public abstract class AbstractTreeTableModel
extends Object
implements TreeTableModel

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

Author:
Philip Milne

Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

Field Summary
protected  EventListenerList listenerList
          The EventListenerList associated with this AbstractTreeTableModel.
 
Constructor Summary
AbstractTreeTableModel(Object root)
          Creates a new AbstractTreeTableModel object.
 
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 class of the column specified in the argument.
 int getIndexOfChild(Object parent, Object child)
          Returns the index of a child given a parent.
 Object getRoot()
          Returns the root of this AbstractTreeTableModel.
 boolean isCellEditable(Object node, int column)
          By default, make the column with the Tree in it the only editable one.
 boolean isLeaf(Object node)
          Returns true if the specified node is a leaf, false otherwise.
 void removeTreeModelListener(TreeModelListener l)
           
 void setValueAt(Object aValue, Object node, int column)
          Should be overridden - this is a no-op.
 void valueForPathChanged(TreePath path, Object newValue)
          Should be overridden.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.cytoscape.util.swing.TreeTableModel
getColumnCount, getColumnName, getValueAt
 
Methods inherited from interface javax.swing.tree.TreeModel
getChild, getChildCount
 

Field Detail

listenerList

protected EventListenerList listenerList
The EventListenerList associated with this AbstractTreeTableModel.

Constructor Detail

AbstractTreeTableModel

public AbstractTreeTableModel(Object root)
Creates a new AbstractTreeTableModel object.

Parameters:
root - The root of this AbstractTreeTableModel.
Method Detail

getRoot

public Object getRoot()
Returns the root of this AbstractTreeTableModel.

Specified by:
getRoot in interface TreeModel
Returns:
the root of this AbstractTreeTableModel.

isLeaf

public boolean isLeaf(Object node)
Returns true if the specified node is a leaf, false otherwise.

Specified by:
isLeaf in interface TreeModel
Parameters:
node - The node to check.
Returns:
True if the specified node is a leaf, false otherwise.

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Should be overridden.

Specified by:
valueForPathChanged in interface TreeModel
Parameters:
path - the TreePath.
newValue - the new value.

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Returns the index of a child given a parent.

Specified by:
getIndexOfChild in interface TreeModel
Parameters:
parent - The parent object.
child - The child whose index we want.
Returns:
The index of the child. -1 if the child isn't found.

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel
Parameters:
l - The TreeModelListener to add.

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel
Parameters:
l - The TreeModelListener to remove.

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.

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.

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.

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.

See Also:
EventListenerList

getColumnClass

public Class<?> getColumnClass(int column)
Returns the class of the column specified in the argument. Should probably be overridden since this implementation always returns Object.

Specified by:
getColumnClass in interface TreeTableModel
Parameters:
column - The index of the column.
Returns:
the class of the column specified in the argument.

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.

Specified by:
isCellEditable in interface TreeTableModel
Parameters:
node - The node to check.
column - The column number.
Returns:
True if editable, false otherwise.

setValueAt

public void setValueAt(Object aValue,
                       Object node,
                       int column)
Should be overridden - this is a no-op.

Specified by:
setValueAt in interface TreeTableModel
Parameters:
aValue - The value.
node - The node.
column - The column.

Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.