org.tigris.swidgets

Class PropertyTable


public class PropertyTable
extends JTable

A table of editable properties. Each row contains a single property, where the first column is the property name and the second column is the editable value. PropertyTable will attempt to use an editor that is appropriate for the value type of each Property. This includes support for using checkboxes for Booleans and Combo Boxes for arrays of choices.
Author:
Jeremy Jones

Constructor Summary

PropertyTable(Property[] p)
Creates a new PropertyTable for the specified set of Properties.
PropertyTable(Property[] p, String nct, String vct)
Creates a new PropertyTable for the specified set of Properties.

Method Summary

TableCellEditor
getCellEditor(int row, int column)
Overridden to return the appropriate cell editor for the property at the specified row.
TableCellRenderer
getCellRenderer(int row, int column)
Overridden to return the appropriate cell renderer for the property value if the cell is in the value column, otherwise returns the default renderer.

Constructor Details

PropertyTable

public PropertyTable(Property[] p)
Creates a new PropertyTable for the specified set of Properties.
Parameters:
p - set of properties to display in the table

PropertyTable

public PropertyTable(Property[] p,
                     String nct,
                     String vct)
Creates a new PropertyTable for the specified set of Properties.
Parameters:
p - set of properties to display in the table
nct - title to be displayed in the first column header
vct - title to be displayed in the second column header

Method Details

getCellEditor

public TableCellEditor getCellEditor(int row,
                                     int column)
Overridden to return the appropriate cell editor for the property at the specified row. Returns null if column is not the value column.
Parameters:
row - the row of the cell to edit
column - the column of the cell to edit
Returns:
the editor for this cell

getCellRenderer

public TableCellRenderer getCellRenderer(int row,
                                         int column)
Overridden to return the appropriate cell renderer for the property value if the cell is in the value column, otherwise returns the default renderer.
Parameters:
row - the row of the cell to render
column - the column of the cell to render
Returns:
the renderer for this cell