Package jmri.jmrit.beantable.oblock
Class PathTurnoutTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jmri.jmrit.beantable.oblock.PathTurnoutTableModel
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class PathTurnoutTableModel extends javax.swing.table.AbstractTableModel implements java.beans.PropertyChangeListener
GUI to define Path-Turnout combos for OBlocks.Can be used with two interfaces:
- original "desktop" InternalFrames (parent class TableFrames, an extended JmriJFrame)
- JMRI standard Tabbed tables (parent class JPanel)
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PathTurnoutTableModel.StateComboBoxPanel
Provide a table cell renderer looking like a JComboBox as an editor/renderer for the turnout tables.
-
Field Summary
Fields Modifier and Type Field Description static int
DELETE_COL
static int
NUMCOLS
static int
STATE_COL
static int
TURNOUT_NAME_COL
-
Constructor Summary
Constructors Constructor Description PathTurnoutTableModel()
PathTurnoutTableModel(OPath path)
PathTurnoutTableModel(OPath path, TableFrames.PathTurnoutFrame parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configTurnoutStateColumn(javax.swing.JTable table)
Customize the Turnout State column to show an appropriate ComboBox of available options.(package private) void
dispose()
java.lang.Class<?>
getColumnClass(int col)
int
getColumnCount()
java.lang.String
getColumnName(int col)
int
getPreferredWidth(int col)
int
getRowCount()
(package private) javax.swing.JComboBox<java.lang.String>
getStateEditorBox(int row)
Provide a static JComboBox element to display inside the JPanel CellEditor.java.lang.Object
getValueAt(int rowIndex, int columnIndex)
(package private) void
initTempRow()
boolean
isCellEditable(int row, int col)
void
propertyChange(java.beans.PropertyChangeEvent e)
void
removeListener()
void
setValueAt(java.lang.Object value, int row, int col)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
TURNOUT_NAME_COL
public static final int TURNOUT_NAME_COL
- See Also:
- Constant Field Values
-
STATE_COL
public static final int STATE_COL
- See Also:
- Constant Field Values
-
DELETE_COL
public static final int DELETE_COL
- See Also:
- Constant Field Values
-
NUMCOLS
public static final int NUMCOLS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PathTurnoutTableModel
public PathTurnoutTableModel()
-
PathTurnoutTableModel
public PathTurnoutTableModel(OPath path, @Nonnull TableFrames.PathTurnoutFrame parent)
-
PathTurnoutTableModel
public PathTurnoutTableModel(OPath path)
-
-
Method Detail
-
removeListener
public void removeListener()
-
initTempRow
void initTempRow()
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int col)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
-
setValueAt
public void setValueAt(java.lang.Object value, int row, int col)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int row, int col)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
-
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
getStateEditorBox
javax.swing.JComboBox<java.lang.String> getStateEditorBox(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
-
configTurnoutStateColumn
protected void configTurnoutStateColumn(javax.swing.JTable table)
Customize the Turnout State column to show an appropriate ComboBox of available options.- Parameters:
table
- a JTable of beans
-
getPreferredWidth
public int getPreferredWidth(int col)
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
dispose
void dispose()
-
-