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 int
ADDRCOLUMN
static int
CONSCOLUMN
static int
CONSISTADDRESS
static int
DIRCOLUMN
static int
DISPCOLUMN
static int
ESTOPCOLUMN
static int
F0COLUMN
static int
F10COLUMN
static int
F11COLUMN
static int
F12COLUMN
static int
F13COLUMN
static int
F14COLUMN
static int
F15COLUMN
static int
F16COLUMN
static int
F17COLUMN
static int
F18COLUMN
static int
F19COLUMN
static int
F1COLUMN
static int
F20COLUMN
static int
F21COLUMN
static int
F22COLUMN
static int
F23COLUMN
static int
F24COLUMN
static int
F25COLUMN
static int
F26COLUMN
static int
F27COLUMN
static int
F28COLUMN
static int
F2COLUMN
static int
F3COLUMN
static int
F4COLUMN
static int
F5COLUMN
static int
F6COLUMN
static int
F7COLUMN
static int
F8COLUMN
static int
F9COLUMN
static int
SLOTCOLUMN
static int
SPDCOLUMN
static int
STATCOLUMN
static int
THROTCOLUMN
static int
TYPECOLUMN
-
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 void
clearAllSlots()
void
configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns.void
dispose()
void
estopAll()
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)
int
getColumnCount()
java.lang.String
getColumnName(int col)
int
getPreferredWidth(int col)
int
getRowCount()
Return the number of rows to be displayed.protected LocoNetSlot
getSlot(int row)
java.lang.Object
getValueAt(int row, int col)
boolean
isCellEditable(int row, int col)
void
notifyChangedSlot(LocoNetSlot s)
void
refreshSlots()
Forces a refresh of the slotsprotected 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, F6protected 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, F13protected void
sendExpFunctionGroup3(LocoNetSlot slot, int col, int row)
Sends expanded loconet message F14 thru F20 Message.protected void
sendExpFunctionGroup4(LocoNetSlot slot, int col, int row)
Sends Expanded loconet message F21 thru F28 Message.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, F4protected void
sendFunctionGroup2(LocoNetSlot slot, int col, int row)
Send the LocoNet message to set the state of functions F5, F6, F7, F8protected void
sendFunctionGroup3(LocoNetSlot slot, int col, int row)
Sends Function Group 3 values - F9 thru F12, using an "OPC_IMM_PACKET" LocoNet Message.protected void
sendFunctionGroup4(LocoNetSlot slot, int col, int row)
Sends Function Group 4 values - F13 thru F20, using an "OPC_IMM_PACKET" LocoNet Message.protected void
sendFunctionGroup5(LocoNetSlot slot, int col, int row)
Sends Function Group 5 values - F21 thru F28, using an "OPC_IMM_PACKET" LocoNet Message.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
-
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:
getRowCount
in interfacejavax.swing.table.TableModel
- Returns:
- the number of rows
-
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
-
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:
notifyChangedSlot
in 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()
-
-