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 classBlockTableDataModel.ImageIconRendererVisualize 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 intCOLUMNCOUNTstatic intCURRENTREPCOLstatic intCURVECOLstatic intDIRECTIONCOLstatic intEDITCOLstatic intGHOSTCOLstatic intLENGTHCOLstatic intPERMISCOLstatic intREPORTERCOLstatic intSENSORCOLstatic intSPEEDCOLstatic intSTATECOL-
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 voidclickOn(Block t)Process a click on The value cell.protected voidconfigStateColumn(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.JButtonconfigureButton()voidconfigureTable(javax.swing.JTable table)Configure a table to have our standard rows and columns.voidconfigValueColumn(javax.swing.JTable table)(package private) voideditButton(Block b)BlockgetBySystemName(java.lang.String name)BlockgetByUserName(java.lang.String name)java.lang.StringgetCellToolTip(javax.swing.JTable table, int modelRow, int modelCol)Display the comment text for the current row as a tool tip.java.lang.Class<?>getColumnClass(int col)intgetColumnCount()Get Column Count INCLUDING Bean Property Columns.java.lang.StringgetColumnName(int col)Manager<Block>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)javax.swing.JTablemakeJTable(java.lang.String name, javax.swing.table.TableModel model, javax.swing.RowSorter<? extends javax.swing.table.TableModel> sorter)Create and configure a new table using the given model and row sorter.protected booleanmatchPropertyName(java.beans.PropertyChangeEvent e)returns true for all Block properties.voidpropertyChange(java.beans.PropertyChangeEvent e)voidsetDefaultSpeeds(javax.swing.JFrame frame)voidsetMetric(boolean boo)Set and refresh the UI to use Metric or Imperial values.voidsetValueAt(java.lang.Object value, int row, int col)-
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureJTable, copySystemName, copyUserName, deleteBean, dispose, doDelete, editComment, exportToCSV, formatToolTip, getBeanType, getDisplayDeleteMsg, getFilter, getHeaderTooltip, getPropertyColumnCount, getPropertyColumnDescriptor, getRowCount, isClearUserNameAllowed, 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
-
GHOSTCOL
public static final int GHOSTCOL
- See Also:
- Constant Field Values
-
COLUMNCOUNT
public static final int COLUMNCOUNT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BlockTableDataModel
public BlockTableDataModel(Manager<Block> mgr)
-
-
Method Detail
-
getValue
public java.lang.String getValue(java.lang.String name)
Description copied from class:BeanTableDataModelGet the current Bean state value in human readable form.- Specified by:
getValuein 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:BeanTableDataModelGet 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<Block>- Returns:
- current Manager in use by the Model.
-
getBySystemName
public Block getBySystemName(@Nonnull java.lang.String name)
- Specified by:
getBySystemNamein classBeanTableDataModel<Block>
-
getByUserName
public Block getByUserName(@Nonnull java.lang.String name)
- Specified by:
getByUserNamein classBeanTableDataModel<Block>
-
getMasterClassName
protected java.lang.String getMasterClassName()
- Specified by:
getMasterClassNamein classBeanTableDataModel<Block>
-
clickOn
public void clickOn(Block t)
Description copied from class:BeanTableDataModelProcess a click on The value cell.- Specified by:
clickOnin classBeanTableDataModel<Block>- Parameters:
t- the Bean that has been clicked.
-
getColumnCount
public int getColumnCount()
Description copied from class:BeanTableDataModelGet Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Overrides:
getColumnCountin classBeanTableDataModel<Block>
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
Description copied from class:BeanTableDataModelSYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Overrides:
getValueAtin classBeanTableDataModel<Block>
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
Description copied from class:BeanTableDataModel- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classBeanTableDataModel<Block>
-
getColumnName
public java.lang.String getColumnName(int col)
Description copied from class:BeanTableDataModel- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classBeanTableDataModel<Block>
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
Description copied from class:BeanTableDataModel- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classBeanTableDataModel<Block>
-
getPreferredWidth
public int getPreferredWidth(int col)
- Overrides:
getPreferredWidthin classBeanTableDataModel<Block>
-
configValueColumn
public void configValueColumn(javax.swing.JTable table)
- Overrides:
configValueColumnin classBeanTableDataModel<Block>
-
isCellEditable
public boolean isCellEditable(int row, int col)
Description copied from class:BeanTableDataModel- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classBeanTableDataModel<Block>
-
makeJTable
public javax.swing.JTable makeJTable(@Nonnull java.lang.String name, @Nonnull javax.swing.table.TableModel model, @CheckForNull javax.swing.RowSorter<? extends javax.swing.table.TableModel> sorter)
Description copied from class:BeanTableDataModelCreate and configure a new table using the given model and row sorter.- Overrides:
makeJTablein classBeanTableDataModel<Block>- Parameters:
name- the name of the tablemodel- the data model for the tablesorter- the row sorter for the table; if null, the table will not be sortable- Returns:
- the table
-
configureTable
public void configureTable(javax.swing.JTable table)
Description copied from class:BeanTableDataModelConfigure 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:
configureTablein classBeanTableDataModel<Block>- Parameters:
table-JTableto configure
-
editButton
void editButton(Block b)
-
matchPropertyName
protected boolean matchPropertyName(java.beans.PropertyChangeEvent e)
returns true for all Block properties.- Overrides:
matchPropertyNamein classBeanTableDataModel<Block>- Parameters:
e- property event that has changed.- Returns:
- true as all matched.
-
configureButton
public javax.swing.JButton configureButton()
- Overrides:
configureButtonin classBeanTableDataModel<Block>
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Description copied from class:BeanTableDataModel- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein 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 frame)
-
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 modelRow, int modelCol)
Description copied from class:BeanTableDataModelDisplay 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:
getCellToolTipin classBeanTableDataModel<Block>- Parameters:
table- The current table.modelRow- The current row.modelCol- The current column.- Returns:
- a formatted tool tip or null if there is none.
-
-