TreeTableModelAdapter

Top  Previous  Next

 

TreeTable's table model is a TreeTableModelAdapter which interfaces between a TableModel and a TreeTableModel. TreeTable shares the JTree that is painted on the first column of the table, with this TreeTableModelAdapter.

 

TreeTableModel has no knowledge of row indexes, but of object nodes. The actual row index in the table is converted by TreeTableModelAdapter to a tree node. TreeTableModelAdapter retrieves the tree node with:

 

public Object nodeForRow(int rowIndex);

 

and calls TreeTableModel's corresponding method.

 

The table below shows the conversion that takes place for the TableModel's methods that concern a row index.

 

TreeTableModelAdapter method

TreeTableModel method

getValueAt(int row, int column)

getValueAt(Object node, int column)

isCellEditable(int row, int column)

isCellEditable(Object node, int column)

setValueAt(Object value, int row, int column)

setValueAt(Object value, Object node, int column)