jmri.jmrix.loconet.slotmon
Class SlotMonDataModel

Show UML class diagram
java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by 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:
Serialized Form

Nested Class Summary
(package private) static class SlotMonDataModel.Notify
           
 
Field Summary
static int ADDRCOLUMN
           
static int CONSCOLUMN
           
static int DIRCOLUMN
           
static int DISPCOLUMN
           
static int ESTOPCOLUMN
           
static int F0COLUMN
           
static int F1COLUMN
           
static int F2COLUMN
           
static int F3COLUMN
           
static int F4COLUMN
           
static int F5COLUMN
           
static int F6COLUMN
           
static int F7COLUMN
           
static int F8COLUMN
           
(package private) static Boolean False
           
(package private) static org.slf4j.Logger log
           
(package private)  LocoNetSystemConnectionMemo memo
           
static int NUMCOLUMN
           
static int SLOTCOLUMN
           
static int SPDCOLUMN
           
static int STATCOLUMN
           
static int THROTCOLUMN
           
(package private) static Boolean True
           
static int TYPECOLUMN
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SlotMonDataModel(int row, int column, LocoNetSystemConnectionMemo memo)
           
 
Method Summary
 void configureTable(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 stop
 Class<?> getColumnClass(int col)
           
 int getColumnCount()
           
 String getColumnName(int col)
           
 int getPreferredWidth(int col)
           
 int getRowCount()
          Returns the number of rows to be displayed.
 Object getValueAt(int row, int col)
           
 boolean isCellEditable(int row, int col)
           
 void notifyChangedSlot(LocoNetSlot s)
           
(package private)  void setColumnToHoldButton(JTable slotTable, int column)
           
(package private)  void setColumnToHoldEStopButton(JTable slotTable, int column)
           
 void setValueAt(Object value, int row, int col)
           
 void showAllSlots(boolean val)
           
 void showSystemSlots(boolean val)
           
protected  int slotNum(int row)
          Returns slot number for a specific row.
 
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

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

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

NUMCOLUMN

public static final int NUMCOLUMN
See Also:
Constant Field Values

memo

LocoNetSystemConnectionMemo memo

True

static final Boolean True

False

static final Boolean False

log

static org.slf4j.Logger log
Constructor Detail

SlotMonDataModel

SlotMonDataModel(int row,
                 int column,
                 LocoNetSystemConnectionMemo memo)
Method Detail

getRowCount

public int getRowCount()
Returns 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

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

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 -

setColumnToHoldButton

void setColumnToHoldButton(JTable slotTable,
                           int column)

setColumnToHoldEStopButton

void setColumnToHoldEStopButton(JTable slotTable,
                                int column)

notifyChangedSlot

public void notifyChangedSlot(LocoNetSlot s)
Specified by:
notifyChangedSlot in interface SlotListener

showAllSlots

public void showAllSlots(boolean val)

showSystemSlots

public void showSystemSlots(boolean val)

slotNum

protected int slotNum(int row)
Returns slot number for a specific row.

This should probably use a local cache instead of counting/searching each time.

Parameters:
row - Row number in the displayed table

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


dispose

public void dispose()


Copyright © 1997-2013 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