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) classSignalHeadTableModel.AppearanceComboBoxPanelA 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>>boxMapstatic intEDITCOL(package private) java.util.Hashtable<java.lang.Object,javax.swing.JComboBox<java.lang.String>>editorMapstatic intHELDCOLstatic intLITCOL-
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 voidclearAppearanceVector(int row)Clear the old appearance comboboxes and force them to be rebuilt.voidclickOn(SignalHead t)Process a click on The value cell.javax.swing.JButtonconfigureButton()Set column width.protected voidconfigValueColumn(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.voiddispose()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.StringgetBeanType()Get String of the Single Bean Type.SignalHeadgetBySystemName(java.lang.String name)SignalHeadgetByUserName(java.lang.String name)java.lang.Class<?>getColumnClass(int col)intgetColumnCount()Get Column Count INCLUDING Bean Property Columns.java.lang.StringgetColumnName(int col)SignalHeadManagergetManager()Get the Table Model Bean Manager.protected java.lang.StringgetMasterClassName()intgetPreferredWidth(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.StringgetValue(java.lang.String name)Get the current Bean state value in human readable form.java.lang.ObjectgetValueAt(int row, int col)SYSNAMECOL returns the actual Bean, NOT the System Name.booleanisCellEditable(int row, int col)booleanmatchPropertyName(java.beans.PropertyChangeEvent e)Is this property event announcing a change this table should display?voidpropertyChange(java.beans.PropertyChangeEvent e)Respond to change from bean.voidsetValueAt(java.lang.Object value, int row, int col)-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, allowBlockNameChange, configDeleteColumn, configureJTable, configureTable, copySystemName, copyUserName, deleteBean, doDelete, editComment, exportToCSV, 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:BeanTableDataModelGet Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Overrides:
getColumnCountin classBeanTableDataModel<SignalHead>
-
getColumnName
public java.lang.String getColumnName(int col)
Description copied from class:BeanTableDataModel- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classBeanTableDataModel<SignalHead>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Description copied from class:BeanTableDataModel- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classBeanTableDataModel<SignalHead>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidthin classBeanTableDataModel<SignalHead>
-
isCellEditable
public boolean isCellEditable(int row, int col)
Description copied from class:BeanTableDataModel- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classBeanTableDataModel<SignalHead>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Description copied from class:BeanTableDataModelSYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Overrides:
getValueAtin classBeanTableDataModel<SignalHead>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
Description copied from class:BeanTableDataModel- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classBeanTableDataModel<SignalHead>
-
getValue
public java.lang.String getValue(java.lang.String name)
Description copied from class:BeanTableDataModelGet the current Bean state value in human readable form.- Specified by:
getValuein classBeanTableDataModel<SignalHead>- Parameters:
name- System name of Bean.- Returns:
- state value in localised human readable form.
-
getManager
public SignalHeadManager getManager()
Description copied from class:BeanTableDataModelGet 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:
getManagerin classBeanTableDataModel<SignalHead>- Returns:
- current Manager in use by the Model.
-
getBySystemName
public SignalHead getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemNamein classBeanTableDataModel<SignalHead>
-
getByUserName
public SignalHead getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserNamein classBeanTableDataModel<SignalHead>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassNamein classBeanTableDataModel<SignalHead>
-
clickOn
public void clickOn(SignalHead t)
Description copied from class:BeanTableDataModelProcess a click on The value cell.- Specified by:
clickOnin classBeanTableDataModel<SignalHead>- Parameters:
t- the Bean that has been clicked.
-
configureButton
public javax.swing.JButton configureButton()
Set column width.- Overrides:
configureButtonin classBeanTableDataModel<SignalHead>- Returns:
- a button to fit inside the VALUE column
-
matchPropertyName
public boolean matchPropertyName(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModelIs 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:
matchPropertyNamein 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:BeanTableDataModelGet String of the Single Bean Type. In many cases the return is Bundle localised so should not be used for matching Bean types.- Overrides:
getBeanTypein 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:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein 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:
configValueColumnin 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:BeanTableDataModelRemoves property change listeners from Beans.- Overrides:
disposein classBeanTableDataModel<SignalHead>
-
-