Package jmri.jmrix.loconet.slotmon
Class SlotMonDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.loconet.slotmon.SlotMonDataModel
-
- All Implemented Interfaces:
java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel,SlotListener
public class SlotMonDataModel extends javax.swing.table.AbstractTableModel implements SlotListener
Table data model for display of slot manager contents.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intADDRCOLUMNstatic intCONSCOLUMNstatic intCONSISTADDRESSstatic intDIRCOLUMNstatic intDISPCOLUMNstatic intESTOPCOLUMNstatic intF0COLUMNstatic intF10COLUMNstatic intF11COLUMNstatic intF12COLUMNstatic intF13COLUMNstatic intF14COLUMNstatic intF15COLUMNstatic intF16COLUMNstatic intF17COLUMNstatic intF18COLUMNstatic intF19COLUMNstatic intF1COLUMNstatic intF20COLUMNstatic intF21COLUMNstatic intF22COLUMNstatic intF23COLUMNstatic intF24COLUMNstatic intF25COLUMNstatic intF26COLUMNstatic intF27COLUMNstatic intF28COLUMNstatic intF2COLUMNstatic intF3COLUMNstatic intF4COLUMNstatic intF5COLUMNstatic intF6COLUMNstatic intF7COLUMNstatic intF8COLUMNstatic intF9COLUMNstatic intSLOTCOLUMNstatic intSPDCOLUMNstatic intSTATCOLUMNstatic intTHROTCOLUMNstatic intTYPECOLUMN
-
Constructor Summary
Constructors Constructor Description SlotMonDataModel(int row, int column, LocoNetSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAllSlots()voidconfigureTable(javax.swing.JTable slotTable)Configure a table to have our standard rows and columns.voiddispose()voidestopAll()This is a convenience method that makes it easier for classes using this model to set all in-use slots to emergency stopjava.lang.Class<?>getColumnClass(int col)intgetColumnCount()java.lang.StringgetColumnName(int col)intgetPreferredWidth(int col)intgetRowCount()Return the number of rows to be displayed.protected LocoNetSlotgetSlot(int row)java.lang.ObjectgetValueAt(int row, int col)booleanisCellEditable(int row, int col)voidnotifyChangedSlot(LocoNetSlot s)voidrefreshSlots()Forces a refresh of the slotsprotected voidsendExpFunctionGroup1(LocoNetSlot slot, int col, int row)Send the Expanded LocoNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4, F5, F6protected voidsendExpFunctionGroup2(LocoNetSlot slot, int col, int row)Send the Expanded LocoNet message to set the state of functions F7, F8, F8, F9, F10, F11, F12, F13protected voidsendExpFunctionGroup3(LocoNetSlot slot, int col, int row)Sends expanded loconet message F14 thru F20 Message.protected voidsendExpFunctionGroup4(LocoNetSlot slot, int col, int row)Sends Expanded loconet message F21 thru F28 Message.protected voidsendFunctionGroup1(LocoNetSlot slot, int col, int row)Send the LocoNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4protected voidsendFunctionGroup2(LocoNetSlot slot, int col, int row)Send the LocoNet message to set the state of functions F5, F6, F7, F8protected voidsendFunctionGroup3(LocoNetSlot slot, int col, int row)Sends Function Group 3 values - F9 thru F12, using an "OPC_IMM_PACKET" LocoNet Message.protected voidsendFunctionGroup4(LocoNetSlot slot, int col, int row)Sends Function Group 4 values - F13 thru F20, using an "OPC_IMM_PACKET" LocoNet Message.protected voidsendFunctionGroup5(LocoNetSlot slot, int col, int row)Sends Function Group 5 values - F21 thru F28, using an "OPC_IMM_PACKET" LocoNet Message.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
-
SLOTCOLUMN
public static final int SLOTCOLUMN
- See Also:
- Constant Field Values
-
ESTOPCOLUMN
public static final int ESTOPCOLUMN
- See Also:
- Constant Field Values
-
ADDRCOLUMN
public static final int ADDRCOLUMN
- See Also:
- Constant Field Values
-
SPDCOLUMN
public static final int SPDCOLUMN
- See Also:
- Constant Field Values
-
TYPECOLUMN
public static final int TYPECOLUMN
- See Also:
- Constant Field Values
-
STATCOLUMN
public static final int STATCOLUMN
- See Also:
- Constant Field Values
-
DISPCOLUMN
public static final int DISPCOLUMN
- See Also:
- Constant Field Values
-
CONSCOLUMN
public static final int CONSCOLUMN
- See Also:
- Constant Field Values
-
CONSISTADDRESS
public static final int CONSISTADDRESS
- See Also:
- Constant Field Values
-
THROTCOLUMN
public static final int THROTCOLUMN
- See Also:
- Constant Field Values
-
DIRCOLUMN
public static final int DIRCOLUMN
- See Also:
- Constant Field Values
-
F0COLUMN
public static final int F0COLUMN
- See Also:
- Constant Field Values
-
F1COLUMN
public static final int F1COLUMN
- See Also:
- Constant Field Values
-
F2COLUMN
public static final int F2COLUMN
- See Also:
- Constant Field Values
-
F3COLUMN
public static final int F3COLUMN
- See Also:
- Constant Field Values
-
F4COLUMN
public static final int F4COLUMN
- See Also:
- Constant Field Values
-
F5COLUMN
public static final int F5COLUMN
- See Also:
- Constant Field Values
-
F6COLUMN
public static final int F6COLUMN
- See Also:
- Constant Field Values
-
F7COLUMN
public static final int F7COLUMN
- See Also:
- Constant Field Values
-
F8COLUMN
public static final int F8COLUMN
- See Also:
- Constant Field Values
-
F9COLUMN
public static final int F9COLUMN
- See Also:
- Constant Field Values
-
F10COLUMN
public static final int F10COLUMN
- See Also:
- Constant Field Values
-
F11COLUMN
public static final int F11COLUMN
- See Also:
- Constant Field Values
-
F12COLUMN
public static final int F12COLUMN
- See Also:
- Constant Field Values
-
F13COLUMN
public static final int F13COLUMN
- See Also:
- Constant Field Values
-
F14COLUMN
public static final int F14COLUMN
- See Also:
- Constant Field Values
-
F15COLUMN
public static final int F15COLUMN
- See Also:
- Constant Field Values
-
F16COLUMN
public static final int F16COLUMN
- See Also:
- Constant Field Values
-
F17COLUMN
public static final int F17COLUMN
- See Also:
- Constant Field Values
-
F18COLUMN
public static final int F18COLUMN
- See Also:
- Constant Field Values
-
F19COLUMN
public static final int F19COLUMN
- See Also:
- Constant Field Values
-
F20COLUMN
public static final int F20COLUMN
- See Also:
- Constant Field Values
-
F21COLUMN
public static final int F21COLUMN
- See Also:
- Constant Field Values
-
F22COLUMN
public static final int F22COLUMN
- See Also:
- Constant Field Values
-
F23COLUMN
public static final int F23COLUMN
- See Also:
- Constant Field Values
-
F24COLUMN
public static final int F24COLUMN
- See Also:
- Constant Field Values
-
F25COLUMN
public static final int F25COLUMN
- See Also:
- Constant Field Values
-
F26COLUMN
public static final int F26COLUMN
- See Also:
- Constant Field Values
-
F27COLUMN
public static final int F27COLUMN
- See Also:
- Constant Field Values
-
F28COLUMN
public static final int F28COLUMN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SlotMonDataModel
SlotMonDataModel(int row, int column, LocoNetSystemConnectionMemo memo)
-
-
Method Detail
-
refreshSlots
public void refreshSlots()
Forces a refresh of the slots
-
getRowCount
public int getRowCount()
Return the number of rows to be displayed. This can vary depending on whether only active rows are displayed, and whether the system slots should be displayed.This should probably use a local cache instead of counting/searching each time.
- Specified by:
getRowCountin interfacejavax.swing.table.TableModel- Returns:
- the number of rows
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
- Specified by:
getValueAtin interfacejavax.swing.table.TableModel
-
getPreferredWidth
public int getPreferredWidth(int col)
-
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
-
clearAllSlots
public void clearAllSlots()
-
configureTable
public void configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns. This is optional, in that other table formats can use this table model. But we put it here to help keep it consistent.- Parameters:
slotTable- the table to configure
-
notifyChangedSlot
public void notifyChangedSlot(LocoNetSlot s)
- Specified by:
notifyChangedSlotin interfaceSlotListener
-
getSlot
protected LocoNetSlot getSlot(int row)
-
estopAll
public void estopAll()
This is a convenience method that makes it easier for classes using this model to set all in-use slots to emergency stop
-
sendFunctionGroup1
protected void sendFunctionGroup1(LocoNetSlot slot, int col, int row)
Send the LocoNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendFunctionGroup2
protected void sendFunctionGroup2(LocoNetSlot slot, int col, int row)
Send the LocoNet message to set the state of functions F5, F6, F7, F8- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendFunctionGroup3
protected void sendFunctionGroup3(LocoNetSlot slot, int col, int row)
Sends Function Group 3 values - F9 thru F12, using an "OPC_IMM_PACKET" LocoNet Message.- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendFunctionGroup4
protected void sendFunctionGroup4(LocoNetSlot slot, int col, int row)
Sends Function Group 4 values - F13 thru F20, using an "OPC_IMM_PACKET" LocoNet Message.- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendFunctionGroup5
protected void sendFunctionGroup5(LocoNetSlot slot, int col, int row)
Sends Function Group 5 values - F21 thru F28, using an "OPC_IMM_PACKET" LocoNet Message.- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendExpFunctionGroup1
protected void sendExpFunctionGroup1(LocoNetSlot slot, int col, int row)
Send the Expanded LocoNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4, F5, F6- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendExpFunctionGroup2
protected void sendExpFunctionGroup2(LocoNetSlot slot, int col, int row)
Send the Expanded LocoNet message to set the state of functions F7, F8, F8, F9, F10, F11, F12, F13- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendExpFunctionGroup3
protected void sendExpFunctionGroup3(LocoNetSlot slot, int col, int row)
Sends expanded loconet message F14 thru F20 Message.- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
sendExpFunctionGroup4
protected void sendExpFunctionGroup4(LocoNetSlot slot, int col, int row)
Sends Expanded loconet message F21 thru F28 Message.- Parameters:
slot- loconet slotcol- grid colrow- grid row
-
dispose
public void dispose()
-
-