Class LogixTableAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- jmri.jmrit.beantable.AbstractTableAction<Logix>
-
- jmri.jmrit.beantable.LogixTableAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class LogixTableAction extends AbstractTableAction<Logix>
Swing action to create and register a Logix Table.Also contains the panes to create, edit, and delete a Logix. Conditional editing has been moved to ConditionalListView or CondtionalTreeView.
Most of the text used in this GUI is in BeanTableBundle.properties, accessed via Bundle.getMessage(). 201803 Moved all keys from LogixTableBundle.properties to BeanTableBundle.properties to simplify i18n.
Conditionals now have two policies to trigger execution of their action lists:
- the previous policy - Trigger on change of state only
- the new default - Trigger on any enabled state calculation
Two additional action and variable name selection methods have been added:
- Single Pick List
- Combo Box Selection
Add a Browse Option to the Logix Select Menu This will display a window that creates a formatted list of the contents of the selected Logix with each Conditional, Variable and Action. The code is courtesy of Chuck Catania and is used with his permission. Apr 2, 2017 - Dave Sand
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
LogixTableAction.ConditionalBaseListener
(package private) class
LogixTableAction.CopyAction
static class
LogixTableAction.EditMode
Conditional edit view mode(package private) class
LogixTableAction.RefDialog
(package private) class
LogixTableAction.SaveAction
static class
LogixTableAction.SelectionMode
Input selection names.-
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) javax.swing.JTextField
_addUserName
(package private) javax.swing.JCheckBox
_autoSystemName
(package private) ConditionalEditBase
_baseEdit
(package private) ConditionalManager
_conditionalManager
(package private) javax.swing.JComboBox<java.lang.String>
_copyCombo
(package private) Logix
_curLogix
(package private) LogixTableAction.EditMode
_editMode
(package private) LogixManager
_logixManager
(package private) PickFrame
_pickTables
(package private) LogixTableAction.SelectionMode
_selectionMode
(package private) boolean
_showReminder
(package private) javax.swing.JLabel
_sysNameLabel
(package private) javax.swing.JTextField
_systemName
(package private) javax.swing.JLabel
_userNameLabel
(package private) JmriJFrame
addLogixFrame
(package private) int
conditionalRowNumber
(package private) javax.swing.JButton
create
(package private) java.lang.String
systemNameAuto
-
Fields inherited from class jmri.jmrit.beantable.AbstractTableAction
f, includeAddButton, m
-
-
Constructor Summary
Constructors Constructor Description LogixTableAction()
Create a LogixManager instance with default title.LogixTableAction(java.lang.String s)
Create a LogixManager instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPressed(java.awt.event.ActionEvent e)
Respond to the Add button in Logix table Creates and/or initialize the Add Logix pane.(package private) void
autoSystemName()
Enable/disable fields for data entry when user selects to have system name automatically generated.(package private) void
browserPressed(java.lang.String sName)
Respond to the Browse button pressed in Logix table.(package private) javax.swing.JTextArea
buildConditionalListing(Logix logix)
Builds a Component representing the current conditionals for the selected Logix statement.javax.swing.JTextArea
buildWhereUsedListing()
Creates a component containing the conditional reference where used list.(package private) void
cancelAddPressed(java.awt.event.ActionEvent e)
Respond to the Cancel button in Add Logix window.(package private) boolean
checkConditionalReferences(java.lang.String logixName)
Check for conditional references.(package private) boolean
checkConditionalSystemName(java.lang.String sName)
Check form of Conditional systemName.(package private) boolean
checkConditionalUserName(java.lang.String uName, Logix logix)
(package private) boolean
checkFlags(java.lang.String sName)
Check if another Logix editing session is currently open or no system name is provided.(package private) boolean
checkLogixSysName()
Check for a valid Logix system name.(package private) boolean
checkLogixUserName(java.lang.String uName)
Check and warn if a string is already in use as the user name of a Logix.(package private) void
copyPressed(java.lang.String sName)
Respond to the Copy Logix button in Add Logix window.protected void
createModel()
Create the JTable DataModel, along with the changes (overrides of BeanTableDataModel) for the specific case of a Logix table.(package private) void
createPressed(java.awt.event.ActionEvent e)
Respond to the Create Logix button in Add Logix window.(package private) void
deletePressed(java.lang.String sName)
Respond to the Delete combo selection Logix window or conditional view delete request.(package private) void
deleteSourceWhereUsed()
Remove target/source where used entries after a Logix delete.(package private) void
editPressed(java.lang.String sName)
Respond to the Edit button pressed in Logix table.(package private) void
enableAll(boolean enable)
(package private) void
exportToLogixNGPressed(java.lang.String sName)
Respond to the Export to LogixNG combo selection Logix window request.(package private) void
findEmptyPressed(java.awt.event.ActionEvent e)
Find empty Conditional entries, called from menu.(package private) void
findOrphansPressed(java.awt.event.ActionEvent e)
Find orphaned entries, called from menu.static java.lang.String
formatTime(int hour, int minute)
Format time to hh:mm given integer hour and minute.java.lang.String
getClassDescription()
protected java.lang.String
getClassName()
(package private) java.lang.String
getWhereUsedName(java.lang.String cName)
(package private) void
handleCreateException(java.lang.String sysName)
protected java.lang.String
helpTarget()
Specify the JavaHelp target for this specific panel.(package private) void
loadEditorMode()
Get the saved mode selection, default to the tranditional conditional list editor.(package private) void
loadReferenceNames(java.util.List<ConditionalVariable> varList, java.util.TreeSet<java.lang.String> treeSet)
Build a tree set from conditional references.(package private) void
loadSelectionMode()
Get the saved mode selection, default to the tranditional tabbed pick list.(package private) javax.swing.JPanel
makeAddLogixFrame(java.lang.String titleId, java.lang.String messageId, java.lang.String helpFile)
Create or copy Logix frame.(package private) void
makeBrowserWindow(java.lang.String lgxName)
Create and initialize the conditionals browser window.(package private) javax.swing.JPanel
makeEditPanel(javax.swing.JComponent comp, java.lang.String label, java.lang.String hint)
Create Variable and Action editing pane center part.(package private) void
makeWhereUsedWindow()
Builds the conditional references window when the Conditional Variable References menu item is selected.(package private) void
openPickListTable()
Open a new Pick List to drag Actions from to form Logix Conditionals.(package private) void
saveBrowserPressed(java.lang.String lgxName)
Save the Logix browser window content to a text file.(package private) void
setEditorMode(LogixTableAction.EditMode newMode)
Save the view mode selection.void
setMenuBar(BeanTableFrame<Logix> f)
Insert 2 table specific menus.void
setMessagePreferencesDetails()
(package private) void
setSelectionMode(LogixTableAction.SelectionMode newMode)
Save the mode selection.protected void
setTitle()
Set title of Logix table.(package private) void
showSaveReminder()
Display reminder to save.(package private) void
updateWhereUsed(java.util.TreeSet<java.lang.String> newTargetNames, java.lang.String refName)
Update the conditional reference where used.-
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
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
_conditionalManager
ConditionalManager _conditionalManager
-
_logixManager
LogixManager _logixManager
-
_baseEdit
ConditionalEditBase _baseEdit
-
_showReminder
boolean _showReminder
-
_pickTables
PickFrame _pickTables
-
conditionalRowNumber
int conditionalRowNumber
-
addLogixFrame
JmriJFrame addLogixFrame
-
_systemName
javax.swing.JTextField _systemName
-
_addUserName
javax.swing.JTextField _addUserName
-
_copyCombo
javax.swing.JComboBox<java.lang.String> _copyCombo
-
_autoSystemName
javax.swing.JCheckBox _autoSystemName
-
_sysNameLabel
javax.swing.JLabel _sysNameLabel
-
_userNameLabel
javax.swing.JLabel _userNameLabel
-
systemNameAuto
java.lang.String systemNameAuto
-
create
javax.swing.JButton create
-
_selectionMode
LogixTableAction.SelectionMode _selectionMode
-
_editMode
LogixTableAction.EditMode _editMode
-
-
Constructor Detail
-
LogixTableAction
public LogixTableAction(java.lang.String s)
Create a LogixManager instance.- Parameters:
s
- the Action title, not the title of the resulting frame. Perhaps this should be changed?
-
LogixTableAction
public LogixTableAction()
Create a LogixManager instance with default title.
-
-
Method Detail
-
createModel
protected void createModel()
Create the JTable DataModel, along with the changes (overrides of BeanTableDataModel) for the specific case of a Logix table.- Specified by:
createModel
in classAbstractTableAction<Logix>
-
setTitle
protected void setTitle()
Set title of Logix table.- Specified by:
setTitle
in classAbstractTableAction<Logix>
-
setMenuBar
public void setMenuBar(BeanTableFrame<Logix> f)
Insert 2 table specific menus.Accounts for the Window and Help menus, which are already added to the menu bar as part of the creation of the JFrame, by adding the new menus 2 places earlier unless the table is part of the ListedTableFrame, which adds the Help menu later on.
- Overrides:
setMenuBar
in classAbstractTableAction<Logix>
- Parameters:
f
- the JFrame of this table
-
loadSelectionMode
void loadSelectionMode()
Get the saved mode selection, default to the tranditional tabbed pick list.During the menu build process, the corresponding menu item is set to selected.
- Since:
- 4.7.3
-
setSelectionMode
void setSelectionMode(LogixTableAction.SelectionMode newMode)
Save the mode selection. Called by menu item change events.- Parameters:
newMode
- The SelectionMode enum constant- Since:
- 4.7.3
-
loadEditorMode
void loadEditorMode()
Get the saved mode selection, default to the tranditional conditional list editor.During the menu build process, the corresponding menu item is set to selected.
- Since:
- 4.9.x
-
setEditorMode
void setEditorMode(LogixTableAction.EditMode newMode)
Save the view mode selection. Called by menu item change events.- Parameters:
newMode
- The ViewMode enum constant- Since:
- 4.9.x
-
openPickListTable
void openPickListTable()
Open a new Pick List to drag Actions from to form Logix Conditionals.
-
findEmptyPressed
void findEmptyPressed(java.awt.event.ActionEvent e)
Find empty Conditional entries, called from menu.- Parameters:
e
- the event heard- See Also:
Maintenance.findEmptyPressed(java.awt.Frame)
-
findOrphansPressed
void findOrphansPressed(java.awt.event.ActionEvent e)
Find orphaned entries, called from menu.- Parameters:
e
- the event heard- See Also:
Maintenance.findOrphansPressed(java.awt.Frame)
-
enableAll
void enableAll(boolean enable)
-
helpTarget
protected java.lang.String helpTarget()
Description copied from class:AbstractTableAction
Specify the JavaHelp target for this specific panel.- Overrides:
helpTarget
in classAbstractTableAction<Logix>
- Returns:
- a fixed default string "index" pointing to to highest level in JMRI Help
-
addPressed
protected void addPressed(java.awt.event.ActionEvent e)
Respond to the Add button in Logix table Creates and/or initialize the Add Logix pane.- Specified by:
addPressed
in classAbstractTableAction<Logix>
- Parameters:
e
- The event heard
-
makeAddLogixFrame
javax.swing.JPanel makeAddLogixFrame(java.lang.String titleId, java.lang.String messageId, java.lang.String helpFile)
Create or copy Logix frame.- Parameters:
titleId
- property key to fetch as title of the frame (using Bundle)messageId
- part 1 of property key to fetch as user instruction on pane, either 1 or 2 is added to form the whole keyhelpFile
- help file name- Returns:
- the button JPanel
-
autoSystemName
void autoSystemName()
Enable/disable fields for data entry when user selects to have system name automatically generated.
-
cancelAddPressed
void cancelAddPressed(java.awt.event.ActionEvent e)
Respond to the Cancel button in Add Logix window.Note: Also get there if the user closes the Add Logix window.
- Parameters:
e
- The event heard
-
copyPressed
void copyPressed(java.lang.String sName)
Respond to the Copy Logix button in Add Logix window.Provides a pane to set new properties of the copy.
- Parameters:
sName
- system name of Logix to be copied
-
checkLogixUserName
boolean checkLogixUserName(java.lang.String uName)
Check and warn if a string is already in use as the user name of a Logix.- Parameters:
uName
- the suggested name- Returns:
- true if not in use
-
checkLogixSysName
boolean checkLogixSysName()
Check for a valid Logix system name. A valid name starts with the Logix prefix consisting of the Internal system prefix (normally I) + X, and at least 1 additional character. The prefix will be added if necessary. Any makeSystemName errors are logged to the system console and a dialog is displayed.- Returns:
- true if the name is now valid.
-
checkFlags
boolean checkFlags(java.lang.String sName)
Check if another Logix editing session is currently open or no system name is provided.- Parameters:
sName
- system name of Logix to be copied- Returns:
- true if a new session may be started
-
createPressed
void createPressed(java.awt.event.ActionEvent e)
Respond to the Create Logix button in Add Logix window.- Parameters:
e
- The event heard
-
handleCreateException
void handleCreateException(java.lang.String sysName)
-
editPressed
void editPressed(java.lang.String sName)
Respond to the Edit button pressed in Logix table.- Parameters:
sName
- system name of Logix to be edited
-
showSaveReminder
void showSaveReminder()
Display reminder to save.
-
setMessagePreferencesDetails
public void setMessagePreferencesDetails()
- Overrides:
setMessagePreferencesDetails
in classAbstractTableAction<Logix>
-
deletePressed
void deletePressed(java.lang.String sName)
Respond to the Delete combo selection Logix window or conditional view delete request.- Parameters:
sName
- system name of bean to be deleted
-
exportToLogixNGPressed
void exportToLogixNGPressed(java.lang.String sName)
Respond to the Export to LogixNG combo selection Logix window request.- Parameters:
sName
- system name of bean to export
-
loadReferenceNames
void loadReferenceNames(java.util.List<ConditionalVariable> varList, java.util.TreeSet<java.lang.String> treeSet)
Build a tree set from conditional references.- Parameters:
varList
- The ConditionalVariable list that might contain conditional referencestreeSet
- A tree set to be built from the varList data- Since:
- 4.7.4
-
checkConditionalUserName
boolean checkConditionalUserName(java.lang.String uName, Logix logix)
-
checkConditionalSystemName
boolean checkConditionalSystemName(java.lang.String sName)
Check form of Conditional systemName.- Parameters:
sName
- system name of bean to be checked- Returns:
- false if sName is empty string or null
-
checkConditionalReferences
boolean checkConditionalReferences(java.lang.String logixName)
Check for conditional references.- Parameters:
logixName
- The Logix under consideration- Returns:
- true if no references
- Since:
- 4.7.4
-
deleteSourceWhereUsed
void deleteSourceWhereUsed()
Remove target/source where used entries after a Logix delete.- Since:
- 4.7.4
-
updateWhereUsed
void updateWhereUsed(java.util.TreeSet<java.lang.String> newTargetNames, java.lang.String refName)
Update the conditional reference where used.The difference between the saved target names and new target names is used to add/remove where used references.
- Parameters:
newTargetNames
- The conditional target names after updatingrefName
- The system name for the referencing conditional- Since:
- 4.7.4
-
makeEditPanel
javax.swing.JPanel makeEditPanel(javax.swing.JComponent comp, java.lang.String label, java.lang.String hint)
Create Variable and Action editing pane center part.- Parameters:
comp
- Field or comboBox to include on sub panelabel
- property key for labelhint
- property key for tooltip for this sub pane- Returns:
- JPanel containing interface
-
formatTime
public static java.lang.String formatTime(int hour, int minute)
Format time to hh:mm given integer hour and minute.- Parameters:
hour
- value for time hoursminute
- value for time minutes- Returns:
- Formatted time string
-
getClassDescription
public java.lang.String getClassDescription()
- Overrides:
getClassDescription
in classAbstractTableAction<Logix>
-
getClassName
protected java.lang.String getClassName()
- Specified by:
getClassName
in classAbstractTableAction<Logix>
-
makeWhereUsedWindow
void makeWhereUsedWindow()
Builds the conditional references window when the Conditional Variable References menu item is selected.This is a stand-alone window that can be closed at any time.
- Since:
- 4.7.4
-
buildWhereUsedListing
public javax.swing.JTextArea buildWhereUsedListing()
Creates a component containing the conditional reference where used list. The source isConditionalManager.getWhereUsedMap()
- Returns:
- a TextArea, empty if reference is not used
- Since:
- 4.7.4
-
getWhereUsedName
java.lang.String getWhereUsedName(java.lang.String cName)
-
browserPressed
void browserPressed(java.lang.String sName)
Respond to the Browse button pressed in Logix table.- Parameters:
sName
- The selected Logix system name
-
makeBrowserWindow
void makeBrowserWindow(java.lang.String lgxName)
Create and initialize the conditionals browser window.- Parameters:
lgxName
- Logix system name
-
saveBrowserPressed
void saveBrowserPressed(java.lang.String lgxName)
Save the Logix browser window content to a text file.- Parameters:
lgxName
- Logix system name
-
buildConditionalListing
javax.swing.JTextArea buildConditionalListing(Logix logix)
Builds a Component representing the current conditionals for the selected Logix statement.- Parameters:
logix
- browsing Logix- Returns:
- a TextArea listing existing conditionals; will be empty if there are none
-
-