public class BeanTableModel extends AbstractTableModel
java.beans
package any cleverer stuff
held in BeanInfos will get used as well/instead.
What a neat idea!listenerList
Constructor and Description |
---|
BeanTableModel(Class<?> clazz)
Constructs a new table model for displaying beans of a given class.
|
Modifier and Type | Method and Description |
---|---|
Class<?> |
getColumnClass(int icol) |
int |
getColumnCount() |
String |
getColumnName(int icol) |
Object[] |
getData()
Returns the array of objects which this model displays, one per row.
|
int |
getRowCount() |
Object |
getValueAt(int irow,
int icol) |
boolean |
isCellEditable(int irow,
int icol) |
Comparator<?> |
propertySorter(String propertyName)
Returns a sorter which can be used to sort rows of this table
(data array elements).
|
void |
setData(Object[] data)
Populates this model with items.
|
void |
setValueAt(Object value,
int irow,
int icol) |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
public BeanTableModel(Class<?> clazz) throws IntrospectionException
clazz
- class of items which will be displayed in this tableIntrospectionException
public void setData(Object[] data)
data
- array of items, one for each row. This array's
runtime type must match that for which this model was
constructed (on pain of ClassCastException)public Object[] getData()
public Comparator<?> propertySorter(String propertyName)
propertyName
- name of readable bean property to sort onpropertyName
, or
null if propertyName
does not name a suitable
propertypublic String getColumnName(int icol)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Class<?> getColumnClass(int icol)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
public int getColumnCount()
public int getRowCount()
public Object getValueAt(int irow, int icol)
public boolean isCellEditable(int irow, int icol)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public void setValueAt(Object value, int irow, int icol)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.