|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractTableModel
ListTableModel<CategoryRecord>
CategoryTable
public class CategoryTable
An editable table model for a list of Category items. Instances of this class
are typically created as below:
The default implementation provides the following columns (implementors can subclass this model if they want to provides additional columns):GridSampleDimension band = ...; CategoryTable model = new CategoryTable(Locale.FRENCH); model.setCategories(band.getCategories()); JTable table = ...; model.configure(table);
Some of the above-cited columns are inter-dependents. For example if the value of the offset or scale factor is modified, then the minimal and maximal geophysics values will be automatically recomputed. Or conversely, if the minimal or maximal geophysics values is modified, then the offset and scale factors will be recomputed.
| display/geotk-widgets-swing (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class ListTableModel |
|---|
elements |
| Fields inherited from class AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
CategoryTable(CategoryTable table)
Creates a new table initialized to the value of the given table. |
|
CategoryTable(Locale locale)
Creates a new, initially empty, table. |
|
| Method Summary | |
|---|---|
void |
configure(JTable table)
Configures the given JTable for use with this model. |
List<Category> |
getCategories()
Returns all categories currently defined in this table. |
Class<?> |
getColumnClass(int column)
Returns the type of the given column. |
int |
getColumnCount()
Returns the number of columns in the table. |
String |
getColumnName(int column)
Returns the name of the given column. |
Object |
getValueAt(int row,
int column)
Returns the value in the given cell. |
boolean |
isCellEditable(int row,
int column)
Returns true if the given cell is editable. |
boolean |
isEditable()
Returns true if this table is editable. |
void |
setCategories(List<Category> categories)
Sets the categories to be shown in the table. |
void |
setEditable(boolean editable)
Sets whatever edition should be allowed for any cell in this table. |
void |
setValueAt(Object value,
int row,
int column)
Sets the value in the given cell. |
| Methods inherited from class ListTableModel |
|---|
add, getElements, getElements, getElements, getRowCount, insert, remove, remove, removeDuplicates, setElements, sort |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CategoryTable(Locale locale)
locale - The locale to use for the column headers.public CategoryTable(CategoryTable table)
table - The table from which to copy the rows.| Method Detail |
|---|
public List<Category> getCategories()
CategoryRecord.getCategory() for each element returned by
ListTableModel.getElements().
public void setCategories(List<Category> categories)
CategoryRecords.
Alternatively, user can create CategoryRecord themself and invoke one of the
add or insert methods directly.
categories - The categories to show, or null for clearing the table.public int getColumnCount()
public String getColumnName(int column)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - The index of the column being queried.
public Class<?> getColumnClass(int column)
String, Integer, Double, TransferFunctionType or
Object depending on the argument value.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumn - The index of the column being queried.
public Object getValueAt(int row,
int column)
row - The index of the row being queried.column - The index of the column being queried.
null if none.
public void setValueAt(Object value,
int row,
int column)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelvalue - The new value.row - The index of the row being modified.column - The index of the column being modified.
public boolean isCellEditable(int row,
int column)
true if the given cell is editable. The default implementation
returns the same value than isEditable() for every cells.
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrow - The index of the row being queried.column - The index of the column being queried.
true if the given cell is editable.public boolean isEditable()
true if this table is editable.
Every CategoryTable instances are editable by default.
true if this table is editable.public void setEditable(boolean editable)
editable - false for disabling edition, or true for re-enabling it.public void configure(JTable table)
JTable for use with this model. This method performs
the following steps:
table - The table in which to install the cell renderer and editors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||