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 class
SensorTableDataModel.ImageIconRenderer
Visualize 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
_graphicState
static int
ACTIVEDELAY
static int
EDITCOL
static int
FORGETCOL
static int
INACTIVEDELAY
static int
INVERTCOL
static int
PULLUPCOL
static int
QUERYCOL
static int
USEGLOBALDELAY
-
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 void
clickOn(Sensor t)
Process a click on The value cell.void
configureTable(javax.swing.JTable table)
Configure a table to have our standard rows and columns.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.(package private) void
editButton(Sensor s)
protected Sensor
getBySystemName(java.lang.String name)
protected Sensor
getByUserName(java.lang.String name)
java.lang.String
getClassDescription()
protected java.lang.String
getClassName()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
Get Column Count INCLUDING Bean Property Columns.java.lang.String
getColumnName(int col)
protected Manager<Sensor>
getManager()
Get the Table Model Bean Manager.protected java.lang.String
getMasterClassName()
int
getPreferredWidth(int col)
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)
protected boolean
matchPropertyName(java.beans.PropertyChangeEvent e)
Is this property event announcing a change this table should display?protected void
setColumnIdentities(javax.swing.JTable table)
Set identities for any columns that need an identity.protected void
setManager(Manager<Sensor> manager)
Set the Model Bean Manager.void
setValueAt(java.lang.Object value, int row, int col)
void
showDebounce(boolean show, javax.swing.JTable table)
Show or hide the Debounce columns.void
showPullUp(boolean show, javax.swing.JTable table)
Show or hide the Pullup column.void
showStateForgetAndQuery(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, copyName, deleteBean, dispose, doDelete, editComment, 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:
getValue
in 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:
setManager
in 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:
getManager
in classBeanTableDataModel<Sensor>
- Returns:
- current Manager in use by the Model.
-
getBySystemName
protected Sensor getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemName
in classBeanTableDataModel<Sensor>
-
getByUserName
protected Sensor getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserName
in classBeanTableDataModel<Sensor>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassName
in classBeanTableDataModel<Sensor>
-
clickOn
protected void clickOn(Sensor t)
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<Sensor>
- Parameters:
t
- the Bean that has been clicked.
-
getColumnCount
public int getColumnCount()
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnCount
in classBeanTableDataModel<Sensor>
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classBeanTableDataModel<Sensor>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classBeanTableDataModel<Sensor>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidth
in classBeanTableDataModel<Sensor>
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classBeanTableDataModel<Sensor>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
SYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
getValueAt
in classBeanTableDataModel<Sensor>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in 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:
matchPropertyName
in 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:
configValueColumn
in 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:
configureTable
in classBeanTableDataModel<Sensor>
- Parameters:
table
-JTable
to 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:
setColumnIdentities
in classBeanTableDataModel<Sensor>
- Parameters:
table
- the table to set identities for.
-
-