Package jmri.jmrix.sprog.sprogslotmon
Class SprogSlotMonDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrix.sprog.sprogslotmon.SprogSlotMonDataModel
-
- All Implemented Interfaces:
java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel,SprogSlotListener
public class SprogSlotMonDataModel extends javax.swing.table.AbstractTableModel implements SprogSlotListener
Table data model for display of slot manager contents.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSprogSlotMonDataModel.Notify
-
Field Summary
Fields Modifier and Type Field Description static intADDRCOLUMNstatic intDIRCOLUMN(package private) static java.lang.BooleanFalsestatic intNUMCOLUMNstatic intSLOTCOLUMNstatic intSPDCOLUMNstatic intSTATCOLUMN(package private) static java.lang.BooleanTrue
-
Constructor Summary
Constructors Constructor Description SprogSlotMonDataModel(int row, int column, SprogSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigureTable(javax.swing.JTable slotTable)Configure a table to have our standard rows and columns.voiddispose()java.lang.Class<?>getColumnClass(int col)intgetColumnCount()java.lang.StringgetColumnName(int col)intgetPreferredWidth(int col)intgetRowCount()Return the number of rows to be displayed.java.lang.ObjectgetValueAt(int row, int col)booleanisCellEditable(int row, int col)voidnotifyChangedSlot(SprogSlot s)voidsetValueAt(java.lang.Object value, int row, int col)voidshowAllSlots(boolean val)protected intslotNum(int row)Return 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
-
-
-
-
Field Detail
-
SLOTCOLUMN
public static final int SLOTCOLUMN
- 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
-
STATCOLUMN
public static final int STATCOLUMN
- See Also:
- Constant Field Values
-
DIRCOLUMN
public static final int DIRCOLUMN
- See Also:
- Constant Field Values
-
NUMCOLUMN
public static final int NUMCOLUMN
- See Also:
- Constant Field Values
-
True
static final java.lang.Boolean True
-
False
static final java.lang.Boolean False
-
-
Constructor Detail
-
SprogSlotMonDataModel
SprogSlotMonDataModel(int row, int column, SprogSystemConnectionMemo memo)
-
-
Method Detail
-
getRowCount
public int getRowCount()
Return the number of rows to be displayed. This can vary depending on whether only active rows are displayed.This should probably use a local cache instead of counting/searching each time.
- Specified by:
getRowCountin interfacejavax.swing.table.TableModel
-
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
-
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 slot table to configure.
-
notifyChangedSlot
public void notifyChangedSlot(SprogSlot s)
- Specified by:
notifyChangedSlotin interfaceSprogSlotListener
-
showAllSlots
public void showAllSlots(boolean val)
-
slotNum
protected int slotNum(int row)
Return 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- Returns:
- Matching slot number
-
dispose
public void dispose()
-
-