Package jmri.jmrit.beantable.turnout
Class TurnoutTableDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<Turnout>
-
- jmri.jmrit.beantable.turnout.TurnoutTableDataModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel
public class TurnoutTableDataModel extends BeanTableDataModel<Turnout>
Data model for a Turnout Table. Code originally within TurnoutTableAction.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTurnoutTableDataModel.ImageIconRendererVisualize state in table as a graphic, customized for Turnouts (4 states).-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringbothText(package private) java.lang.StringcabOnlyText(package private) java.lang.StringclosedTextjava.lang.StringdefaultClosedSpeedTextjava.lang.StringdefaultThrownSpeedTextstatic intDIVERGCOLstatic intEDITCOLprotected static java.util.concurrent.atomic.AtomicBooleaneditingOpsstatic intFORGETCOLstatic intINVERTCOLstatic intKNOWNCOLstatic intLOCKCOLstatic intLOCKDECCOLstatic intLOCKOPRCOLstatic intMODECOL(package private) java.lang.StringnoneTextstatic intOPSEDITCOLstatic intOPSONOFFCOL(package private) java.lang.StringpushbutTextstatic intQUERYCOLstatic intSENSOR1COLstatic intSENSOR2COLjava.util.Vector<java.lang.String>speedListClosedjava.util.Vector<java.lang.String>speedListThrownstatic intSTRAIGHTCOL(package private) java.lang.StringthrownText(package private) java.lang.StringuseBlockSpeed-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description TurnoutTableDataModel()TurnoutTableDataModel(Manager<Turnout> mgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclickOn(Turnout t)Process a click on The value cell.voidconfigureTable(javax.swing.JTable tbl)Configure a table to have our standard rows and columns.protected voidconfigValueColumn(javax.swing.JTable table)Customize the turnout table Value (State) column to show an appropriate graphic for the turnout state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.protected javax.swing.JButtoneditButton()Create a JButton to edit a turnout's operation.(package private) voideditButton(Turnout t)Create action to edit a turnout in Edit pane.protected voideditTurnoutOperation(Turnout t, javax.swing.JComboBox<java.lang.String> box)Pop up a TurnoutOperationConfig for the turnout.TurnoutgetBySystemName(java.lang.String name)TurnoutgetByUserName(java.lang.String name)protected java.lang.StringgetClassName()java.lang.Class<?>getColumnClass(int col)intgetColumnCount()Get Column Count INCLUDING Bean Property Columns.java.lang.StringgetColumnName(int col)protected java.lang.StringgetHeaderTooltip(int col)Get a ToolTip for a Table Column Header.Manager<Turnout>getManager()Get the Table Model Bean Manager.protected java.lang.StringgetMasterClassName()intgetPreferredWidth(int col)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)protected javax.swing.JComboBox<java.lang.String>makeAutomationBox(Turnout t)Create a JComboBox<String> containing all the options for turnout automation parameters for this turnout.javax.swing.JTablemakeJTable(java.lang.String name, javax.swing.table.TableModel model, javax.swing.RowSorter<? extends javax.swing.table.TableModel> sorter)Create and configure a new table using the given model and row sorter.protected booleanmatchPropertyName(java.beans.PropertyChangeEvent e)Is this property event announcing a change this table should display?voidpropertyChange(java.beans.PropertyChangeEvent e)protected voidsetColumnIdentities(javax.swing.JTable table)Set identities for any columns that need an identity.protected voidsetManager(Manager<Turnout> manager)Set the Model Bean Manager.protected voidsetTurnoutOperation(Turnout t, javax.swing.JComboBox<java.lang.String> cb)Set the turnout's operation info based on the contents of the combo box.voidsetValueAt(java.lang.Object value, int row, int col)voidshowFeedbackChanged(boolean visible, javax.swing.JTable table)voidshowLockChanged(boolean visible, javax.swing.JTable table)voidshowStateForgetAndQueryChanged(boolean visible, javax.swing.JTable table)voidshowTurnoutSpeedChanged(boolean visible, javax.swing.JTable table)-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureButton, configureJTable, copySystemName, copyUserName, deleteBean, dispose, doDelete, editComment, exportToCSV, formatToolTip, getBeanType, getCellToolTip, getDisplayDeleteMsg, getFilter, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, moveBean, persistTable, printColumns, printTable, removeName, renameBean, setColumnToHoldButton, setDisplayDeleteMsg, setFilter, 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
-
INVERTCOL
public static final int INVERTCOL
- See Also:
- Constant Field Values
-
LOCKCOL
public static final int LOCKCOL
- See Also:
- Constant Field Values
-
EDITCOL
public static final int EDITCOL
- See Also:
- Constant Field Values
-
KNOWNCOL
public static final int KNOWNCOL
- See Also:
- Constant Field Values
-
MODECOL
public static final int MODECOL
- See Also:
- Constant Field Values
-
SENSOR1COL
public static final int SENSOR1COL
- See Also:
- Constant Field Values
-
SENSOR2COL
public static final int SENSOR2COL
- See Also:
- Constant Field Values
-
OPSONOFFCOL
public static final int OPSONOFFCOL
- See Also:
- Constant Field Values
-
OPSEDITCOL
public static final int OPSEDITCOL
- See Also:
- Constant Field Values
-
LOCKOPRCOL
public static final int LOCKOPRCOL
- See Also:
- Constant Field Values
-
LOCKDECCOL
public static final int LOCKDECCOL
- See Also:
- Constant Field Values
-
STRAIGHTCOL
public static final int STRAIGHTCOL
- See Also:
- Constant Field Values
-
DIVERGCOL
public static final int DIVERGCOL
- See Also:
- Constant Field Values
-
FORGETCOL
public static final int FORGETCOL
- See Also:
- Constant Field Values
-
QUERYCOL
public static final int QUERYCOL
- See Also:
- Constant Field Values
-
closedText
java.lang.String closedText
-
thrownText
java.lang.String thrownText
-
defaultThrownSpeedText
public java.lang.String defaultThrownSpeedText
-
defaultClosedSpeedText
public java.lang.String defaultClosedSpeedText
-
useBlockSpeed
java.lang.String useBlockSpeed
-
bothText
java.lang.String bothText
-
cabOnlyText
java.lang.String cabOnlyText
-
pushbutText
java.lang.String pushbutText
-
noneText
java.lang.String noneText
-
speedListClosed
public final java.util.Vector<java.lang.String> speedListClosed
-
speedListThrown
public final java.util.Vector<java.lang.String> speedListThrown
-
editingOps
protected static java.util.concurrent.atomic.AtomicBoolean editingOps
-
-
Constructor Detail
-
TurnoutTableDataModel
public TurnoutTableDataModel()
-
TurnoutTableDataModel
public TurnoutTableDataModel(Manager<Turnout> mgr)
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Overrides:
getColumnCountin classBeanTableDataModel<Turnout>
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classBeanTableDataModel<Turnout>
-
getHeaderTooltip
protected java.lang.String getHeaderTooltip(int col)
Get a ToolTip for a Table Column Header.- Overrides:
getHeaderTooltipin classBeanTableDataModel<Turnout>- Parameters:
col- the model column number.- Returns:
- ToolTip, else null.
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classBeanTableDataModel<Turnout>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidthin classBeanTableDataModel<Turnout>
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classBeanTableDataModel<Turnout>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
SYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Overrides:
getValueAtin classBeanTableDataModel<Turnout>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classBeanTableDataModel<Turnout>
-
getValue
public java.lang.String getValue(@Nonnull java.lang.String name)
Get the current Bean state value in human readable form.- Specified by:
getValuein classBeanTableDataModel<Turnout>- Parameters:
name- System name of Bean.- Returns:
- state value in localised human readable form.
-
getManager
public Manager<Turnout> getManager()
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:
getManagerin classBeanTableDataModel<Turnout>- Returns:
- current Manager in use by the Model.
-
setManager
protected final void setManager(@Nonnull Manager<Turnout> manager)
Set the Model Bean Manager. Note that for many Models this may not work as the manager is currently obtained directly from the Action class.- Overrides:
setManagerin classBeanTableDataModel<Turnout>- Parameters:
manager- Bean Manager that the Model should use.
-
getBySystemName
public Turnout getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemNamein classBeanTableDataModel<Turnout>
-
getByUserName
public Turnout getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserNamein classBeanTableDataModel<Turnout>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassNamein classBeanTableDataModel<Turnout>
-
getClassName
protected java.lang.String getClassName()
-
clickOn
public void clickOn(Turnout t)
Description copied from class:BeanTableDataModelProcess a click on The value cell.- Specified by:
clickOnin classBeanTableDataModel<Turnout>- Parameters:
t- the Bean that has been clicked.
-
configureTable
public void configureTable(javax.swing.JTable tbl)
Description copied from class:BeanTableDataModelConfigure 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. This also persists the table user interface state.- Overrides:
configureTablein classBeanTableDataModel<Turnout>- Parameters:
tbl-JTableto configure
-
matchPropertyName
protected 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<Turnout>- Parameters:
e- the event to match- Returns:
- true if the property name is of interest, false otherwise
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein classBeanTableDataModel<Turnout>
-
configValueColumn
protected void configValueColumn(javax.swing.JTable table)
Customize the turnout table Value (State) column to show an appropriate graphic for the turnout state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.- Overrides:
configValueColumnin classBeanTableDataModel<Turnout>- Parameters:
table- a JTable of Turnouts
-
makeJTable
public javax.swing.JTable makeJTable(@Nonnull java.lang.String name, @Nonnull javax.swing.table.TableModel model, @CheckForNull javax.swing.RowSorter<? extends javax.swing.table.TableModel> sorter)
Description copied from class:BeanTableDataModelCreate and configure a new table using the given model and row sorter.- Overrides:
makeJTablein classBeanTableDataModel<Turnout>- Parameters:
name- the name of the tablemodel- the data model for the tablesorter- the row sorter for the table; if null, the table will not be sortable- Returns:
- the table
-
setColumnIdentities
protected void setColumnIdentities(javax.swing.JTable table)
Description copied from class:BeanTableDataModelSet identities for any columns that need an identity. It is recommended that all columns get a constant identity to prevent identities from being subject to changes due to translation.The default implementation sets column identities to the String
Column#where#is the model index for the column. Note that if the TableColumnModel is aXTableColumnModel, the index includes hidden columns.- Overrides:
setColumnIdentitiesin classBeanTableDataModel<Turnout>- Parameters:
table- the table to set identities for.
-
editTurnoutOperation
protected void editTurnoutOperation(@Nonnull Turnout t, javax.swing.JComboBox<java.lang.String> box)
Pop up a TurnoutOperationConfig for the turnout.- Parameters:
t- turnoutbox- JComboBox that triggered the edit
-
makeAutomationBox
protected javax.swing.JComboBox<java.lang.String> makeAutomationBox(Turnout t)
Create a JComboBox<String> containing all the options for turnout automation parameters for this turnout.- Parameters:
t- the turnout- Returns:
- the JComboBox
-
setTurnoutOperation
protected void setTurnoutOperation(@Nonnull Turnout t, javax.swing.JComboBox<java.lang.String> cb)
Set the turnout's operation info based on the contents of the combo box.- Parameters:
t- turnout being configuredcb- JComboBox for ops for t in the TurnoutTable
-
editButton
void editButton(Turnout t)
Create action to edit a turnout in Edit pane. (also used in windowTest)- Parameters:
t- the turnout to be edited
-
editButton
protected javax.swing.JButton editButton()
Create a JButton to edit a turnout's operation.- Returns:
- the JButton
-
showFeedbackChanged
public void showFeedbackChanged(boolean visible, javax.swing.JTable table)
-
showLockChanged
public void showLockChanged(boolean visible, javax.swing.JTable table)
-
showTurnoutSpeedChanged
public void showTurnoutSpeedChanged(boolean visible, javax.swing.JTable table)
-
showStateForgetAndQueryChanged
public void showStateForgetAndQueryChanged(boolean visible, javax.swing.JTable table)
-
-