Package jmri.jmrit.beantable.block
Class BlockTableDataModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.BeanTableDataModel<Block>
-
- jmri.jmrit.beantable.block.BlockTableDataModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class BlockTableDataModel extends BeanTableDataModel<Block>
Data model for a Block Table. Code originally within BlockTableAction.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BlockTableDataModel.ImageIconRenderer
Visualize state in table as a graphic, customized for Blocks (2 states).-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.BeanTableDataModel
BeanTableDataModel.BeanTableTooltipHeaderRenderer
-
-
Field Summary
Fields Modifier and Type Field Description static int
CURRENTREPCOL
static int
CURVECOL
(package private) java.lang.String
defaultBlockSpeedText
static int
DIRECTIONCOL
static int
EDITCOL
static int
LENGTHCOL
static int
PERMISCOL
static int
REPORTERCOL
static int
SENSORCOL
static int
SPEEDCOL
static int
STATECOL
-
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
-
Constructor Summary
Constructors Constructor Description BlockTableDataModel(Manager<Block> mgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clickOn(Block t)
Process a click on The value cell.protected void
configStateColumn(javax.swing.JTable table)
Customize the block table State column to show an appropriate graphic for the block occupancy state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.javax.swing.JButton
configureButton()
void
configureTable(javax.swing.JTable table)
Configure a table to have our standard rows and columns.void
configValueColumn(javax.swing.JTable table)
void
dispose()
Removes property change listeners from Beans.(package private) void
editButton(Block b)
Block
getBySystemName(java.lang.String name)
Block
getByUserName(java.lang.String name)
java.lang.String
getCellToolTip(javax.swing.JTable table, int row, int col)
Display the comment text for the current row as a tool tip.java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
Get Column Count INCLUDING Bean Property Columns.java.lang.String
getColumnName(int col)
Manager<Block>
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)
returns true for all Block properties.void
propertyChange(java.beans.PropertyChangeEvent e)
void
setDefaultSpeeds(javax.swing.JFrame _who)
void
setMetric(boolean boo)
Set and refresh the UI to use Metric or Imperial values.void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureJTable, copyName, deleteBean, doDelete, editComment, exportToCSV, formatToolTip, getBeanType, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, makeJTable, 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
-
EDITCOL
public static final int EDITCOL
- See Also:
- Constant Field Values
-
DIRECTIONCOL
public static final int DIRECTIONCOL
- See Also:
- Constant Field Values
-
LENGTHCOL
public static final int LENGTHCOL
- See Also:
- Constant Field Values
-
CURVECOL
public static final int CURVECOL
- 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
-
REPORTERCOL
public static final int REPORTERCOL
- See Also:
- Constant Field Values
-
CURRENTREPCOL
public static final int CURRENTREPCOL
- See Also:
- Constant Field Values
-
PERMISCOL
public static final int PERMISCOL
- See Also:
- Constant Field Values
-
SPEEDCOL
public static final int SPEEDCOL
- See Also:
- Constant Field Values
-
defaultBlockSpeedText
java.lang.String defaultBlockSpeedText
-
-
Constructor Detail
-
BlockTableDataModel
public BlockTableDataModel(Manager<Block> mgr)
-
-
Method Detail
-
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<Block>
- Parameters:
name
- System name of Bean.- Returns:
- state value in localised human readable form.
-
getManager
public Manager<Block> 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<Block>
- Returns:
- current Manager in use by the Model.
-
getBySystemName
public Block getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemName
in classBeanTableDataModel<Block>
-
getByUserName
public Block getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserName
in classBeanTableDataModel<Block>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassName
in classBeanTableDataModel<Block>
-
clickOn
public void clickOn(Block t)
Description copied from class:BeanTableDataModel
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<Block>
- Parameters:
t
- the Bean that has been clicked.
-
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<Block>
-
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<Block>
-
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<Block>
-
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<Block>
-
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<Block>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidth
in classBeanTableDataModel<Block>
-
configValueColumn
public void configValueColumn(javax.swing.JTable table)
- Overrides:
configValueColumn
in classBeanTableDataModel<Block>
-
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<Block>
-
configureTable
public void configureTable(javax.swing.JTable table)
Description copied from class:BeanTableDataModel
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<Block>
- Parameters:
table
-JTable
to configure
-
editButton
void editButton(Block b)
-
matchPropertyName
protected boolean matchPropertyName(java.beans.PropertyChangeEvent e)
returns true for all Block properties.- Overrides:
matchPropertyName
in classBeanTableDataModel<Block>
- Parameters:
e
- property event that has changed.- Returns:
- true as all matched.
-
configureButton
public javax.swing.JButton configureButton()
- Overrides:
configureButton
in classBeanTableDataModel<Block>
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Overrides:
propertyChange
in classBeanTableDataModel<Block>
-
setMetric
public void setMetric(boolean boo)
Set and refresh the UI to use Metric or Imperial values.- Parameters:
boo
- true if metric, false for Imperial.
-
setDefaultSpeeds
public void setDefaultSpeeds(javax.swing.JFrame _who)
-
dispose
public void dispose()
Description copied from class:BeanTableDataModel
Removes property change listeners from Beans.- Overrides:
dispose
in classBeanTableDataModel<Block>
-
configStateColumn
protected void configStateColumn(javax.swing.JTable table)
Customize the block table State column to show an appropriate graphic for the block occupancy state if _graphicState = true, or (default) just show the localized state text when the TableDataModel is being called from ListedTableAction.- Parameters:
table
- a JTable of Blocks
-
getCellToolTip
public java.lang.String getCellToolTip(javax.swing.JTable table, int row, int col)
Description copied from class:BeanTableDataModel
Display the comment text for the current row as a tool tip. Most of the bean tables use the standard model with comments in column 3.- Overrides:
getCellToolTip
in classBeanTableDataModel<Block>
- Parameters:
table
- The current table.row
- The current row.col
- The current column.- Returns:
- a formatted tool tip or null if there is none.
-
-