public class ReadOnlyPropertyTableModel
extends javax.swing.table.AbstractTableModel
It considers the object's public fields and public parameters plus non-void getXXX() and
boolean isXXX() methods as defining properties. You can hide such a field or a method from
being used by marking it with the PropertyHide
annotation.
You can change the automatically created name by marking it with the PropertyName
annotation.
It uses reflection to access the properties, so it might fail in restricted environments.
Modifier and Type | Field and Description |
---|---|
static int |
COLUMN_INDEX_NAME
The column index of the property name.
|
static int |
COLUMN_INDEX_VALUE
The column index of the property value.
|
Constructor and Description |
---|
ReadOnlyPropertyTableModel(java.lang.Object object)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getColumnCount()
Returns the number of columns in the model.
|
java.lang.String |
getColumnName(int column)
Returns the name for a column.
|
int |
getRowCount()
Returns the number of rows in the model.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns false.
|
void |
update()
Update the model.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
public static final int COLUMN_INDEX_NAME
public static final int COLUMN_INDEX_VALUE
public ReadOnlyPropertyTableModel(@Nullable java.lang.Object object)
object
- object to handlepublic int getRowCount()
JTable
uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.getColumnCount()
public int getColumnCount()
JTable
uses this method to determine how many columns it
should create and display by default.getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queriedpublic boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
rowIndex
- the row being queriedcolumnIndex
- the column being queriedpublic java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column being queriedcolumn
public void update()