Class SlotMonDataModel

java.lang.Object
javax.swing.table.AbstractTableModel
jmri.jmrix.loconet.slotmon.SlotMonDataModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, SlotListener

public class SlotMonDataModel extends AbstractTableModel implements SlotListener
Table data model for display of slot manager contents.
See Also:
  • Constructor Details

  • Method Details

    • 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 interface TableModel
      Returns:
      the number of rows
    • 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
    • clearAllSlots

      public void clearAllSlots()
    • configureTable

      public void configureTable(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 interface SlotListener
    • 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - 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 slot
      col - grid col
      row - grid row
    • sendExpFunctionGroup3

      protected void sendExpFunctionGroup3(LocoNetSlot slot, int col, int row)
      Sends expanded loconet message F14 thru F20 Message.
      Parameters:
      slot - loconet slot
      col - grid col
      row - grid row
    • sendExpFunctionGroup4

      protected void sendExpFunctionGroup4(LocoNetSlot slot, int col, int row)
      Sends Expanded loconet message F21 thru F28 Message.
      Parameters:
      slot - loconet slot
      col - grid col
      row - grid row
    • dispose

      public void dispose()