Package jmri.jmrit.beantable.light
Class LightTableDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<Light>
-
- jmri.jmrit.beantable.light.LightTableDataModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.io.Serializable,java.util.EventListener,javax.swing.table.TableModel
public class LightTableDataModel extends BeanTableDataModel<Light>
Data model for a Light Table. Code originally within LightTableAction.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classLightTableDataModel.ImageIconRendererVisualize state in table as a graphic, customized for Lights (2 states + ... for transitioning).-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean_graphicStatestatic intCONTROLCOLstatic intEDITCOLstatic intENABLECOLstatic intINTENSITYCOL-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description LightTableDataModel()LightTableDataModel(Manager<Light> mgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclickOn(Light t)Process a click on The value cell.javax.swing.JButtonconfigureButton()protected voidconfigValueColumn(javax.swing.JTable table)Customize the light table Value (State) column to show an appropriate graphic for the light state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.protected voiddoDelete(Light bean)Delete the bean after all the checking has been done.LightgetBySystemName(java.lang.String name)LightgetByUserName(java.lang.String name)java.lang.Class<?>getColumnClass(int col)intgetColumnCount()Get Column Count INCLUDING Bean Property Columns.java.lang.StringgetColumnName(int col)Manager<Light>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 voidsetManager(Manager<Light> manager)Set the Model Bean Manager.voidsetValueAt(java.lang.Object value, int row, int col)-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureJTable, configureTable, copySystemName, copyUserName, deleteBean, dispose, editComment, exportToCSV, formatToolTip, getBeanType, getCellToolTip, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, makeJTable, moveBean, persistTable, printColumns, printTable, propertyChange, removeName, renameBean, setColumnIdentities, 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
-
ENABLECOL
public static final int ENABLECOL
- See Also:
- Constant Field Values
-
INTENSITYCOL
public static final int INTENSITYCOL
- See Also:
- Constant Field Values
-
EDITCOL
public static final int EDITCOL
- See Also:
- Constant Field Values
-
CONTROLCOL
public static final int CONTROLCOL
- See Also:
- Constant Field Values
-
_graphicState
protected boolean _graphicState
-
-
Constructor Detail
-
LightTableDataModel
public LightTableDataModel()
-
LightTableDataModel
public LightTableDataModel(Manager<Light> mgr)
-
-
Method Detail
-
getManager
@Nonnull public Manager<Light> 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<Light>- Returns:
- current Manager in use by the Model.
-
setManager
protected final void setManager(@Nonnull Manager<Light> 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<Light>- Parameters:
manager- Bean Manager that the Model should use.
-
getColumnCount
public int getColumnCount()
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Overrides:
getColumnCountin classBeanTableDataModel<Light>
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classBeanTableDataModel<Light>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classBeanTableDataModel<Light>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidthin classBeanTableDataModel<Light>
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classBeanTableDataModel<Light>
-
getValue
public java.lang.String getValue(java.lang.String name)
Get the current Bean state value in human readable form.- Specified by:
getValuein classBeanTableDataModel<Light>- Parameters:
name- System name of Bean.- Returns:
- state value in localised human readable form.
-
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<Light>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classBeanTableDataModel<Light>
-
doDelete
protected void doDelete(Light bean)
Delete the bean after all the checking has been done.Deactivate the light, then use the superclass to delete it.
- Overrides:
doDeletein classBeanTableDataModel<Light>- Parameters:
bean- NamedBean to delete
-
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<Light>- Parameters:
e- the event to match- Returns:
- true if the property name is of interest, false otherwise
-
getBySystemName
public Light getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemNamein classBeanTableDataModel<Light>
-
getByUserName
public Light getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserNamein classBeanTableDataModel<Light>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassNamein classBeanTableDataModel<Light>
-
clickOn
public void clickOn(Light t)
Process a click on The value cell.- Specified by:
clickOnin classBeanTableDataModel<Light>- Parameters:
t- the Bean that has been clicked.
-
configureButton
public javax.swing.JButton configureButton()
- Overrides:
configureButtonin classBeanTableDataModel<Light>
-
configValueColumn
protected void configValueColumn(javax.swing.JTable table)
Customize the light table Value (State) column to show an appropriate graphic for the light state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.- Overrides:
configValueColumnin classBeanTableDataModel<Light>- Parameters:
table- a JTable of Lights
-
-