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 int
MAX_COLUMN
static int
NV_CURRENT_BIT_COLUMN
static int
NV_CURRENT_HEX_COLUMN
static int
NV_CURRENT_VAL_COLUMN
static int
NV_NAME_COLUMN
static int
NV_NUMBER_COLUMN
static int
NV_SELECT_BIT_COLUMN
static int
NV_SELECT_COLUMN
static int
NV_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 void
dispose()
De-registers the NV Table from receiving updates from the CbusNode.CbusNodeFromBackup
getChangedNode()
Get a backup node containing the edited NVs.java.lang.Class<?>
getColumnClass(int col)
Returns column class type.int
getColumnCount()
java.lang.String
getColumnName(int col)
Returns String of column name from column int used in table headerint
getCountDirty()
Get count of changed NVs.CbusNode
getNode()
Get the Node being used in table.int
getRowCount()
Return the number of rows to be displayed.java.lang.Object
getValueAt(int row, int col)
Return table valuesboolean
isCellEditable(int row, int col)
boolean return to edit table cell or notboolean
isSingleNvDirty(int nvToCheck)
Checks if a single NV has been edited to a new valueboolean
isTableDirty()
Checks if any NV has been edited to a new valuevoid
propertyChange(java.beans.PropertyChangeEvent ev)
void
resetNewNvs()
Resets the edit NV value to match the actual NV value.void
resetSingleNv(int row)
Resets a single edit NV value to match the actual NV value.void
setNode(CbusNode node)
Set the Node to be used in table.void
setValueAt(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:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
getRowCount
public int getRowCount()
Return the number of rows to be displayed.- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in 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:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
- Parameters:
col
- int col number
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Returns column class type.- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
boolean return to edit table cell or not- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
- Returns:
- boolean
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Return table values- Specified by:
getValueAt
in 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:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in 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.
-
-