Class 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
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 interface java.beans.PropertyChangeListener
      • getRowCount

        public int getRowCount()
        Specified by:
        getRowCount in interface javax.swing.table.TableModel
      • getColumnCount

        public int getColumnCount()
        Specified by:
        getColumnCount in interface javax.swing.table.TableModel
      • getColumnName

        public java.lang.String getColumnName​(int col)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int col)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int col)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int col)
        Specified by:
        getValueAt in interface javax.swing.table.TableModel
      • setValueAt

        public void setValueAt​(java.lang.Object value,
                               int row,
                               int col)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel