Package jmri.jmrit.beantable.oblock
Class OBlockTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<OBlock>
-
- jmri.jmrit.beantable.oblock.OBlockTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class OBlockTableModel extends BeanTableDataModel<OBlock>
GUI to define OBlocks.Duplicates the JTable model for BlockTableAction and adds a column for the occupancy sensor. Configured for use within an internal frame.
Can be used with two interfaces:
- original "desktop" InternalFrames (parent class TableFrames, an extended JmriJFrame)
- JMRI "standard" Tabbed tables (parent class JPanel)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OBlockTableModel.CurveComboBoxPanel
Provide a table cell renderer looking like a JComboBox as an editor/renderer for the OBlock table CURVE column.static class
OBlockTableModel.SpeedComboBoxPanel
Provide a table cell renderer looking like a JComboBox as an editor/renderer for the OBlock table SPEED column.-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) OBlockManager
_manager
(package private) TableFrames
_parent
static int
COMMENTCOL
static int
CURVECOL
static int
DELETE_COL
static int
EDIT_COL
static int
ERR_SENSORCOL
static int
LENGTHCOL
static int
NUMCOLS
static int
PERMISSIONCOL
static int
REPORT_CURRENTCOL
static int
REPORTERCOL
static int
SENSORCOL
static int
SPEEDCOL
static int
STATECOL
static int
SYSNAMECOL
(package private) java.text.DecimalFormat
twoDigit
static int
UNITSCOL
static int
USERNAMECOL
static int
VALUE
static int
WARRANTCOL
(package private) static java.lang.String
ZEROS
-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
DELETECOL, NUMCOLUMN, sysNameList, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description OBlockTableModel(TableFrames parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHeaderListener(javax.swing.JTable table)
Respond to mouse events to show/hide columns.protected void
changeUnits()
void
clickOn(OBlock t)
Process a click on The value cell.void
configCurveColumn(javax.swing.JTable table)
Customize the Turnout column to show an appropriate ComboBox of available options.void
configSpeedColumn(javax.swing.JTable table)
Customize the Turnout column to show an appropriate ComboBox of available options.(package private) void
deleteBean(OBlock bean)
protected java.util.List<OBlock>
getBeanList()
protected java.lang.String
getBeanType()
Get String of the Single Bean Type.OBlock
getBySystemName(java.lang.String name)
OBlock
getByUserName(java.lang.String name)
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)
(package private) static javax.swing.JComboBox<java.lang.String>
getCurveEditorBox(int row)
Provide a static JComboBox element to display inside the JPanel CellEditor.Manager<OBlock>
getManager()
Get the Table Model Bean Manager.protected java.lang.String
getMasterClassName()
int
getPreferredWidth(int col)
int
getRowCount()
(package private) static javax.swing.JComboBox<java.lang.String>
getSpeedEditorBox(int row)
Provide a static JComboBox element to display inside the JPanel CellEditor.protected static java.lang.String
getValue(int state)
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.(package private) void
initTempRow()
boolean
isCellEditable(int row, int col)
protected boolean
isMetric()
void
propertyChange(java.beans.PropertyChangeEvent e)
void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureButton, configureJTable, configureTable, configValueColumn, copyName, deleteBean, dispose, doDelete, editComment, exportToCSV, formatToolTip, getCellToolTip, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, isClearUserNameAllowed, makeJTable, matchPropertyName, moveBean, persistTable, printColumns, printTable, removeName, renameBean, setColumnIdentities, setColumnToHoldButton, setDisplayDeleteMsg, setFilter, setManager, 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
-
SYSNAMECOL
public static final int SYSNAMECOL
- See Also:
- Constant Field Values
-
USERNAMECOL
public static final int USERNAMECOL
- See Also:
- Constant Field Values
-
COMMENTCOL
public static final int COMMENTCOL
- See Also:
- Constant Field Values
-
STATECOL
public static final int STATECOL
- See Also:
- Constant Field Values
-
SENSORCOL
public static final int SENSORCOL
- See Also:
- Constant Field Values
-
EDIT_COL
public static final int EDIT_COL
- See Also:
- Constant Field Values
-
DELETE_COL
public static final int DELETE_COL
- See Also:
- Constant Field Values
-
LENGTHCOL
public static final int LENGTHCOL
- See Also:
- Constant Field Values
-
UNITSCOL
public static final int UNITSCOL
- See Also:
- Constant Field Values
-
REPORTERCOL
public static final int REPORTERCOL
- See Also:
- Constant Field Values
-
REPORT_CURRENTCOL
public static final int REPORT_CURRENTCOL
- See Also:
- Constant Field Values
-
PERMISSIONCOL
public static final int PERMISSIONCOL
- See Also:
- Constant Field Values
-
SPEEDCOL
public static final int SPEEDCOL
- See Also:
- Constant Field Values
-
WARRANTCOL
public static final int WARRANTCOL
- See Also:
- Constant Field Values
-
ERR_SENSORCOL
public static final int ERR_SENSORCOL
- See Also:
- Constant Field Values
-
CURVECOL
public static final int CURVECOL
- See Also:
- Constant Field Values
-
VALUE
public static final int VALUE
- See Also:
- Constant Field Values
-
NUMCOLS
public static final int NUMCOLS
- See Also:
- Constant Field Values
-
ZEROS
static java.lang.String ZEROS
-
twoDigit
java.text.DecimalFormat twoDigit
-
_manager
OBlockManager _manager
-
_parent
TableFrames _parent
-
-
Constructor Detail
-
OBlockTableModel
public OBlockTableModel(@Nonnull TableFrames parent)
-
-
Method Detail
-
addHeaderListener
public void addHeaderListener(javax.swing.JTable table)
Respond to mouse events to show/hide columns. Has public access to allow setting from OBlockTableAction OBlock Panel.- Parameters:
table
- the table based on this model
-
initTempRow
void initTempRow()
-
getManager
public Manager<OBlock> getManager()
Description copied from class:BeanTableDataModel
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<OBlock>
- Returns:
- current Manager in use by the Model.
-
getBySystemName
public OBlock getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemName
in classBeanTableDataModel<OBlock>
-
getByUserName
public OBlock getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserName
in classBeanTableDataModel<OBlock>
-
getBeanType
protected java.lang.String getBeanType()
Description copied from class:BeanTableDataModel
Get String of the Single Bean Type. In many cases the return is Bundle localised so should not be used for matching Bean types.- Overrides:
getBeanType
in classBeanTableDataModel<OBlock>
- Returns:
- Bean Type String.
-
clickOn
public void clickOn(OBlock t)
Description copied from class:BeanTableDataModel
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<OBlock>
- Parameters:
t
- the Bean that has been clicked.
-
isMetric
protected boolean isMetric()
-
changeUnits
protected void changeUnits()
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassName
in classBeanTableDataModel<OBlock>
-
getBeanList
protected java.util.List<OBlock> getBeanList()
-
getValue
public java.lang.String getValue(java.lang.String name)
Description copied from class:BeanTableDataModel
Get the current Bean state value in human readable form.- Specified by:
getValue
in classBeanTableDataModel<OBlock>
- Parameters:
name
- System name of Bean.- Returns:
- state value in localised human readable form.
-
getValue
protected static java.lang.String getValue(int state)
-
getColumnCount
public int getColumnCount()
Description copied from class:BeanTableDataModel
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnCount
in classBeanTableDataModel<OBlock>
-
getRowCount
public int getRowCount()
Description copied from class:BeanTableDataModel
- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
- Overrides:
getRowCount
in classBeanTableDataModel<OBlock>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Description copied from class:BeanTableDataModel
SYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
getValueAt
in classBeanTableDataModel<OBlock>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
Description copied from class:BeanTableDataModel
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classBeanTableDataModel<OBlock>
-
getColumnName
public java.lang.String getColumnName(int col)
Description copied from class:BeanTableDataModel
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classBeanTableDataModel<OBlock>
-
deleteBean
void deleteBean(OBlock bean)
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Description copied from class:BeanTableDataModel
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classBeanTableDataModel<OBlock>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidth
in classBeanTableDataModel<OBlock>
-
isCellEditable
public boolean isCellEditable(int row, int col)
Description copied from class:BeanTableDataModel
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classBeanTableDataModel<OBlock>
-
getCurveEditorBox
static javax.swing.JComboBox<java.lang.String> getCurveEditorBox(int row)
Provide a static JComboBox element to display inside the JPanel CellEditor. When not yet present, create, store and return a new one.- Parameters:
row
- Index number (in TableDataModel)- Returns:
- A JCombobox containing the valid curvature names.
-
configCurveColumn
public void configCurveColumn(javax.swing.JTable table)
Customize the Turnout column to show an appropriate ComboBox of available options.- Parameters:
table
- a JTable of beans
-
getSpeedEditorBox
static javax.swing.JComboBox<java.lang.String> getSpeedEditorBox(int row)
Provide a static JComboBox element to display inside the JPanel CellEditor. When not yet present, create, store and return a new one.- Parameters:
row
- Index number (in TableDataModel)- Returns:
- A combobox containing the valid aspect names for this mast
-
configSpeedColumn
public void configSpeedColumn(javax.swing.JTable table)
Customize the Turnout column to show an appropriate ComboBox of available options.- Parameters:
table
- a JTable of beans
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Overrides:
propertyChange
in classBeanTableDataModel<OBlock>
-
getClassName
protected java.lang.String getClassName()
-
-