Class ObjectTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- nl.tudelft.simulation.dsol.swing.introspection.gui.ObjectTableModel
-
- All Implemented Interfaces:
Serializable,TableModel,IntrospectingTableModelInterface
public class ObjectTableModel extends AbstractTableModel implements IntrospectingTableModelInterface
The ObjectTableModel.
copyright (c) 2002-2021 Delft University of Technology.
BSD-style license. See DSOL License.- Since:
- 1.5
- Author:
- Peter Jacobs., Alexander Verbraeck., Niels Lang.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Property[]propertiesthe properties.-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description ObjectTableModel(Object bean)Creates an ObjectTableModel utilizing a {see nl.tudelft.simulation.introspection.beans.BeanIntrospector}.ObjectTableModel(Object object, Introspector introspector)Creates an ObjectTableModel utilizing a custom introspector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getColumnClass(int columnIndex)intgetColumnCount()StringgetColumnName(int columnIndex)IntrospectorgetIntrospector()ModelManagergetModelManager()By default, a {see DefaultModelManager}returned.PropertygetProperty(String propertyName)Returns the Property instance generated by this IntrospectingTableModelInterface for the property 'propertyName'.protected intgetPropertyIndex(String property)intgetRowCount()Class<?>getTypeAt(int rowIndex, int columnIndex)gets the class of the the object at row,column.ObjectgetValueAt(int rowIndex, int columnIndex)booleanisCellEditable(int rowIndex, int columnIndex)voidsetModelManager(ModelManager manager)Sets the modelmanager.voidsetValueAt(Object aValue, int rowIndex, int columnIndex)StringtoString()-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
-
-
-
-
Field Detail
-
properties
protected Property[] properties
the properties.
-
-
Constructor Detail
-
ObjectTableModel
public ObjectTableModel(Object bean)
Creates an ObjectTableModel utilizing a {see nl.tudelft.simulation.introspection.beans.BeanIntrospector}.- Parameters:
bean- Object; The object to be introspected according to the bean property-paradigm.
-
ObjectTableModel
public ObjectTableModel(Object object, Introspector introspector)
Creates an ObjectTableModel utilizing a custom introspector.- Parameters:
object- Object; The object to be introspected.introspector- Introspector; The introspector instance utilized.
-
-
Method Detail
-
getRowCount
public int getRowCount()
- Specified by:
getRowCountin interfaceTableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfaceTableModel
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
- Specified by:
getValueAtin interfaceTableModel
-
getColumnName
public String getColumnName(int columnIndex)
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
setValueAt
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel
-
getColumnClass
public Class<?> getColumnClass(int columnIndex)
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
getTypeAt
public Class<?> getTypeAt(int rowIndex, int columnIndex)
gets the class of the the object at row,column.- Specified by:
getTypeAtin interfaceIntrospectingTableModelInterface- Parameters:
rowIndex- int; the rowNumbercolumnIndex- int; the columnNumber- Returns:
- The type of the value in cell 'rowIndex', 'columnIndex'
-
getPropertyIndex
protected int getPropertyIndex(String property)
- Parameters:
property- String; the property- Returns:
- Returns the index of the property in this tablemodel which name matches 'property'.
-
getProperty
public Property getProperty(String propertyName)
Returns the Property instance generated by this IntrospectingTableModelInterface for the property 'propertyName'.- Specified by:
getPropertyin interfaceIntrospectingTableModelInterface- Parameters:
propertyName- String; The name of the Property to be returned- Returns:
- The Property corresponding to 'propertyName', null if the property could not be found.
-
getIntrospector
public Introspector getIntrospector()
- Specified by:
getIntrospectorin interfaceIntrospectingTableModelInterface- Returns:
- The introspector instance used by this introspecting TableModel.
-
setModelManager
public void setModelManager(ModelManager manager)
Sets the modelmanager. By default, a {see DefaultModelManager}is used.- Parameters:
manager- ModelManager; the manager
-
getModelManager
public ModelManager getModelManager()
By default, a {see DefaultModelManager}returned.- Specified by:
getModelManagerin interfaceIntrospectingTableModelInterface- Returns:
- the model manager
- See Also:
#getModelManager()
-
-