public class KeyValueTableModel<RecordType>
extends javax.swing.table.AbstractTableModel
Modifier and Type | Field and Description |
---|---|
protected KeyValueAdaptor |
KEY_VALUE_ADAPTOR
key value adaptor to get the value from a record (row) for the specified key path (column property)
|
Constructor and Description |
---|
KeyValueTableModel()
Empty Constructor
|
KeyValueTableModel(java.util.List<RecordType> records,
java.lang.String... keyPaths)
Primary Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyValueRecordListener(KeyValueRecordListener<? extends KeyValueTableModel<RecordType>,RecordType> listener)
Add the specified listener as a receiver of record modification events from this instance.
|
java.lang.Class<?> |
getColumnClass(int column)
Get the data class for the specified column
|
int |
getColumnCount()
Get the number of columns to display
|
int |
getColumnForKeyPath(java.lang.String keyPath)
Get the model column for the specified key path
|
java.lang.String |
getColumnName(int column)
Get the name of the specified column
|
java.lang.String |
getKeyPathForColumn(int column)
Get the key path for the specified model column
|
RecordType |
getRecordAtRow(int row)
Get the record at the specified row index
|
int |
getRowCount()
Get the number of rows to display
|
java.util.List<RecordType> |
getRowRecords()
Get the records indexed by row
|
java.lang.Object |
getValueAt(int row,
int column)
get the value for the specified cell
|
boolean |
isCellEditable(int row,
int column)
Determine whether the cell is editable
|
void |
removeKeyValueRecordListener(KeyValueRecordListener<KeyValueTableModel<RecordType>,RecordType> listener)
Remove the specified listener from receiving record modification events from this instance.
|
void |
setColumnClass(java.lang.String keyPath,
java.lang.Class<?> columnClass)
Set the column class for the specified column
|
void |
setColumnClassForKeyPaths(java.lang.Class<?> columnClass,
java.lang.String... keyPaths)
Set the column class for the columns specified by the key paths
|
void |
setColumnEditable(java.lang.String keyPath,
boolean allowsEdit)
Set whether the column associated with the specified key path is editable
|
void |
setColumnEditKeyPath(java.lang.String columnKeyPath,
java.lang.String editKeyPath)
Set whether a cell associated with the specified column key path is editable based on the cell's record value corresponding to the specified edit key path
|
void |
setColumnEditKeyPath(java.lang.String columnKeyPath,
java.lang.String editKeyPath,
boolean negation)
Set whether a cell associated with the specified column key path is editable based on the cell's record value corresponding to the specified edit key path
|
void |
setColumnName(java.lang.String keyPath,
java.lang.String name)
Set the name of the specified column
|
void |
setDataSource(java.util.List<RecordType> records,
java.lang.String... keyPaths)
Set the records (row) and key paths (column accessors)
|
void |
setKeyPaths(java.lang.String... keyPaths)
Set the key paths (column accessors)
|
void |
setRecords(java.util.List<RecordType> records)
Set the records (row)
|
void |
setValueAt(java.lang.Object value,
int row,
int column)
Set the value of the specified cell
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
protected final KeyValueAdaptor KEY_VALUE_ADAPTOR
public KeyValueTableModel(java.util.List<RecordType> records, java.lang.String... keyPaths)
records
- the list of objects (one record for each table row)keyPaths
- specifies the array of key paths to get the data to display (one key path for each column)public KeyValueTableModel()
public void addKeyValueRecordListener(KeyValueRecordListener<? extends KeyValueTableModel<RecordType>,RecordType> listener)
listener
- object to receive eventspublic void removeKeyValueRecordListener(KeyValueRecordListener<KeyValueTableModel<RecordType>,RecordType> listener)
listener
- object to be removed from receiving eventspublic void setDataSource(java.util.List<RecordType> records, java.lang.String... keyPaths)
records
- the list of objects (one record for each table row)keyPaths
- specifies the array of key paths to get the data to display (one key path for each column)public RecordType getRecordAtRow(int row)
public java.util.List<RecordType> getRowRecords()
public void setRecords(java.util.List<RecordType> records)
records
- the list of objects (one record for each table row)public java.lang.String getKeyPathForColumn(int column)
column
- model column for which to get the key pathpublic int getColumnForKeyPath(java.lang.String keyPath)
keyPath
- key path to the specified columnpublic void setKeyPaths(java.lang.String... keyPaths)
keyPaths
- specifies the array of key paths to get the data to display (one key path for each column)public void setColumnName(java.lang.String keyPath, java.lang.String name)
keyPath
- key path for which to assign the namename
- the new name to assign the columnpublic java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
public void setColumnClass(java.lang.String keyPath, java.lang.Class<?> columnClass)
keyPath
- key path for which to assign the classcolumnClass
- the new class to assign the columnpublic void setColumnClassForKeyPaths(java.lang.Class<?> columnClass, java.lang.String... keyPaths)
columnClass
- the new class to assign the columnkeyPaths
- key paths for which to assign the classpublic java.lang.Class<?> getColumnClass(int column)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
public int getRowCount()
public int getColumnCount()
public void setColumnEditable(java.lang.String keyPath, boolean allowsEdit)
public void setColumnEditKeyPath(java.lang.String columnKeyPath, java.lang.String editKeyPath)
columnKeyPath
- key path of the column for which the edit rule applieseditKeyPath
- key path (applied to the row's record) whose corresponding value determines whether the cell (of the row's record) is editablepublic void setColumnEditKeyPath(java.lang.String columnKeyPath, java.lang.String editKeyPath, boolean negation)
columnKeyPath
- key path of the column for which the edit rule applieseditKeyPath
- key path (applied to the row's record) whose corresponding value determines whether the cell (of the row's record) is editablenegation
- indicates whether to reverse the boolean indication of the edit columnpublic boolean isCellEditable(int row, int column)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
public java.lang.Object getValueAt(int row, int column)
public void setValueAt(java.lang.Object value, int row, int column)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel