Class LogixTableAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumConditional edit view modestatic enumInput selection names.Nested classes/interfaces inherited from class jmri.jmrit.beantable.AbstractTableAction
AbstractTableAction.TableItem<E extends NamedBean> -
Field Summary
Fields inherited from class jmri.jmrit.beantable.AbstractTableAction
f, includeAddButton, mFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionCreate a LogixManager instance with default title.Create a LogixManager instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRespond to the Add button in Logix table Creates and/or initialize the Add Logix pane.(package private) voidEnable/disable fields for data entry when user selects to have system name automatically generated.(package private) voidbrowserPressed(String sName) Respond to the Browse button pressed in Logix table.(package private) JTextAreabuildConditionalListing(Logix logix) Builds a Component representing the current conditionals for the selected Logix statement.Creates a component containing the conditional reference where used list.(package private) voidRespond to the Cancel button in Add Logix window.(package private) booleancheckConditionalReferences(String logixName) Check for conditional references.(package private) booleancheckConditionalSystemName(String sName) Check form of Conditional systemName.(package private) booleancheckConditionalUserName(String uName, Logix logix) (package private) booleancheckFlags(String sName) Check if another Logix editing session is currently open or no system name is provided.(package private) booleanCheck for a valid Logix system name.(package private) booleancheckLogixUserName(String uName) Check and warn if a string is already in use as the user name of a Logix.(package private) voidcopyPressed(String sName) Respond to the Copy Logix button in Add Logix window.protected voidCreate the JTable DataModel, along with the changes (overrides of BeanTableDataModel) for the specific case of a Logix table.(package private) voidRespond to the Create Logix button in Add Logix window.(package private) voiddeletePressed(String sName) Respond to the Delete combo selection Logix window or conditional view delete request.(package private) voidRemove target/source where used entries after a Logix delete.(package private) voideditPressed(String sName) Respond to the Edit button pressed in Logix table.(package private) voidenableAll(boolean enable) (package private) voidexportToLogixNGPressed(String sName) Respond to the Export to LogixNG combo selection Logix window request.(package private) voidFind empty Conditional entries, called from menu.(package private) voidFind orphaned entries, called from menu.static StringformatTime(int hour, int minute) Format time to hh:mm given integer hour and minute.protected String(package private) StringgetWhereUsedName(String cName) (package private) voidhandleCreateException(String sysName) protected StringSpecify the JavaHelp target for this specific panel.(package private) voidGet the saved mode selection, default to the traditional conditional list editor.(package private) voidloadReferenceNames(List<ConditionalVariable> varList, TreeSet<String> treeSet) Build a tree set from conditional references.(package private) voidGet the saved mode selection, default to the tranditional tabbed pick list.(package private) JPanelmakeAddLogixFrame(String titleId, String messageId, String helpFile) Create or copy Logix frame.(package private) voidmakeBrowserWindow(String lgxName) Create and initialize the conditionals browser window.(package private) JPanelmakeEditPanel(JComponent comp, String label, String hint) Create Variable and Action editing pane center part.(package private) voidBuilds the conditional references window when the Conditional Variable References menu item is selected.(package private) voidOpen a new Pick List to drag Actions from to form Logix Conditionals.(package private) voidsaveBrowserPressed(String lgxName) Save the Logix browser window content to a text file.(package private) voidsetEditorMode(LogixTableAction.EditMode newMode) Save the view mode selection.voidInsert 2 table specific menus.void(package private) voidSave the mode selection.protected voidsetTitle()Set title of Logix table.(package private) voidDisplay reminder to save.(package private) voidupdateWhereUsed(TreeSet<String> newTargetNames, 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, getDataModel, getFrame, getManager, getPanel, getTableDataModel, includeAddButton, nextName, print, removePrefixBoxListener, setFrame, setManagerMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
LogixTableAction
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 Details
-
createModel
Create the JTable DataModel, along with the changes (overrides of BeanTableDataModel) for the specific case of a Logix table.- Specified by:
createModelin classAbstractTableAction<Logix>
-
setTitle
Set title of Logix table.- Specified by:
setTitlein classAbstractTableAction<Logix>
-
setMenuBar
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:
setMenuBarin 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
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 traditional conditional list editor.During the menu build process, the corresponding menu item is set to selected.
- Since:
- 4.9.x
-
setEditorMode
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
Find empty Conditional entries, called from menu.- Parameters:
e- the event heard- See Also:
-
findOrphansPressed
Find orphaned entries, called from menu.- Parameters:
e- the event heard- See Also:
-
enableAll
-
helpTarget
Description copied from class:AbstractTableActionSpecify the JavaHelp target for this specific panel.- Overrides:
helpTargetin classAbstractTableAction<Logix>- Returns:
- a fixed default string "index" pointing to to highest level in JMRI Help
-
addPressed
Respond to the Add button in Logix table Creates and/or initialize the Add Logix pane.- Specified by:
addPressedin classAbstractTableAction<Logix>- Parameters:
e- The event heard
-
makeAddLogixFrame
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
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
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
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
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
Respond to the Create Logix button in Add Logix window.- Parameters:
e- The event heard
-
handleCreateException
-
editPressed
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
- Overrides:
setMessagePreferencesDetailsin classAbstractTableAction<Logix>
-
deletePressed
Respond to the Delete combo selection Logix window or conditional view delete request.- Parameters:
sName- system name of bean to be deleted
-
exportToLogixNGPressed
Respond to the Export to LogixNG combo selection Logix window request.- Parameters:
sName- system name of bean to export
-
loadReferenceNames
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
-
checkConditionalSystemName
Check form of Conditional systemName.- Parameters:
sName- system name of bean to be checked- Returns:
- false if sName is empty string or null
-
checkConditionalReferences
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
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
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
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
- Overrides:
getClassDescriptionin classAbstractTableAction<Logix>
-
getClassName
- Specified by:
getClassNamein 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
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
-
browserPressed
Respond to the Browse button pressed in Logix table.- Parameters:
sName- The selected Logix system name
-
makeBrowserWindow
Create and initialize the conditionals browser window.- Parameters:
lgxName- Logix system name
-
saveBrowserPressed
Save the Logix browser window content to a text file.- Parameters:
lgxName- Logix system name
-
buildConditionalListing
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
-