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 class
LightTableDataModel.ImageIconRenderer
Visualize 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
_graphicState
static int
CONTROLCOL
static int
EDITCOL
static int
ENABLECOL
static int
INTENSITYCOL
-
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 void
clickOn(Light t)
Process a click on The value cell.javax.swing.JButton
configureButton()
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.protected void
doDelete(Light bean)
Delete the bean after all the checking has been done.Light
getBySystemName(java.lang.String name)
Light
getByUserName(java.lang.String name)
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
Get Column Count INCLUDING Bean Property Columns.java.lang.String
getColumnName(int col)
Manager<Light>
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
setManager(Manager<Light> manager)
Set the Model Bean Manager.void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureJTable, configureTable, copyName, deleteBean, dispose, editComment, 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:
getManager
in 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:
setManager
in classBeanTableDataModel<Light>
- Parameters:
manager
- Bean Manager that the Model should use.
-
getColumnCount
public int getColumnCount()
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnCount
in classBeanTableDataModel<Light>
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classBeanTableDataModel<Light>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classBeanTableDataModel<Light>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidth
in classBeanTableDataModel<Light>
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classBeanTableDataModel<Light>
-
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<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:
getValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
getValueAt
in classBeanTableDataModel<Light>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in 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:
doDelete
in classBeanTableDataModel<Light>
- Parameters:
bean
- NamedBean to delete
-
matchPropertyName
protected boolean matchPropertyName(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel
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<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:
getBySystemName
in classBeanTableDataModel<Light>
-
getByUserName
public Light getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserName
in classBeanTableDataModel<Light>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassName
in classBeanTableDataModel<Light>
-
clickOn
public void clickOn(Light t)
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<Light>
- Parameters:
t
- the Bean that has been clicked.
-
configureButton
public javax.swing.JButton configureButton()
- Overrides:
configureButton
in 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:
configValueColumn
in classBeanTableDataModel<Light>
- Parameters:
table
- a JTable of Lights
-
-