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 intACTIVE_COLUMNstatic intDEL_COLUMNstatic intEDIT_COLUMNstatic intENABLE_COLUMNstatic intSYSNAME_COLUMNstatic intUSERNAME_COLUMN
-
Constructor Summary
Constructors Constructor Description SignalMastAspectModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigEditColumn(javax.swing.JTable table)Display buttons in 2 columns of the manual control signal masts table.voidconfigureTable(javax.swing.JTable table)protected voiddeletePair(int r)voiddispose()Remove references to and from this object, so that it can eventually be garbage-collected.protected voideditPair(int r)Respond to the Edit Logic button being clicked.java.lang.Class<?>getColumnClass(int c)intgetColumnCount()Get the number of columns in the signal masts table.java.lang.StringgetColumnName(int col)intgetPreferredWidth(int col)intgetRowCount()Get the number of Included signal masts for this SML.java.lang.ObjectgetValueAt(int r, int c)Retrieve the contents to display in a cell in the table, in terms of modelbooleanisCellEditable(int r, int c)Query whether the cells in a table column should respond to clicks.voidpropertyChange(java.beans.PropertyChangeEvent e)Listen for changes to specific properties of the displayed Signal Masts.protected voidsetColumnToHoldButton(javax.swing.JTable table, int column, javax.swing.JButton sample)Helper function forconfigEditColumn(JTable).voidsetSetToState(java.lang.String x)voidsetValueAt(java.lang.Object type, int r, int c)Process the contents from a table cell, in terms of model(package private) voidupdateSignalMastLogic(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:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin 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:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein 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:
propertyChangein 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:
getColumnCountin 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:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein 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:
getRowCountin 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:
getValueAtin 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:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classjavax.swing.table.AbstractTableModel- Parameters:
type- the object type of the cell contentsr- index for the cell rowc- index for the cell column
-
-