# Class AbstractTreeTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
javax.swing.table.DefaultTableModel
org.apache.jorphan.gui.AbstractTreeTableModel

All Implemented Interfaces:
  `Serializable, TableModel, TreeTableModel`

Direct Known Subclasses:
  `DefaultTreeTableModel`

public abstract class AbstractTreeTableModel extends DefaultTableModel implements TreeTableModel

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final List<Class<?>>`
`classes`
`protected final List<String>`
`headers`
`protected final EventListenerList`
`listener`
`protected final List<Object>`
`objects`
`protected final List<Functor>`
`readFunctors`
`protected final TreeNode`
`rootNode`
`protected final List<Functor>`
`writeFunctors`

### Fields inherited from class DefaultTableModel

`columnIdentifiers, dataVector`

### Fields inherited from class AbstractTableModel

`listenerList`

## Constructor Summary

Constructors
Constructor
Description
`AbstractTreeTableModel(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses)`
`AbstractTreeTableModel(TreeNode root)`

## Method Summary

Modifier and Type
Method
Description
`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(int rowIndex, int columnIndex)`
Subclasses need to implement the logic for the method and return the value at the specific cell.
`Object`
`getValueAt(Object node, int col)`
The method is similar to getValueAt(int,int).
`boolean`
`isCellEditable(int rowIndex, int columnIndex)`
By default the abstract class returns true.
`boolean`
`isCellEditable(Object node, int col)`
the method is similar to isCellEditable(int,int).
`boolean`
`isLeaf(Object node)`
the implementation checks if the Object is a treenode.
`void`
`nodeStructureChanged(TreeNode node)`
`void`
`removeTableModelListener(TableModelListener l)`
`void`
`setValueAt(Object aValue, int rowIndex, int columnIndex)`
`void`
`setValueAt(Object val, Object node, int column)`
the method is similar to isCellEditable(int,int).

### Methods inherited from class DefaultTableModel

`addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount`

### Methods inherited from class AbstractTableModel

`findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### rootNode

protected final TreeNode rootNode

### listener

protected final EventListenerList listener

### objects

protected final transient List<Object> objects

### headers

protected final transient List<String> headers

### classes

protected final transient List<Class<?>> classes

### readFunctors

protected final transient List<Functor> readFunctors

### writeFunctors

protected final transient List<Functor> writeFunctors

## Constructor Details

### AbstractTreeTableModel

public AbstractTreeTableModel(TreeNode root)

### AbstractTreeTableModel

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

## Method Details

### getRootNode

public Object getRootNode()
The root node for the TreeTable

Returns:
  the root node

### getValueAt

public Object getValueAt(Object node, int col)
The method is similar to getValueAt(int,int). Instead of int, the row is an object.

Specified by:
  `getValueAt` in interface `TreeTableModel`
Parameters:
  `node` - the node which value is to be fetched
  `col` - the column of the node
Returns:
  the value at the column

### isCellEditable

public boolean isCellEditable(Object node, int col)
the method is similar to isCellEditable(int,int). Instead of int, the row is an object.

Specified by:
  `isCellEditable` in interface `TreeTableModel`
Parameters:
  `node` - the node which value is to be fetched
  `col` - the column of the node
Returns:
  `true` if cell is editable

### setValueAt

public void setValueAt(Object val, Object node, int column)
the method is similar to isCellEditable(int,int). Instead of int, the row is an object.

Specified by:
  `setValueAt` in interface `TreeTableModel`
Parameters:
  `val` - the value to be set
  `node` - the node which value is to be set
  `column` - the column of the node

### getColumnCount

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

Specified by:
  `getColumnCount` in interface `TableModel`
Overrides:
  `getColumnCount` in class `DefaultTableModel`

### getRowCount

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

Specified by:
  `getRowCount` in interface `TableModel`
Overrides:
  `getRowCount` in class `DefaultTableModel`

### isCellEditable

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

Specified by:
  `isCellEditable` in interface `TableModel`
Overrides:
  `isCellEditable` in class `DefaultTableModel`

### getColumnClass

public Class<?> getColumnClass(int arg0)

Specified by:
  `getColumnClass` in interface `TableModel`
Overrides:
  `getColumnClass` in class `AbstractTableModel`

### 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.

Specified by:
  `getValueAt` in interface `TableModel`
Overrides:
  `getValueAt` in class `DefaultTableModel`

### setValueAt

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

Specified by:
  `setValueAt` in interface `TableModel`
Overrides:
  `setValueAt` in class `DefaultTableModel`

### getColumnName

public String getColumnName(int columnIndex)

Specified by:
  `getColumnName` in interface `TableModel`
Overrides:
  `getColumnName` in class `DefaultTableModel`

### getChildCount

public int getChildCount(Object parent)

### getChild

public Object getChild(Object parent, int index)

### 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` - object to be checked for `isLeaf()`
Returns:
  `true` if object is a leaf node, `false` otherwise

### addTableModelListener

public void addTableModelListener(TableModelListener l)

Specified by:
  `addTableModelListener` in interface `TableModel`
Overrides:
  `addTableModelListener` in class `AbstractTableModel`

### removeTableModelListener

public void removeTableModelListener(TableModelListener l)

Specified by:
  `removeTableModelListener` in interface `TableModel`
Overrides:
  `removeTableModelListener` in class `AbstractTableModel`

### nodeStructureChanged

public void nodeStructureChanged(TreeNode node)

### fireTreeNodesChanged

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

### clearData

public void clearData()