Package jmri.jmrit.beantable
Class SignalHeadTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<SignalHead>
-
- jmri.jmrit.beantable.SignalHeadTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class SignalHeadTableModel extends BeanTableDataModel<SignalHead>
Model for a SignalHeadTable. Code originally located within SignalHeadTableAction.java- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SignalHeadTableModel.AppearanceComboBoxPanel
A row specific Appearance combobox cell editor/renderer.-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer, BeanTableDataModel.DateRenderer, BeanTableDataModel.DeleteBeanWorker, BeanTableDataModel.HeaderActionListener, BeanTableDataModel.PopupListener, BeanTableDataModel.TableHeaderListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Hashtable<java.lang.Object,java.util.Vector<java.lang.String>>
boxMap
static int
EDITCOL
(package private) java.util.Hashtable<java.lang.Object,javax.swing.JComboBox<java.lang.String>>
editorMap
static int
HELDCOL
static int
LITCOL
-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description SignalHeadTableModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearAppearanceVector(int row)
Clear the old appearance comboboxes and force them to be rebuilt.void
clickOn(SignalHead t)
Process a click on The value cell.javax.swing.JButton
configureButton()
Set column width.protected void
configValueColumn(javax.swing.JTable table)
Customize the SignalHead Value (Appearance) column to show an appropriate ComboBox of available Appearances when the TableDataModel is being called from ListedTableAction.void
dispose()
Removes property change listeners from Beans.javax.swing.JComboBox<java.lang.String>
getAppearanceEditorBox(int row)
Provide a JComboBox element to display inside the JPanel CellEditor.protected java.lang.String
getBeanType()
Get String of the Single Bean Type.SignalHead
getBySystemName(java.lang.String name)
SignalHead
getByUserName(java.lang.String name)
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
Get Column Count INCLUDING Bean Property Columns.java.lang.String
getColumnName(int col)
SignalHeadManager
getManager()
Get the Table Model Bean Manager.protected java.lang.String
getMasterClassName()
int
getPreferredWidth(int col)
(package private) java.util.Vector<java.lang.String>
getRowVector(int row)
Holds a Hashtable of valid appearances per signal head, used by getEditorBox()java.util.Vector<java.lang.String>
getValidAppearances(SignalHead head)
Get a list of all the valid appearances that have not been disabled.java.lang.String
getValue(java.lang.String name)
Get the current Bean state value in human readable form.java.lang.Object
getValueAt(int row, int col)
SYSNAMECOL returns the actual Bean, NOT the System Name.boolean
isCellEditable(int row, int col)
boolean
matchPropertyName(java.beans.PropertyChangeEvent e)
Is this property event announcing a change this table should display?void
propertyChange(java.beans.PropertyChangeEvent e)
Respond to change from bean.void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, allowBlockNameChange, configDeleteColumn, configureJTable, configureTable, copyName, deleteBean, doDelete, editComment, formatToolTip, getCellToolTip, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, makeJTable, moveBean, persistTable, printColumns, printTable, removeName, renameBean, setColumnIdentities, setColumnToHoldButton, setDisplayDeleteMsg, setFilter, setManager, setPropertyColumnsVisible, showPopup, showTableHeaderPopup, stopPersistingTable, updateNameList
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
LITCOL
public static final int LITCOL
- See Also:
- Constant Field Values
-
HELDCOL
public static final int HELDCOL
- See Also:
- Constant Field Values
-
EDITCOL
public static final int EDITCOL
- See Also:
- Constant Field Values
-
editorMap
final java.util.Hashtable<java.lang.Object,javax.swing.JComboBox<java.lang.String>> editorMap
-
boxMap
final java.util.Hashtable<java.lang.Object,java.util.Vector<java.lang.String>> boxMap
-
-
Constructor Detail
-
SignalHeadTableModel
public SignalHeadTableModel()
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Description copied from class:BeanTableDataModel
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnCount
in classBeanTableDataModel<SignalHead>
-
getColumnName
public java.lang.String getColumnName(int col)
Description copied from class:BeanTableDataModel
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classBeanTableDataModel<SignalHead>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Description copied from class:BeanTableDataModel
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classBeanTableDataModel<SignalHead>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidth
in classBeanTableDataModel<SignalHead>
-
isCellEditable
public boolean isCellEditable(int row, int col)
Description copied from class:BeanTableDataModel
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classBeanTableDataModel<SignalHead>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Description copied from class:BeanTableDataModel
SYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
getValueAt
in classBeanTableDataModel<SignalHead>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
Description copied from class:BeanTableDataModel
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classBeanTableDataModel<SignalHead>
-
getValue
public java.lang.String getValue(java.lang.String name)
Description copied from class:BeanTableDataModel
Get the current Bean state value in human readable form.- Specified by:
getValue
in classBeanTableDataModel<SignalHead>
- Parameters:
name
- System name of Bean.- Returns:
- state value in localised human readable form.
-
getManager
public SignalHeadManager getManager()
Description copied from class:BeanTableDataModel
Get the Table Model Bean Manager. In many cases, especially around Model startup, this will be the Proxy Manager, which is then changed to the hardware specific manager.- Specified by:
getManager
in classBeanTableDataModel<SignalHead>
- Returns:
- current Manager in use by the Model.
-
getBySystemName
public SignalHead getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemName
in classBeanTableDataModel<SignalHead>
-
getByUserName
public SignalHead getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserName
in classBeanTableDataModel<SignalHead>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassName
in classBeanTableDataModel<SignalHead>
-
clickOn
public void clickOn(SignalHead t)
Description copied from class:BeanTableDataModel
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<SignalHead>
- Parameters:
t
- the Bean that has been clicked.
-
configureButton
public javax.swing.JButton configureButton()
Set column width.- Overrides:
configureButton
in classBeanTableDataModel<SignalHead>
- Returns:
- a button to fit inside the VALUE column
-
matchPropertyName
public boolean matchPropertyName(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel
Is this property event announcing a change this table should display?Note that events will come both from the NamedBeans and also from the manager
- Overrides:
matchPropertyName
in classBeanTableDataModel<SignalHead>
- Parameters:
e
- the event to match- Returns:
- true if the property name is of interest, false otherwise
-
getBeanType
protected java.lang.String getBeanType()
Description copied from class:BeanTableDataModel
Get String of the Single Bean Type. In many cases the return is Bundle localised so should not be used for matching Bean types.- Overrides:
getBeanType
in classBeanTableDataModel<SignalHead>
- Returns:
- Bean Type String.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Respond to change from bean. Prevent Appearance change when Signal Head is set to Hold or Unlit.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Overrides:
propertyChange
in classBeanTableDataModel<SignalHead>
- Parameters:
e
- A property change of any bean
-
configValueColumn
protected void configValueColumn(javax.swing.JTable table)
Customize the SignalHead Value (Appearance) column to show an appropriate ComboBox of available Appearances when the TableDataModel is being called from ListedTableAction.- Overrides:
configValueColumn
in classBeanTableDataModel<SignalHead>
- Parameters:
table
- a JTable of Signal Head
-
clearAppearanceVector
public void clearAppearanceVector(int row)
Clear the old appearance comboboxes and force them to be rebuilt. Used with the Single Output Signal Head to capture reconfiguration.- Parameters:
row
- Index of the signal mast (in TableDataModel) to be rebuilt in the Hashtables
-
getAppearanceEditorBox
public javax.swing.JComboBox<java.lang.String> getAppearanceEditorBox(int row)
Provide a JComboBox element to display inside the JPanel CellEditor. When not yet present, create, store and return a new one.- Parameters:
row
- Index number (in TableDataModel)- Returns:
- A combobox containing the valid appearance names for this mast
-
getValidAppearances
public java.util.Vector<java.lang.String> getValidAppearances(SignalHead head)
Get a list of all the valid appearances that have not been disabled.- Parameters:
head
- the name of the signal head- Returns:
- List of valid signal head appearance names
-
getRowVector
java.util.Vector<java.lang.String> getRowVector(int row)
Holds a Hashtable of valid appearances per signal head, used by getEditorBox()- Parameters:
row
- Index number (in TableDataModel)- Returns:
- The Vector of valid appearance names for this mast to show in the JComboBox
-
dispose
public void dispose()
Description copied from class:BeanTableDataModel
Removes property change listeners from Beans.- Overrides:
dispose
in classBeanTableDataModel<SignalHead>
-
-