Package jadex.commons.gui.jtreetable
Class AbstractTreeTableModel
- java.lang.Object
-
- jadex.commons.gui.jtreetable.AbstractTreeTableModel
-
- All Implemented Interfaces:
TreeTableModel
,javax.swing.tree.TreeModel
- Direct Known Subclasses:
DefaultTreeTableModel
,DynamicTreeTableModel
public abstract class AbstractTreeTableModel extends java.lang.Object implements TreeTableModel
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.event.EventListenerList
listenerList
protected java.lang.Object
root
-
Constructor Summary
Constructors Constructor Description AbstractTreeTableModel(java.lang.Object root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTreeModelListener(javax.swing.event.TreeModelListener l)
protected void
fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void
fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void
fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void
fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
java.lang.Class
getColumnClass(int column)
Returns the type for column numbercolumn
.int
getIndexOfChild(java.lang.Object parent, java.lang.Object child)
javax.swing.tree.TreeNode[]
getPathToRoot(javax.swing.tree.TreeNode aNode)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.protected javax.swing.tree.TreeNode[]
getPathToRoot(javax.swing.tree.TreeNode aNode, int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.java.lang.Object
getRoot()
boolean
isCellEditable(java.lang.Object node, int column)
By default, make the column with the Tree in it the only editable one.boolean
isLeaf(java.lang.Object node)
void
reload(javax.swing.tree.TreeNode node)
Invoke this method if you've modified theTreeNode
s upon which this model depends.void
removeTreeModelListener(javax.swing.event.TreeModelListener l)
void
setValueAt(java.lang.Object aValue, java.lang.Object node, int column)
Sets the value for nodenode
, at column numbercolumn
.void
valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jadex.commons.gui.jtreetable.TreeTableModel
getColumnCount, getColumnName, getValueAt
-
-
-
-
Method Detail
-
getRoot
public java.lang.Object getRoot()
- Specified by:
getRoot
in interfacejavax.swing.tree.TreeModel
-
isLeaf
public boolean isLeaf(java.lang.Object node)
- Specified by:
isLeaf
in interfacejavax.swing.tree.TreeModel
-
valueForPathChanged
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
- Specified by:
valueForPathChanged
in interfacejavax.swing.tree.TreeModel
-
getIndexOfChild
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
- Specified by:
getIndexOfChild
in interfacejavax.swing.tree.TreeModel
-
addTreeModelListener
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
- Specified by:
addTreeModelListener
in interfacejavax.swing.tree.TreeModel
-
removeTreeModelListener
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
- Specified by:
removeTreeModelListener
in interfacejavax.swing.tree.TreeModel
-
reload
public void reload(javax.swing.tree.TreeNode node)
Invoke this method if you've modified theTreeNode
s upon which this model depends. The model will notify all of its listeners that the model has changed below the given node.- Parameters:
node
- the node below which the model has changed
-
getPathToRoot
public javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. The length of the returned array gives the node's depth in the tree.- Parameters:
aNode
- the TreeNode to get the path for
-
getPathToRoot
protected javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode, int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. The length of the returned array gives the node's depth in the tree.- Parameters:
aNode
- the TreeNode to get the path fordepth
- an int giving the number of steps already taken towards the root (on recursive calls), used to size the returned array- Returns:
- an array of TreeNodes giving the path from the root to the specified node
-
fireTreeNodesChanged
protected void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
-
fireTreeNodesInserted
protected void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
-
fireTreeNodesRemoved
protected void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
-
fireTreeStructureChanged
protected void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
-
getColumnClass
public java.lang.Class getColumnClass(int column)
Description copied from interface:TreeTableModel
Returns the type for column numbercolumn
.- Specified by:
getColumnClass
in interfaceTreeTableModel
-
isCellEditable
public boolean isCellEditable(java.lang.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
-
setValueAt
public void setValueAt(java.lang.Object aValue, java.lang.Object node, int column)
Description copied from interface:TreeTableModel
Sets the value for nodenode
, at column numbercolumn
.- Specified by:
setValueAt
in interfaceTreeTableModel
-
-