VdexReload 1.1.3 API

uk.ac.reload.dweezil.gui.treetable
Class TreeTableModelAdapter

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byuk.ac.reload.dweezil.gui.treetable.TreeTableModelAdapter
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class TreeTableModelAdapter
extends javax.swing.table.AbstractTableModel

This is a wrapper class takes a TreeTableModel and implements the table model interface. The implementation is trivial, with all of the event dispatching support provided by the superclass: the AbstractTableModel.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TreeTableModelAdapter(TreeTableModel treeTableModel, javax.swing.JTree tree)
          Constructor
 
Method Summary
protected  void delayedFireTableDataChanged()
          Invokes fireTableRowsUpdated after all the pending events have been processed.
 java.lang.Class getColumnClass(int column)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int column)
          Returns the name of the column at columnIndex.
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int row, int column)
          Returns the value for the cell at columnIndex and rowIndex.
 boolean isCellEditable(int row, int column)
          Determines if a specific cell is editable or not
protected  java.lang.Object nodeForRow(int row)
          Get the tree node for the given row index
 void setValueAt(java.lang.Object value, int row, int column)
          This empty implementation is provided so users don't have to implement this method if their data model is not editable.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeTableModelAdapter

public TreeTableModelAdapter(TreeTableModel treeTableModel,
                             javax.swing.JTree tree)
Constructor

Parameters:
treeTableModel - the TreeTableModel
tree - the JTree
Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A JTable uses this method to determine how many columns it should create and display by default.

Returns:
the number of columns in the model

getColumnName

public java.lang.String getColumnName(int column)
Returns the name of the column at columnIndex. This is used to initialize the table's column header name. Note: this name does not need to be unique; two columns in a table can have the same name.

Parameters:
column - the index of the column
Returns:
the name of the column

getColumnClass

public java.lang.Class getColumnClass(int column)
Returns the most specific superclass for all the cell values in the column. This is used by the JTable to set up a default renderer and editor for the column.

Parameters:
column - the index of the column
Returns:
the common ancestor class of the object values in the model

getRowCount

public int getRowCount()
Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.

Returns:
the number of rows in the model

nodeForRow

protected java.lang.Object nodeForRow(int row)
Get the tree node for the given row index

Parameters:
row - the index of the row
Returns:
the tree node at the end of the path

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the value for the cell at columnIndex and rowIndex.

Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the value Object at the specified cell

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Determines if a specific cell is editable or not

Parameters:
row - the row being queried
column - the column being queried
Returns:
true if the cell is editable, false otherwise

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
This empty implementation is provided so users don't have to implement this method if their data model is not editable.

Parameters:
value - value to assign to cell
row - row of cell
column - column of cell

delayedFireTableDataChanged

protected void delayedFireTableDataChanged()
Invokes fireTableRowsUpdated after all the pending events have been processed. SwingUtilities.invokeLater is used to handle this. Changed by PB This stops deselection See http://forum.java.sun.com/thread.jsp?forum=57&thread=223661 May have to do this: "After a bit more investigation, overriding the following JTable method in JTreeTable, resolves the painting issues that my last post refers to." public void tableChanged(TableModelEvent e) { revalidate(); super.tableChanged(e); }


VdexReload 1.1.3 API