jmri.jmrix.loconet.locoio
Class LocoIOTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jmri.jmrix.loconet.locoio.LocoIOTableModel
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, TableModel

public class LocoIOTableModel
extends AbstractTableModel
implements PropertyChangeListener

Basic Configurer for LocoIO hardware.

This code derves 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.

Author:
Bob Jacobsen Copyright (C) 2001
See Also:
Serialized Form

Field Summary
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
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
LocoIOTableModel(LocoIOData ldata)
          Primary constructor.
 
Method Summary
 void dispose()
           
 Class<?> getColumnClass(int col)
           
 int getColumnCount()
           
 String getColumnName(int col)
           
 int getPreferredWidth(int col)
           
 int getRowCount()
           
 Object getValueAt(int row, int col)
           
 boolean isCellEditable(int row, int col)
           
 void propertyChange(PropertyChangeEvent evt)
           
 void setValueAt(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
 

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.

Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int col)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class<?> getColumnClass(int col)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

getValueAt

public Object getValueAt(int row,
                         int col)
Specified by:
getValueAt in interface TableModel

getPreferredWidth

public int getPreferredWidth(int col)

setValueAt

public void setValueAt(Object value,
                       int row,
                       int col)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

dispose

public void dispose()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads