Class LocoIOTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.loconet.locoio.LocoIOTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class LocoIOTableModel extends javax.swing.table.AbstractTableModel implements java.beans.PropertyChangeListener
Basic Configurer for LocoIO hardware. Marked Legacy/Deprecated since 2017 version 4.12.This code derives the SV values from the user-selected mode and address; this is different from earlier versions where the user was expected to do the derivation manually. This derivation is complicated by the fact that the "mode" SV[port.0] in the LocoIO doesn't fully specify the operation being done - additional bits in "v2" SV[port.2] are also used. For example, 0x80 is both turnout closed and turnout high. We read and write the mode SV _last_ to handle this.
The "addr" field is constructed from (or causes the construction of, depending on whether we are reading or writing...) value1 and value2. In particular, value2 requires knowledge of the mode being set. When "capturing" a turnout address (where we don't have a mode setting) we presume that the address seen in the OPC_SW_REQ packet is for a fixed contact, and interpret the bits in that context.
The timeout code is modelled after that in jmri.jmrix.AbstractProgrammer, though there are significant modifications.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ADDRCOLUMN
static int
CAPTURECOLUMN
static int
HIGHESTCOLUMN
static int
MODECOLUMN
static int
PINCOLUMN
Define the contents of the individual columns.static int
READCOLUMN
static int
SV0COLUMN
static int
SV1COLUMN
static int
SV2COLUMN
static int
WRITECOLUMN
-
Constructor Summary
Constructors Constructor Description LocoIOTableModel(LocoIOData ldata)
Primary constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
int
getPreferredWidth(int col)
int
getRowCount()
java.lang.Object
getValueAt(int row, int col)
boolean
isCellEditable(int row, int col)
void
propertyChange(java.beans.PropertyChangeEvent evt)
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
-
PINCOLUMN
public static final int PINCOLUMN
Define the contents of the individual columns.- See Also:
- Constant Field Values
-
MODECOLUMN
public static final int MODECOLUMN
- See Also:
- Constant Field Values
-
ADDRCOLUMN
public static final int ADDRCOLUMN
- See Also:
- Constant Field Values
-
SV0COLUMN
public static final int SV0COLUMN
- See Also:
- Constant Field Values
-
SV1COLUMN
public static final int SV1COLUMN
- See Also:
- Constant Field Values
-
SV2COLUMN
public static final int SV2COLUMN
- See Also:
- Constant Field Values
-
CAPTURECOLUMN
public static final int CAPTURECOLUMN
- See Also:
- Constant Field Values
-
READCOLUMN
public static final int READCOLUMN
- See Also:
- Constant Field Values
-
WRITECOLUMN
public static final int WRITECOLUMN
- See Also:
- Constant Field Values
-
HIGHESTCOLUMN
public static final int HIGHESTCOLUMN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocoIOTableModel
public LocoIOTableModel(LocoIOData ldata)
Primary constructor. Initializes all the arrays.- Parameters:
ldata
- the data.
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
getRowCount
public int getRowCount()
- 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)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
-
getPreferredWidth
public int getPreferredWidth(int col)
-
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
-
dispose
public void dispose()
-
-