org.apache.jorphan.gui

Class AbstractTreeTableModel

Implemented Interfaces:
TableModel, TreeTableModel
Known Direct Subclasses:
DefaultTreeTableModel

public abstract class AbstractTreeTableModel
extends DefaultTableModel
implements TreeTableModel

Field Summary

protected ArrayList
classes
protected List
headers
protected EventListenerList
listener
protected ArrayList
objects
protected ArrayList
readFunctors
protected TreeNode
rootNode
protected ArrayList
writeFunctors

Constructor Summary

AbstractTreeTableModel(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class[] editorClasses)
AbstractTreeTableModel(TreeNode root)
AbstractTreeTableModel(TreeNode root, boolean editable)

Method Summary

void
addTableModelListener(TableModelListener l)
void
clearData()
void
fireTreeNodesChanged(TreeNode source, Object[] path, int[] indexes, Object[] children)
Object
getChild(Object parent, int index)
int
getChildCount(Object parent)
Class
getColumnClass(int arg0)
int
getColumnCount()
The implementation is exactly the same as ObjectTableModel.getColumnCount.
String
getColumnName(int columnIndex)
Object
getRootNode()
The root node for the TreeTable
int
getRowCount()
The implementation is exactly the same as ObjectTableModel.getRowCount.
Object
getValueAt(Object node, int col)
Object
getValueAt(int rowIndex, int columnIndex)
Subclasses need to implement the logic for the method and return the value at the specific cell.
boolean
isCellEditable(Object node, int col)
boolean
isCellEditable(int rowIndex, int columnIndex)
By default the abstract class returns true.
boolean
isLeaf(Object node)
the implementation checks if the Object is a treenode.
void
nodeStructureChanged(TreeNode node)
void
removeTableModelListener(TableModelListener l)
void
setValueAt(Object val, Object node, int column)
void
setValueAt(Object aValue, int rowIndex, int columnIndex)

Field Details

classes

protected ArrayList classes

headers

protected List headers

listener

protected EventListenerList listener

objects

protected ArrayList objects

readFunctors

protected ArrayList readFunctors

rootNode

protected TreeNode rootNode

writeFunctors

protected ArrayList writeFunctors

Constructor Details

AbstractTreeTableModel

public AbstractTreeTableModel(String[] headers,
                              Functor[] readFunctors,
                              Functor[] writeFunctors,
                              Class[] editorClasses)

AbstractTreeTableModel

public AbstractTreeTableModel(TreeNode root)

AbstractTreeTableModel

public AbstractTreeTableModel(TreeNode root,
                              boolean editable)

Method Details

addTableModelListener

public void addTableModelListener(TableModelListener l)

clearData

public void clearData()

fireTreeNodesChanged

public void fireTreeNodesChanged(TreeNode source,
                                 Object[] path,
                                 int[] indexes,
                                 Object[] children)

getChild

public Object getChild(Object parent,
                       int index)

getChildCount

public int getChildCount(Object parent)

getColumnClass

public Class getColumnClass(int arg0)

getColumnCount

public int getColumnCount()
The implementation is exactly the same as ObjectTableModel.getColumnCount.

getColumnName

public String getColumnName(int columnIndex)

getRootNode

public Object getRootNode()
The root node for the TreeTable
Returns:
the root node

getRowCount

public int getRowCount()
The implementation is exactly the same as ObjectTableModel.getRowCount.

getValueAt

public Object getValueAt(Object node,
                         int col)
Specified by:
getValueAt in interface TreeTableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Subclasses need to implement the logic for the method and return the value at the specific cell.

isCellEditable

public boolean isCellEditable(Object node,
                              int col)
Specified by:
isCellEditable in interface TreeTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
By default the abstract class returns true. It is up to subclasses to override the implementation.

isLeaf

public boolean isLeaf(Object node)
the implementation checks if the Object is a treenode. If it is, it returns isLeaf(), otherwise it returns false.
Parameters:
node -
Returns:
whether object is a leaf node or not

nodeStructureChanged

public void nodeStructureChanged(TreeNode node)

removeTableModelListener

public void removeTableModelListener(TableModelListener l)

setValueAt

public void setValueAt(Object val,
                       Object node,
                       int column)
Specified by:
setValueAt in interface TreeTableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.