Package jmri.jmrit.signalling
Class SignallingSourcePanel.SignalMastAspectModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.signalling.SignallingSourcePanel.SignalMastAspectModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
- Enclosing class:
- SignallingSourcePanel
public class SignallingSourcePanel.SignalMastAspectModel extends javax.swing.table.AbstractTableModel implements java.beans.PropertyChangeListener
TableModel to store SML control Signal Masts and their Set To Aspect.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTIVE_COLUMN
static int
DEL_COLUMN
static int
EDIT_COLUMN
static int
ENABLE_COLUMN
static int
SYSNAME_COLUMN
static int
USERNAME_COLUMN
-
Constructor Summary
Constructors Constructor Description SignalMastAspectModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configEditColumn(javax.swing.JTable table)
Display buttons in 2 columns of the manual control signal masts table.void
configureTable(javax.swing.JTable table)
protected void
deletePair(int r)
void
dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.protected void
editPair(int r)
Respond to the Edit Logic button being clicked.java.lang.Class<?>
getColumnClass(int c)
int
getColumnCount()
Get the number of columns in the signal masts table.java.lang.String
getColumnName(int col)
int
getPreferredWidth(int col)
int
getRowCount()
Get the number of Included signal masts for this SML.java.lang.Object
getValueAt(int r, int c)
Retrieve the contents to display in a cell in the table, in terms of modelboolean
isCellEditable(int r, int c)
Query whether the cells in a table column should respond to clicks.void
propertyChange(java.beans.PropertyChangeEvent e)
Listen for changes to specific properties of the displayed Signal Masts.protected void
setColumnToHoldButton(javax.swing.JTable table, int column, javax.swing.JButton sample)
Helper function forconfigEditColumn(JTable)
.void
setSetToState(java.lang.String x)
void
setValueAt(java.lang.Object type, int r, int c)
Process the contents from a table cell, in terms of model(package private) void
updateSignalMastLogic(SignalMastLogic smlOld, SignalMastLogic smlNew)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
SYSNAME_COLUMN
public static final int SYSNAME_COLUMN
- See Also:
- Constant Field Values
-
USERNAME_COLUMN
public static final int USERNAME_COLUMN
- See Also:
- Constant Field Values
-
ACTIVE_COLUMN
public static final int ACTIVE_COLUMN
- See Also:
- Constant Field Values
-
ENABLE_COLUMN
public static final int ENABLE_COLUMN
- See Also:
- Constant Field Values
-
EDIT_COLUMN
public static final int EDIT_COLUMN
- See Also:
- Constant Field Values
-
DEL_COLUMN
public static final int DEL_COLUMN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SignalMastAspectModel
SignalMastAspectModel()
-
-
Method Detail
-
updateSignalMastLogic
void updateSignalMastLogic(SignalMastLogic smlOld, SignalMastLogic smlNew)
-
getColumnClass
public java.lang.Class<?> getColumnClass(int c)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
configureTable
public void configureTable(javax.swing.JTable table)
-
getPreferredWidth
public int getPreferredWidth(int col)
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
dispose
public void dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Listen for changes to specific properties of the displayed Signal Masts.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Parameters:
e
- The ChangeEvent heard
-
configEditColumn
protected void configEditColumn(javax.swing.JTable table)
Display buttons in 2 columns of the manual control signal masts table.- Parameters:
table
- The control signal mast table to be configured
-
setColumnToHoldButton
protected void setColumnToHoldButton(javax.swing.JTable table, int column, javax.swing.JButton sample)
Helper function forconfigEditColumn(JTable)
.- Parameters:
table
- The control signal mast table to be configuredcolumn
- Index for the column to put the button insample
- JButton to put there
-
getColumnCount
public int getColumnCount()
Get the number of columns in the signal masts table.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Returns:
- Fixed value of 6
-
isCellEditable
public boolean isCellEditable(int r, int c)
Query whether the cells in a table column should respond to clicks.- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
- Parameters:
r
- Index for the cell rowc
- Index for the cell column
-
editPair
protected void editPair(int r)
Respond to the Edit Logic button being clicked.- Parameters:
r
- Index for the cell row
-
deletePair
protected void deletePair(int r)
-
setSetToState
public void setSetToState(java.lang.String x)
-
getRowCount
public int getRowCount()
Get the number of Included signal masts for this SML.- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
-
getValueAt
public java.lang.Object getValueAt(int r, int c)
Retrieve the contents to display in a cell in the table, in terms of model- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Parameters:
r
- index for the cell rowc
- index for the cell column- Returns:
- The value (text) stored in the cell
-
setValueAt
public void setValueAt(java.lang.Object type, int r, int c)
Process the contents from a table cell, in terms of model- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
- Parameters:
type
- the object type of the cell contentsr
- index for the cell rowc
- index for the cell column
-
-