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 class
SprogSlotMonDataModel.Notify
-
Field Summary
Fields Modifier and Type Field Description static int
ADDRCOLUMN
static int
DIRCOLUMN
(package private) static java.lang.Boolean
False
static int
NUMCOLUMN
static int
SLOTCOLUMN
static int
SPDCOLUMN
static int
STATCOLUMN
(package private) static java.lang.Boolean
True
-
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 void
configureTable(javax.swing.JTable slotTable)
Configure a table to have our standard rows and columns.void
dispose()
java.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.java.lang.Object
getValueAt(int row, int col)
boolean
isCellEditable(int row, int col)
void
notifyChangedSlot(SprogSlot s)
void
setValueAt(java.lang.Object value, int row, int col)
void
showAllSlots(boolean val)
protected int
slotNum(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:
getRowCount
in interfacejavax.swing.table.TableModel
-
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
-
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:
notifyChangedSlot
in 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()
-
-