Package org.apache.jorphan.gui
Class ObjectTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
javax.swing.table.DefaultTableModel
org.apache.jorphan.gui.ObjectTableModel
- All Implemented Interfaces:
Serializable
,TableModel
The ObjectTableModel is a TableModel whose rows are objects;
columns are defined as Functors on the object.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorDescriptionObjectTableModel
(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.ObjectTableModel
(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses, boolean cellEditable) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.ObjectTableModel
(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
checkFunctors
(Object _value, Class<?> caller) Check all registered functors.void
Class<?>
getColumnClass
(int arg0) int
getColumnName
(int col) Returns Object (List of Object).Returns List of Object.int
getValueAt
(int row, int col) void
boolean
isCellEditable
(int arg0, int arg1) Iterator<?>
iterator()
void
moveRow
(int start, int end, int to) void
removeRow
(int row) void
void
setValueAt
(Object cellValue, int row, int col) Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, newDataAvailable, newRowsAdded, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Constructor Details
-
ObjectTableModel
public ObjectTableModel(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.- Parameters:
headers
- - Column names_objClass
- - Object class that will be usedreadFunctors
- - used to get the valueswriteFunctors
- - used to set the valueseditorClasses
- - class for each column
-
ObjectTableModel
public ObjectTableModel(String[] headers, Class<?> _objClass, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses, boolean cellEditable) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.- Parameters:
headers
- - Column names_objClass
- - Object class that will be usedreadFunctors
- - used to get the valueswriteFunctors
- - used to set the valueseditorClasses
- - class for each columncellEditable
- - if cell must editable (false to allow double click on cell)
-
ObjectTableModel
public ObjectTableModel(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses) The ObjectTableModel is a TableModel whose rows are objects; columns are defined as Functors on the object.- Parameters:
headers
- - Column namesreadFunctors
- - used to get the valueswriteFunctors
- - used to set the valueseditorClasses
- - class for each column
-
-
Method Details
-
iterator
-
clearData
public void clearData() -
addRow
-
insertRow
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceTableModel
- Overrides:
getColumnCount
in classDefaultTableModel
-
getColumnName
- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classDefaultTableModel
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceTableModel
- Overrides:
getRowCount
in classDefaultTableModel
-
getValueAt
- Specified by:
getValueAt
in interfaceTableModel
- Overrides:
getValueAt
in classDefaultTableModel
-
isCellEditable
public boolean isCellEditable(int arg0, int arg1) - Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classDefaultTableModel
-
moveRow
public void moveRow(int start, int end, int to) - Overrides:
moveRow
in classDefaultTableModel
-
removeRow
public void removeRow(int row) - Overrides:
removeRow
in classDefaultTableModel
-
setValueAt
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classDefaultTableModel
-
getColumnClass
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
-
checkFunctors
Check all registered functors.** only for use in unit test code **
- Parameters:
_value
- - an instance of the table model row data item (if null, use the class passed to the constructor).caller
- - class of caller.- Returns:
- false if at least one Functor cannot be found.
-
getObjectList
Returns Object (List of Object).- Returns:
- Object (List of Object)
-
getObjectListAsList
Returns List of Object.- Returns:
- List of Object
-
setRows
-