Package org.cytoscape.util.swing
Class AbstractTreeTableModel
- java.lang.Object
-
- 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
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>
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
Fields Modifier and Type Field Description protected EventListenerList
listenerList
TheEventListenerList
associated with this AbstractTreeTableModel.
-
Constructor Summary
Constructors Constructor Description AbstractTreeTableModel(Object root)
Creates a new AbstractTreeTableModel object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 javax.swing.tree.TreeModel
getChild, getChildCount
-
Methods inherited from interface org.cytoscape.util.swing.TreeTableModel
getColumnCount, getColumnName, getValueAt
-
-
-
-
Field Detail
-
listenerList
protected EventListenerList listenerList
TheEventListenerList
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.
-
isLeaf
public boolean isLeaf(Object node)
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 interfaceTreeModel
- 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 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
public void addTreeModelListener(TreeModelListener l)
- Specified by:
addTreeModelListener
in interfaceTreeModel
- Parameters:
l
- The TreeModelListener to add.
-
removeTreeModelListener
public void removeTreeModelListener(TreeModelListener l)
- 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
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 interfaceTreeTableModel
- 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 interfaceTreeTableModel
- 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 interfaceTreeTableModel
- Parameters:
aValue
- The value.node
- The node.column
- The column.
-
-