Package jmri.jmrix.can.cbus.node
Class CbusNodeNVTableDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.can.cbus.node.CbusNodeNVTableDataModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel
public class CbusNodeNVTableDataModel extends javax.swing.table.AbstractTableModel implements java.beans.PropertyChangeListener
Table data model for display of CBUS Node Variables.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_COLUMNstatic intNV_CURRENT_BIT_COLUMNstatic intNV_CURRENT_HEX_COLUMNstatic intNV_CURRENT_VAL_COLUMNstatic intNV_NAME_COLUMNstatic intNV_NUMBER_COLUMNstatic intNV_SELECT_BIT_COLUMNstatic intNV_SELECT_COLUMNstatic intNV_SELECT_HEX_COLUMN
-
Constructor Summary
Constructors Constructor Description CbusNodeNVTableDataModel(CanSystemConnectionMemo memo, int row, int column)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()De-registers the NV Table from receiving updates from the CbusNode.CbusNodeFromBackupgetChangedNode()Get a backup node containing the edited NVs.java.lang.Class<?>getColumnClass(int col)Returns column class type.intgetColumnCount()java.lang.StringgetColumnName(int col)Returns String of column name from column int used in table headerintgetCountDirty()Get count of changed NVs.CbusNodegetNode()Get the Node being used in table.intgetRowCount()Return the number of rows to be displayed.java.lang.ObjectgetValueAt(int row, int col)Return table valuesbooleanisCellEditable(int row, int col)boolean return to edit table cell or notbooleanisSingleNvDirty(int nvToCheck)Checks if a single NV has been edited to a new valuebooleanisTableDirty()Checks if any NV has been edited to a new valuevoidpropertyChange(java.beans.PropertyChangeEvent ev)voidresetNewNvs()Resets the edit NV value to match the actual NV value.voidresetSingleNv(int row)Resets a single edit NV value to match the actual NV value.voidsetNode(CbusNode node)Set the Node to be used in table.voidsetValueAt(java.lang.Object value, int row, int col)-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
NV_NUMBER_COLUMN
public static final int NV_NUMBER_COLUMN
- See Also:
- Constant Field Values
-
NV_NAME_COLUMN
public static final int NV_NAME_COLUMN
- See Also:
- Constant Field Values
-
NV_CURRENT_VAL_COLUMN
public static final int NV_CURRENT_VAL_COLUMN
- See Also:
- Constant Field Values
-
NV_CURRENT_HEX_COLUMN
public static final int NV_CURRENT_HEX_COLUMN
- See Also:
- Constant Field Values
-
NV_CURRENT_BIT_COLUMN
public static final int NV_CURRENT_BIT_COLUMN
- See Also:
- Constant Field Values
-
NV_SELECT_COLUMN
public static final int NV_SELECT_COLUMN
- See Also:
- Constant Field Values
-
NV_SELECT_HEX_COLUMN
public static final int NV_SELECT_HEX_COLUMN
- See Also:
- Constant Field Values
-
NV_SELECT_BIT_COLUMN
public static final int NV_SELECT_BIT_COLUMN
- See Also:
- Constant Field Values
-
MAX_COLUMN
public static final int MAX_COLUMN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CbusNodeNVTableDataModel
public CbusNodeNVTableDataModel(CanSystemConnectionMemo memo, int row, int column)
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent ev)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
getRowCount
public int getRowCount()
Return the number of rows to be displayed.- Specified by:
getRowCountin interfacejavax.swing.table.TableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int col)
Returns String of column name from column int used in table header- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel- Parameters:
col- int col number
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Returns column class type.- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
boolean return to edit table cell or not- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel- Returns:
- boolean
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Return table values- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Parameters:
row- int row numbercol- int col number
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classjavax.swing.table.AbstractTableModel
-
setNode
public void setNode(CbusNode node)
Set the Node to be used in table.- Parameters:
node- the CbusNode of Interest to the NV Table
-
getNode
public CbusNode getNode()
Get the Node being used in table.- Returns:
- the CbusNode of Interest
-
isSingleNvDirty
public boolean isSingleNvDirty(int nvToCheck)
Checks if a single NV has been edited to a new value- Parameters:
nvToCheck- the single NV to check- Returns:
- true if dirty, else false
-
isTableDirty
public boolean isTableDirty()
Checks if any NV has been edited to a new value- Returns:
- true if any NV has been edited, else false
-
getCountDirty
public int getCountDirty()
Get count of changed NVs.- Returns:
- number of changed NVs
-
resetNewNvs
public void resetNewNvs()
Resets the edit NV value to match the actual NV value.
-
resetSingleNv
public void resetSingleNv(int row)
Resets a single edit NV value to match the actual NV value.- Parameters:
row- row to reset
-
getChangedNode
public CbusNodeFromBackup getChangedNode()
Get a backup node containing the edited NVs.- Returns:
- a node which has the new NV's
-
dispose
public void dispose()
De-registers the NV Table from receiving updates from the CbusNode.
-
-