Package jmri.jmrit.beantable
Class SignalGroupTableAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- jmri.jmrit.beantable.AbstractTableAction<SignalGroup>
-
- jmri.jmrit.beantable.SignalGroupTableAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class SignalGroupTableAction extends AbstractTableAction<SignalGroup> implements java.beans.PropertyChangeListener
Swing action to create and register a Signal Group Table.Based in part on RouteTableAction.java by Bob Jacobsen
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SignalGroupTableAction.SignalGroupOutputModel
Base table model for managing generic Signal Group outputs.(package private) class
SignalGroupTableAction.SignalGroupSignalHeadModel
Table Model to manage Signal Head outputs in a Signal Group.class
SignalGroupTableAction.SignalMastAspectModel
Table Model for masts and their "Set To" aspect.-
Nested classes/interfaces inherited from class jmri.jmrit.beantable.AbstractTableAction
AbstractTableAction.TableItem<E extends NamedBean>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) SignalGroupTableAction.SignalMastAspectModel
_AspectModel
(package private) javax.swing.JCheckBox
_autoSystemName
(package private) javax.swing.JScrollPane
_SignalAppearanceScrollPane
(package private) SignalGroupTableAction.SignalGroupSignalHeadModel
_SignalGroupHeadModel
(package private) javax.swing.JScrollPane
_SignalGroupHeadScrollPane
(package private) javax.swing.JTextField
_systemName
(package private) javax.swing.JTextField
_userName
(package private) JmriJFrame
addFrame
(package private) javax.swing.JRadioButton
allButton
(package private) javax.swing.JButton
cancelButton
(package private) static java.lang.String
cancelInst
(package private) javax.swing.JButton
createButton
(package private) static java.lang.String
createInst
(package private) SignalGroup
curSignalGroup
(package private) javax.swing.JButton
deleteButton
(package private) javax.swing.JLabel
fixedSystemName
(package private) javax.swing.JRadioButton
includedButton
(package private) boolean
inEditMode
(package private) NamedBeanComboBox<SignalMast>
mainSignalComboBox
(package private) javax.swing.JLabel
nameLabel
(package private) javax.swing.JPanel
p2xs
(package private) javax.swing.JPanel
p2xsi
(package private) javax.swing.JPanel
p3xsi
(package private) UserPreferencesManager
pref
(package private) javax.swing.ButtonGroup
selGroup
(package private) boolean
signalGroupDirty
(package private) JmriJFrame
signalHeadEditFrame
(package private) javax.swing.JLabel
status1
(package private) javax.swing.JLabel
status2
(package private) java.lang.String
systemNameAuto
(package private) javax.swing.JButton
updateButton
(package private) static java.lang.String
updateInst
(package private) javax.swing.JLabel
userLabel
-
Fields inherited from class jmri.jmrit.beantable.AbstractTableAction
f, includeAddButton, m
-
-
Constructor Summary
Constructors Constructor Description SignalGroupTableAction()
SignalGroupTableAction(java.lang.String s)
Create an action with a specific title.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPressed(java.awt.event.ActionEvent e)
Respond to click on Add... button below Signal Group Table.(package private) void
autoSystemName()
(package private) void
cancelEdit()
Cancels edit mode(package private) void
cancelPressed(java.awt.event.ActionEvent e)
When user clicks Cancel during editing a Signal Group, close the Add/Edit pane and reset default entries.(package private) SignalGroup
checkNamesOK()
Check name and return a new or existing SignalGroup object with the name as entered in the _systemName field on the addFrame pane.(package private) boolean
checkNewNamesOK()
Check name for a new SignalGroup object using the _systemName field on the addFrame pane.(package private) boolean
checkValidSignalMast()
Check selection in Main Mast comboBox and store object as mMast for further calculations.protected void
createModel()
Create the JTable DataModel, along with the changes for the specific case of SignalGroups.(package private) void
createPressed(java.awt.event.ActionEvent e)
Respond to the Create button.(package private) void
deletePressed(java.awt.event.ActionEvent e)
Respond to the Delete button in the Add/Edit pane.(package private) void
editPressed(java.awt.event.ActionEvent e)
Respond to the Edit button in the Signal Group Table after creating the Add/Edit pane with AddPressed supplying _SystemName.(package private) void
finishUpdate()
Clean up the Edit Signal Group pane.java.lang.String
getClassDescription()
protected java.lang.String
getClassName()
protected java.lang.String
helpTarget()
Specify the JavaHelp target for this specific panel.(package private) void
initializeIncludedList()
Initialize list of included signal head appearances for when "Included" is selected.void
propertyChange(java.beans.PropertyChangeEvent e)
(package private) void
setColumnToHoldButton(javax.swing.JTable table, int column, javax.swing.JButton sample)
(package private) int
setHeadInformation(SignalGroup g)
Check all available Single Output Signal Heads against the list of signal head items registered with the group.(package private) void
setMastAspectInformation(SignalGroup g)
Store included Aspects for the selected main Signal Mast in the Signal Group(package private) void
setSignalStateBox(int mode, javax.swing.JComboBox<java.lang.String> box)
Set Appearance in a Signal Group Signal Head state comboBox.protected void
setTitle()
Include the correct title.(package private) void
setValidSignalMastAspects()
Look up the list of valid Aspects for the selected main Signal Mast in the comboBox and store them in a table on the addFrame using _AspectModel(package private) void
signalHeadEditPressed(int row)
Open an editor to set the details of a Signal Head as part of a Signal Group when user clicks the Edit button in the Signal Head table in the lower half of the Edit Signal Group pane.(package private) int
signalStateFromBox(javax.swing.JComboBox<java.lang.String> box)
Read Appearance for a Signal Group Signal Head from the state comboBox.(package private) void
updatePressed(java.awt.event.ActionEvent e, boolean newSignalGroup, boolean close)
Respond to the Update button on the Edit Signal Group pane - store new properties in the Signal Group.-
Methods inherited from class jmri.jmrit.beantable.AbstractTableAction
actionPerformed, addBottomButtons, addToFrame, addToFrame, addToPanel, columnsVisibleUpdated, configureManagerComboBox, configureTable, displayHwError, dispose, getFrame, getManager, getPanel, getTableDataModel, includeAddButton, nextName, print, removePrefixBoxListener, setFrame, setManager, setMenuBar, setMessagePreferencesDetails
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
_systemName
javax.swing.JTextField _systemName
-
_userName
javax.swing.JTextField _userName
-
_autoSystemName
javax.swing.JCheckBox _autoSystemName
-
systemNameAuto
java.lang.String systemNameAuto
-
addFrame
JmriJFrame addFrame
-
_SignalGroupHeadModel
SignalGroupTableAction.SignalGroupSignalHeadModel _SignalGroupHeadModel
-
_SignalGroupHeadScrollPane
javax.swing.JScrollPane _SignalGroupHeadScrollPane
-
_AspectModel
SignalGroupTableAction.SignalMastAspectModel _AspectModel
-
_SignalAppearanceScrollPane
javax.swing.JScrollPane _SignalAppearanceScrollPane
-
mainSignalComboBox
NamedBeanComboBox<SignalMast> mainSignalComboBox
-
selGroup
javax.swing.ButtonGroup selGroup
-
allButton
javax.swing.JRadioButton allButton
-
includedButton
javax.swing.JRadioButton includedButton
-
nameLabel
javax.swing.JLabel nameLabel
-
userLabel
javax.swing.JLabel userLabel
-
fixedSystemName
javax.swing.JLabel fixedSystemName
-
deleteButton
javax.swing.JButton deleteButton
-
createButton
javax.swing.JButton createButton
-
updateButton
javax.swing.JButton updateButton
-
cancelButton
javax.swing.JButton cancelButton
-
createInst
static final java.lang.String createInst
-
updateInst
static final java.lang.String updateInst
-
cancelInst
static final java.lang.String cancelInst
-
status1
javax.swing.JLabel status1
-
status2
javax.swing.JLabel status2
-
p2xs
javax.swing.JPanel p2xs
-
p2xsi
javax.swing.JPanel p2xsi
-
p3xsi
javax.swing.JPanel p3xsi
-
curSignalGroup
SignalGroup curSignalGroup
-
signalGroupDirty
boolean signalGroupDirty
-
inEditMode
boolean inEditMode
-
signalHeadEditFrame
JmriJFrame signalHeadEditFrame
-
-
Constructor Detail
-
SignalGroupTableAction
public SignalGroupTableAction(java.lang.String s)
Create an action with a specific title.Note that the argument is the Action title, not the title of the resulting frame. Perhaps this should be changed?
- Parameters:
s
- title of the action
-
SignalGroupTableAction
public SignalGroupTableAction()
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
createModel
protected void createModel()
Create the JTable DataModel, along with the changes for the specific case of SignalGroups.- Specified by:
createModel
in classAbstractTableAction<SignalGroup>
-
setTitle
protected void setTitle()
Description copied from class:AbstractTableAction
Include the correct title.- Specified by:
setTitle
in classAbstractTableAction<SignalGroup>
-
helpTarget
protected java.lang.String helpTarget()
Description copied from class:AbstractTableAction
Specify the JavaHelp target for this specific panel.- Overrides:
helpTarget
in classAbstractTableAction<SignalGroup>
- Returns:
- a fixed default string "index" pointing to to highest level in JMRI Help
-
signalStateFromBox
int signalStateFromBox(javax.swing.JComboBox<java.lang.String> box)
Read Appearance for a Signal Group Signal Head from the state comboBox.Called from SignalGroupSubTableAction.
- Parameters:
box
- comboBox to read from- Returns:
- index representing selected set to appearance for head
-
setSignalStateBox
void setSignalStateBox(int mode, javax.swing.JComboBox<java.lang.String> box)
Set Appearance in a Signal Group Signal Head state comboBox. Called from SignalGroupSubTableAction- Parameters:
mode
- Value to be setbox
- in which to enter mode
-
addPressed
protected void addPressed(java.awt.event.ActionEvent e)
Respond to click on Add... button below Signal Group Table.Create JPanel with options for configuration.
- Specified by:
addPressed
in classAbstractTableAction<SignalGroup>
- Parameters:
e
- Event from origin; null when called from Edit button in Signal Group Table row
-
autoSystemName
void autoSystemName()
-
setColumnToHoldButton
void setColumnToHoldButton(javax.swing.JTable table, int column, javax.swing.JButton sample)
-
initializeIncludedList
void initializeIncludedList()
Initialize list of included signal head appearances for when "Included" is selected.
-
createPressed
void createPressed(java.awt.event.ActionEvent e)
Respond to the Create button.- Parameters:
e
- the action event
-
checkNewNamesOK
boolean checkNewNamesOK()
Check name for a new SignalGroup object using the _systemName field on the addFrame pane. Not used when autoSystemName is checked.- Returns:
- whether name entered is allowed
-
checkValidSignalMast
boolean checkValidSignalMast()
Check selection in Main Mast comboBox and store object as mMast for further calculations.- Returns:
- The new/updated SignalGroup object
-
checkNamesOK
SignalGroup checkNamesOK()
Check name and return a new or existing SignalGroup object with the name as entered in the _systemName field on the addFrame pane.- Returns:
- The new/updated SignalGroup object
-
setHeadInformation
int setHeadInformation(SignalGroup g)
Check all available Single Output Signal Heads against the list of signal head items registered with the group. Updates the list, which is stored in the field _includedSignalHeadsList.- Parameters:
g
- Signal Group object- Returns:
- The number of Signal Heads included in the group
-
setMastAspectInformation
void setMastAspectInformation(SignalGroup g)
Store included Aspects for the selected main Signal Mast in the Signal Group- Parameters:
g
- Signal Group object
-
setValidSignalMastAspects
void setValidSignalMastAspects()
Look up the list of valid Aspects for the selected main Signal Mast in the comboBox and store them in a table on the addFrame using _AspectModel
-
cancelPressed
void cancelPressed(java.awt.event.ActionEvent e)
When user clicks Cancel during editing a Signal Group, close the Add/Edit pane and reset default entries.- Parameters:
e
- Event from origin
-
cancelEdit
void cancelEdit()
Cancels edit mode
-
editPressed
void editPressed(java.awt.event.ActionEvent e)
Respond to the Edit button in the Signal Group Table after creating the Add/Edit pane with AddPressed supplying _SystemName. Hides the editable _systemName field on the Add Group pane and displays the value as a label instead.- Parameters:
e
- Event from origin, null if invoked by clicking the Edit button in a Signal Group Table row
-
deletePressed
void deletePressed(java.awt.event.ActionEvent e)
Respond to the Delete button in the Add/Edit pane.- Parameters:
e
- the event heard
-
updatePressed
void updatePressed(java.awt.event.ActionEvent e, boolean newSignalGroup, boolean close)
Respond to the Update button on the Edit Signal Group pane - store new properties in the Signal Group.- Parameters:
e
- Event from origin, null if invoked by clicking the Edit button in a Signal Group Table rownewSignalGroup
- False when called as Update, True after editing Signal Head detailsclose
- True if the pane is closing, False if it stays open
-
finishUpdate
void finishUpdate()
Clean up the Edit Signal Group pane.
-
signalHeadEditPressed
void signalHeadEditPressed(int row)
Open an editor to set the details of a Signal Head as part of a Signal Group when user clicks the Edit button in the Signal Head table in the lower half of the Edit Signal Group pane. (renamed from signalEditPressed in 4.7.1 to explain what's in here)- Parameters:
row
- Index of line clicked in the displayed Signal Head table- See Also:
SignalGroupSubTableAction.editHead
-
getClassName
protected java.lang.String getClassName()
- Specified by:
getClassName
in classAbstractTableAction<SignalGroup>
-
getClassDescription
public java.lang.String getClassDescription()
- Overrides:
getClassDescription
in classAbstractTableAction<SignalGroup>
-
-