Package jmri.jmrit.beantable.sensor
Class SensorTableDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<Sensor>
-
- jmri.jmrit.beantable.sensor.SensorTableDataModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel
public class SensorTableDataModel extends BeanTableDataModel<Sensor>
Data model for a SensorTable.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSensorTableDataModel.ImageIconRendererVisualize state in table as a graphic, customized for Sensors (2 states).-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean_graphicStatestatic intACTIVEDELAYstatic intEDITCOLstatic intFORGETCOLstatic intINACTIVEDELAYstatic intINVERTCOLstatic intPULLUPCOLstatic intQUERYCOLstatic intUSEGLOBALDELAY-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description SensorTableDataModel()Create a new Sensor Table Data Model.SensorTableDataModel(Manager<Sensor> manager)Create a new Sensor Table Data Model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclickOn(Sensor t)Process a click on The value cell.voidconfigureTable(javax.swing.JTable table)Configure a table to have our standard rows and columns.protected voidconfigValueColumn(javax.swing.JTable table)Customize the sensor table Value (State) column to show an appropriate graphic for the sensor state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.(package private) voideditButton(Sensor s)protected SensorgetBySystemName(java.lang.String name)protected SensorgetByUserName(java.lang.String name)java.lang.StringgetClassDescription()protected java.lang.StringgetClassName()java.lang.Class<?>getColumnClass(int col)intgetColumnCount()Get Column Count INCLUDING Bean Property Columns.java.lang.StringgetColumnName(int col)protected Manager<Sensor>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 booleanmatchPropertyName(java.beans.PropertyChangeEvent e)Is this property event announcing a change this table should display?protected voidsetColumnIdentities(javax.swing.JTable table)Set identities for any columns that need an identity.protected voidsetManager(Manager<Sensor> manager)Set the Model Bean Manager.voidsetValueAt(java.lang.Object value, int row, int col)voidshowDebounce(boolean show, javax.swing.JTable table)Show or hide the Debounce columns.voidshowPullUp(boolean show, javax.swing.JTable table)Show or hide the Pullup column.voidshowStateForgetAndQuery(boolean show, javax.swing.JTable table)Show or hide the State - Forget and Query columns.FORGETCOL, QUERYCOL-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureButton, configureJTable, copySystemName, copyUserName, deleteBean, dispose, doDelete, editComment, exportToCSV, formatToolTip, getBeanType, getCellToolTip, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, makeJTable, moveBean, persistTable, printColumns, printTable, propertyChange, 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
-
EDITCOL
public static final int EDITCOL
- See Also:
- Constant Field Values
-
USEGLOBALDELAY
public static final int USEGLOBALDELAY
- See Also:
- Constant Field Values
-
ACTIVEDELAY
public static final int ACTIVEDELAY
- See Also:
- Constant Field Values
-
INACTIVEDELAY
public static final int INACTIVEDELAY
- See Also:
- Constant Field Values
-
PULLUPCOL
public static final int PULLUPCOL
- 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
-
_graphicState
protected boolean _graphicState
-
-
Constructor Detail
-
SensorTableDataModel
public SensorTableDataModel()
Create a new Sensor Table Data Model. The default Manager for the bean type will be a Proxy Manager.
-
SensorTableDataModel
public SensorTableDataModel(Manager<Sensor> manager)
Create a new Sensor Table Data Model. The default Manager for the bean type will be a Proxy Manager unless one is specified here.- Parameters:
manager- Bean Manager.
-
-
Method Detail
-
getValue
public java.lang.String getValue(java.lang.String name)
Get the current Bean state value in human readable form.- Specified by:
getValuein classBeanTableDataModel<Sensor>- Parameters:
name- System name of Bean.- Returns:
- state value in localised human readable form.
-
setManager
protected final void setManager(@Nonnull Manager<Sensor> 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<Sensor>- Parameters:
manager- Bean Manager that the Model should use.
-
getManager
protected Manager<Sensor> 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<Sensor>- Returns:
- current Manager in use by the Model.
-
getBySystemName
protected Sensor getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemNamein classBeanTableDataModel<Sensor>
-
getByUserName
protected Sensor getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserNamein classBeanTableDataModel<Sensor>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassNamein classBeanTableDataModel<Sensor>
-
clickOn
protected void clickOn(Sensor t)
Process a click on The value cell.- Specified by:
clickOnin classBeanTableDataModel<Sensor>- Parameters:
t- the Bean that has been clicked.
-
getColumnCount
public int getColumnCount()
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Overrides:
getColumnCountin classBeanTableDataModel<Sensor>
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classBeanTableDataModel<Sensor>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classBeanTableDataModel<Sensor>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidthin classBeanTableDataModel<Sensor>
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classBeanTableDataModel<Sensor>
-
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<Sensor>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classBeanTableDataModel<Sensor>
-
matchPropertyName
protected boolean matchPropertyName(java.beans.PropertyChangeEvent e)
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:
matchPropertyNamein classBeanTableDataModel<Sensor>- Parameters:
e- the event to match- Returns:
- true if the property name is of interest, false otherwise
-
configValueColumn
protected void configValueColumn(javax.swing.JTable table)
Customize the sensor table Value (State) column to show an appropriate graphic for the sensor state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.- Overrides:
configValueColumnin classBeanTableDataModel<Sensor>- Parameters:
table- a JTable of Sensors
-
configureTable
public void configureTable(javax.swing.JTable table)
Configure 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<Sensor>- Parameters:
table-JTableto configure
-
editButton
void editButton(Sensor s)
-
showDebounce
public void showDebounce(boolean show, javax.swing.JTable table)
Show or hide the Debounce columns. USEGLOBALDELAY, ACTIVEDELAY, INACTIVEDELAY- Parameters:
show- true to display, false to hide.table- the JTable to set column visibility on.
-
showPullUp
public void showPullUp(boolean show, javax.swing.JTable table)
Show or hide the Pullup column. PULLUPCOL- Parameters:
show- true to display, false to hide.table- the JTable to set column visibility on.
-
showStateForgetAndQuery
public void showStateForgetAndQuery(boolean show, javax.swing.JTable table)
Show or hide the State - Forget and Query columns.FORGETCOL, QUERYCOL- Parameters:
show- true to display, false to hide.table- the JTable to set column visibility on.
-
getClassName
protected java.lang.String getClassName()
-
getClassDescription
public java.lang.String getClassDescription()
-
setColumnIdentities
protected void setColumnIdentities(javax.swing.JTable table)
Set 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<Sensor>- Parameters:
table- the table to set identities for.
-
-