be.ugent.caagt.swirl.tables

Class EnhancedTable


public class EnhancedTable
extends JTable

Table component which allows table column headers to be decorated with small icons and buttons, i.e., objects of type TableColumnDecoration. Typical usage is as follows: The actual column headers are decorated with clones of the given prototypes and each clone is initialized with the corresponding column index. The choice of prototype is determined from the column class (as determined by the model), or if no prototype was registered for a particular class, from a default prototype registered with the table.

Constructor Summary

EnhancedTable()
Default constructor

Method Summary

void
addPrototypeDecoration(Class clazz, TableColumnDecoration decoration)
Add a prototype decoration for a given column class.
void
addPrototypeDecoration(TableColumnDecoration decoration)
Add a prototype decoration for default columns, i.e., columns with a column class for which no decorations were registered.
protected JTableHeader
createDefaultTableHeader()
List
getDecorations(int modelIndex)
Return the list of decorations for the given column.
void
tableChanged(TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent.

Constructor Details

EnhancedTable

public EnhancedTable()
Default constructor

Method Details

addPrototypeDecoration

public void addPrototypeDecoration(Class clazz,
                                   TableColumnDecoration decoration)
Add a prototype decoration for a given column class. Every column of this class will obtain a clone of this prototype.

addPrototypeDecoration

public void addPrototypeDecoration(TableColumnDecoration decoration)
Add a prototype decoration for default columns, i.e., columns with a column class for which no decorations were registered.

createDefaultTableHeader

protected JTableHeader createDefaultTableHeader()

getDecorations

public List getDecorations(int modelIndex)
Return the list of decorations for the given column.
Parameters:
modelIndex - model index of the column
Returns:
the list of decorations or null when the list is empty.

tableChanged

public void tableChanged(TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. In addition to the standard behaviour, this implementation also (re)initializes the column decorations.

Should not be called by application code. For internal use only.