public class SortableTableModel extends AbstractTableModel
| Constructor and Description |
|---|
SortableTableModel(int column,
boolean asc,
TableModel model,
Comparator cmp)
Sorts a table based on the given column
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataChangeListener(DataChangedListener d)
Adds a listener to the data changed event
|
Class |
getCellType(int row,
int column)
Allows the table to hint the class type of a specific cell
|
int |
getColumnCount()
Returns the number of columns in the table
|
String |
getColumnName(int i)
Returns the name of the column at the given offset
|
String[] |
getMultipleChoiceOptions(int row,
int column)
Allows the table cell to feature multiple choice for a specific entry
|
int |
getRowCount()
Returns the number of rows in the table
|
int |
getSortedPosition(int row)
Returns the position of the row when sorted
|
TableModel |
getUnderlying()
Returns the underlying table model
|
Constraint |
getValidationConstraint(int row,
int column)
If the cell has a validation constraint it's returned here
|
Validator |
getValidator()
A validator can be defined here so a validation constraint can bind to a table model cell
|
Object |
getValueAt(int row,
int column)
Returns the value of the cell at the given location
|
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at the given location is an editable cell
|
void |
removeDataChangeListener(DataChangedListener d)
Removes a listener to the data changed event
|
void |
setValidator(Validator validator)
A validator can be defined here so a validation constraint can bind to a table model cell
|
void |
setValueAt(int row,
int column,
Object o)
Sets the value of the cell at the given location
|
public SortableTableModel(int column,
boolean asc,
TableModel model,
Comparator cmp)
column - the column to sortasc - the direction ascending/descendingmodel - the underlying model that will be sortedcmp - a comparator used for comparing the cells in the columnpublic TableModel getUnderlying()
public int getSortedPosition(int row)
row - the row in the visual tablepublic int getRowCount()
public int getColumnCount()
public String getColumnName(int i)
i - the offset for the column namepublic boolean isCellEditable(int row,
int column)
row - the cell rowcolumn - the cell columnpublic Object getValueAt(int row, int column)
row - the cell rowcolumn - the cell columnpublic void setValueAt(int row,
int column,
Object o)
row - the cell rowcolumn - the cell columno - the value of the cell at the given locationpublic void addDataChangeListener(DataChangedListener d)
d - the new listenerpublic void removeDataChangeListener(DataChangedListener d)
d - the listener to removepublic Constraint getValidationConstraint(int row, int column)
getValidationConstraint in class AbstractTableModelrow - the rowcolumn - the column for the cellpublic Class getCellType(int row, int column)
getCellType in class AbstractTableModelrow - the row in the tablecolumn - the columnpublic String[] getMultipleChoiceOptions(int row, int column)
getMultipleChoiceOptions in class AbstractTableModelrow - the row in the tablecolumn - the columnpublic void setValidator(Validator validator)
AbstractTableModelsetValidator in class AbstractTableModelvalidator - the validator to setpublic Validator getValidator()
AbstractTableModelgetValidator in class AbstractTableModel