Package org.cytoscape.util.swing
Class AbstractTreeTableModel
java.lang.Object
org.cytoscape.util.swing.AbstractTreeTableModel
- All Implemented Interfaces:
TreeModel
,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.
Module: swing-util-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>swing-util-api</artifactId> </dependency>
-
Field Summary
Modifier and TypeFieldDescriptionprotected EventListenerList
TheEventListenerList
associated with this AbstractTreeTableModel. -
Constructor Summary
ConstructorDescriptionAbstractTreeTableModel(Object root)
Creates a new AbstractTreeTableModel object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.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
Returns true if the specified node is a leaf, false otherwise.void
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 javax.swing.tree.TreeModel
getChild, getChildCount
Methods inherited from interface org.cytoscape.util.swing.TreeTableModel
getColumnCount, getColumnName, getValueAt
-
Field Details
-
listenerList
TheEventListenerList
associated with this AbstractTreeTableModel.
-
-
Constructor Details
-
AbstractTreeTableModel
Creates a new AbstractTreeTableModel object.- Parameters:
root
- The root of this AbstractTreeTableModel.
-
-
Method Details
-
getRoot
Returns the root of this AbstractTreeTableModel. -
isLeaf
Returns true if the specified node is a leaf, false otherwise. -
valueForPathChanged
Should be overridden.- Specified by:
valueForPathChanged
in interfaceTreeModel
- Parameters:
path
- the TreePath.newValue
- the new value.
-
getIndexOfChild
Returns the index of a child given a parent.- Specified by:
getIndexOfChild
in interfaceTreeModel
- 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
- Specified by:
addTreeModelListener
in interfaceTreeModel
- Parameters:
l
- The TreeModelListener to add.
-
removeTreeModelListener
- Specified by:
removeTreeModelListener
in interfaceTreeModel
- 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
Returns the class of the column specified in the argument. Should probably be overridden since this implementation always returns Object.- Specified by:
getColumnClass
in interfaceTreeTableModel
- Parameters:
column
- The index of the column.- Returns:
- the class of the column specified in the argument.
-
isCellEditable
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 interfaceTreeTableModel
- Parameters:
node
- The node to check.column
- The column number.- Returns:
- True if editable, false otherwise.
-
setValueAt
Should be overridden - this is a no-op.- Specified by:
setValueAt
in interfaceTreeTableModel
- Parameters:
aValue
- The value.node
- The node.column
- The column.
-