Package jmri.jmrit.picker
Class PickListModel<E extends NamedBean>
java.lang.Object
javax.swing.table.AbstractTableModel
jmri.jmrit.beantable.BeanTableDataModel<E>
jmri.jmrit.picker.PickListModel<E>
- Type Parameters:
E
- the supported type of NamedBean
- All Implemented Interfaces:
PropertyChangeListener
,Serializable
,EventListener
,TableModel
- Direct Known Subclasses:
PickListModel.BlockPickModel
,PickListModel.EntryExitPickModel
,PickListModel.LightPickModel
,PickListModel.LogixPickModel
,PickListModel.MemoryPickModel
,PickListModel.OBlockPickModel
,PickListModel.ReporterPickModel
,PickListModel.SensorPickModel
,PickListModel.SignalHeadPickModel
,PickListModel.SignalMastPickModel
,PickListModel.TurnoutPickModel
,PickListModel.WarrantPickModel
public abstract class PickListModel<E extends NamedBean> extends BeanTableDataModel<E>
Abstract class to make pick lists for NamedBeans; Table model for pick lists
in IconAdder
This file is part of JMRI.
Concrete pick list class for many beans are include at the end of this file. This class also has instantiation methods serve as a factory for those classes.
Note: Extensions of this class must call init() after instantiation.
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 (package private) static class
PickListModel.BlockPickModel
(package private) static class
PickListModel.EntryExitPickModel
(package private) static class
PickListModel.LightPickModel
(package private) static class
PickListModel.LogixPickModel
(package private) static class
PickListModel.MemoryPickModel
(package private) static class
PickListModel.MultiSensorPickModel
(package private) static class
PickListModel.OBlockPickModel
(package private) static class
PickListModel.ReporterPickModel
(package private) static class
PickListModel.SensorPickModel
(package private) static class
PickListModel.SignalHeadPickModel
(package private) static class
PickListModel.SignalMastPickModel
(package private) static class
PickListModel.TurnoutPickModel
(package private) static class
PickListModel.WarrantPickModel
-
Field Summary
Fields Modifier and Type Field Description (package private) static HashMap<String,Integer>
_listMap
protected String
_name
protected ArrayList<E>
_pickList
protected TableRowSorter<PickListModel<E>>
_sorter
static int
POSITION_COL
static ResourceBundle
rb
static int
SNAME_COLUMN
static int
UNAME_COLUMN
Fields inherited from class jmri.jmrit.beantable.BeanTableDataModel
COMMENTCOL, DELETECOL, NUMCOLUMN, SYSNAMECOL, sysNameList, USERNAMECOL, VALUECOL
-
Constructor Summary
Constructors Constructor Description PickListModel()
Default constructor makes a table sorted by System Name. -
Method Summary
Modifier and Type Method Description abstract E
addBean(String name)
Return bean with name given in parameter.abstract E
addBean(String sysName, String userName)
static PickListModel<Block>
blockPickModelInstance()
abstract boolean
canAddBean()
Check if beans can be added by this model.void
clickOn(E t)
Process a click on The value cell.void
dispose()
static PickListModel<DestinationPoints>
entryExitPickModelInstance()
E
getBeanAt(int index)
If table has been sorted table row no longer is the same as array index.List<E>
getBeanList()
protected String
getBeanType()
Get String of the Single Bean Type.E
getBySystemName(String name)
protected E
getByUserName(String name)
Class<?>
getColumnClass(int c)
int
getColumnCount()
Get Column Count INCLUDING Bean Property Columns.String
getColumnName(int c)
int
getIndexOf(E bean)
abstract Manager<E>
getManager()
Get the Table Model Bean Manager.protected String
getMasterClassName()
String
getName()
static int
getNumInstances(String type)
int
getRowCount()
JTable
getTable()
String
getValue(String systemName)
Get the current Bean state value in human readable form.Object
getValueAt(int r, int c)
SYSNAMECOL returns the actual Bean, NOT the System Name.boolean
isCellEditable(int r, int c)
static PickListModel<Light>
lightPickModelInstance()
static PickListModel<Logix>
logixPickModelInstance()
JTable
makePickTable()
Make pick table, DND enabled.void
makeSorter(JTable table)
static PickListModel<Memory>
memoryPickModelInstance()
static PickListModel<Sensor>
multiSensorPickModelInstance()
static PickListModel<OBlock>
oBlockPickModelInstance()
void
propertyChange(PropertyChangeEvent e)
Handle additions and deletions in the table and changes to beans within the table.static PickListModel<Reporter>
reporterPickModelInstance()
static PickListModel<Sensor>
sensorPickModelInstance()
void
setValueAt(Object type, int r, int c)
static PickListModel<SignalHead>
signalHeadPickModelInstance()
static PickListModel<SignalMast>
signalMastPickModelInstance()
static PickListModel<Turnout>
turnoutPickModelInstance()
protected void
updateNameList()
override BeanTableDataModel only lists SystemNamestatic PickListModel<Warrant>
warrantPickModelInstance()
Methods inherited from class jmri.jmrit.beantable.BeanTableDataModel
addMouseListenerToHeader, configDeleteColumn, configureButton, configureJTable, configureTable, configValueColumn, copyName, deleteBean, doDelete, editComment, getCellToolTip, getDisplayDeleteMsg, getPreferredWidth, getPropertyColumnCount, getPropertyColumnDescriptor, makeJTable, matchPropertyName, moveBean, persistTable, printColumns, printTable, removeName, renameBean, setColumnIdentities, setColumnToHoldButton, setDisplayDeleteMsg, setManager, setPropertyColumnsVisible, showPopup, showTableHeaderPopup, stopPersistingTable
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
_pickList
-
_name
-
_sorter
-
SNAME_COLUMN
- See Also:
- Constant Field Values
-
UNAME_COLUMN
- See Also:
- Constant Field Values
-
POSITION_COL
- See Also:
- Constant Field Values
-
rb
-
_listMap
-
-
Constructor Details
-
PickListModel
public PickListModel()Default constructor makes a table sorted by System Name.
-
-
Method Details
-
getNumInstances
-
getBeanAt
If table has been sorted table row no longer is the same as array index.- Parameters:
index
- row of table- Returns:
- bean at index or null if index is out of range
-
getIndexOf
-
getBeanList
-
updateNameList
override BeanTableDataModel only lists SystemName- Overrides:
updateNameList
in classBeanTableDataModel<E extends NamedBean>
-
getBySystemName
- Specified by:
getBySystemName
in classBeanTableDataModel<E extends NamedBean>
-
getByUserName
- Specified by:
getByUserName
in classBeanTableDataModel<E extends NamedBean>
-
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<E extends NamedBean>
- Returns:
- current Manager in use by the Model.
-
addBean
Return bean with name given in parameter. Create if needed and possible.- Parameters:
name
- the System name for the Bean.- Returns:
- the Bean or null if not made.
- Throws:
IllegalArgumentException
- with reason why Bean cannot be created.
-
addBean
@CheckForNull public abstract E addBean(@Nonnull String sysName, String userName) throws IllegalArgumentException- Throws:
IllegalArgumentException
-
canAddBean
Check if beans can be added by this model.- Returns:
- true if model can create beans; false otherwise
-
getMasterClassName
- Specified by:
getMasterClassName
in classBeanTableDataModel<E extends NamedBean>
-
clickOn
Process a click on The value cell.- Specified by:
clickOn
in classBeanTableDataModel<E extends NamedBean>
- Parameters:
t
- the Bean that has been clicked.
-
getColumnClass
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classBeanTableDataModel<E extends NamedBean>
-
getColumnCount
Get Column Count INCLUDING Bean Property Columns.- Specified by:
getColumnCount
in interfaceTableModel
- Overrides:
getColumnCount
in classBeanTableDataModel<E extends NamedBean>
-
getColumnName
- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classBeanTableDataModel<E extends NamedBean>
-
isCellEditable
- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classBeanTableDataModel<E extends NamedBean>
-
getRowCount
- Specified by:
getRowCount
in interfaceTableModel
- Overrides:
getRowCount
in classBeanTableDataModel<E extends NamedBean>
-
getValueAt
SYSNAMECOL returns the actual Bean, NOT the System Name.- Specified by:
getValueAt
in interfaceTableModel
- Overrides:
getValueAt
in classBeanTableDataModel<E extends NamedBean>
-
setValueAt
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classBeanTableDataModel<E extends NamedBean>
-
getValue
Get the current Bean state value in human readable form.- Specified by:
getValue
in classBeanTableDataModel<E extends NamedBean>
- Parameters:
systemName
- System name of Bean.- Returns:
- state value in localised human readable form.
-
getName
-
getBeanType
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<E extends NamedBean>
- Returns:
- Bean Type String.
-
propertyChange
Handle additions and deletions in the table and changes to beans within the table.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classBeanTableDataModel<E extends NamedBean>
- Parameters:
e
- the change
-
makePickTable
Make pick table, DND enabled.- Returns:
- the table
-
makeSorter
-
getTable
-
dispose
- Overrides:
dispose
in classBeanTableDataModel<E extends NamedBean>
-
turnoutPickModelInstance
-
sensorPickModelInstance
-
multiSensorPickModelInstance
-
signalHeadPickModelInstance
-
signalMastPickModelInstance
-
memoryPickModelInstance
-
blockPickModelInstance
-
reporterPickModelInstance
-
lightPickModelInstance
-
oBlockPickModelInstance
-
warrantPickModelInstance
-
entryExitPickModelInstance
-
logixPickModelInstance
-