Package prezoom.view.table
Class InspectorTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- javax.swing.table.DefaultTableModel
-
- prezoom.view.table.InspectorTableModel
-
- All Implemented Interfaces:
Serializable,TableModel
public class InspectorTableModel extends DefaultTableModel
The custom table model for the inspector table- Author:
- Abhishek Sharma
create date: 2020/11/26
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AttributeMapIinspectedAttthe source of the tablebooleanisRearrangingthe table is rearranging by callingInspectorTable.rearrangeValues(AttributeMapI).Map<Integer,Object>prop_mapthe data in the 2nd columnprivate ArrayList<String>prop_namesthe attribute names in the 1st columnMap<String,Method>setter_mapthe setter map to change values of theinspectedAtt-
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description InspectorTableModel(String[] col_names, int i)the constructor, adding aTableModelListener.
-
Method Summary
Modifier and Type Method Description ArrayList<String>getPropNames()get the attribute name list in the 1st columnObjectgetValueAt(int row, int col)get the value of the table, names are stored in 1st column values are stored in 2nd columnbooleanisCellEditable(int row, int col)the 1st name column cannot be editedvoidsetPropNames(ArrayList<String> props)set the attribute names in the 1st columnvoidsetValueAt(Object value, int row, int col)change the value at the given row and column-
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, 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, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
setter_map
public Map<String,Method> setter_map
the setter map to change values of theinspectedAtt
-
inspectedAtt
public AttributeMapI inspectedAtt
the source of the table
-
isRearranging
public boolean isRearranging
the table is rearranging by callingInspectorTable.rearrangeValues(AttributeMapI). ignore table changes event.
-
-
Constructor Detail
-
InspectorTableModel
public InspectorTableModel(String[] col_names, int i)
the constructor, adding aTableModelListener. if the table is changed, invoke the corresponding setter from theAttributeMapI.validSetterMap()to change the value of theinspectedAtt- Parameters:
col_names- all the attribute names in the first columni- the row number
-
-
Method Detail
-
setPropNames
public void setPropNames(ArrayList<String> props)
set the attribute names in the 1st column- Parameters:
props- the attribute name list
-
getPropNames
public ArrayList<String> getPropNames()
get the attribute name list in the 1st column- Returns:
- the attribute name list
-
getValueAt
public Object getValueAt(int row, int col)
get the value of the table, names are stored in 1st column values are stored in 2nd column- Specified by:
getValueAtin interfaceTableModel- Overrides:
getValueAtin classDefaultTableModel- Parameters:
row- row numbercol- column number- Returns:
- the value at the given row and column
-
setValueAt
public void setValueAt(Object value, int row, int col)
change the value at the given row and column- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classDefaultTableModel- Parameters:
value- the new valuerow- row numbercol- column number
-
isCellEditable
public boolean isCellEditable(int row, int col)the 1st name column cannot be edited- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classDefaultTableModel- Parameters:
row- row numbercol- column number- Returns:
- true if column != 0
-
-