Class ConditionalTreeEdit
The tree has 3 levels. The first level are the conditionals contained in the selected Logix. The second level contains the antecedent, logic type and trigger mode settings. The third level contains the detail Variable and Action lines.
Compare with the other Conditional Edit tool ConditionalListEdit
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classListener for _actionTypeBox.(package private) static classConditional Tree Node Definition.Nested classes/interfaces inherited from class jmri.jmrit.conditional.ConditionalEditBase
ConditionalEditBase.LogixEventListener, ConditionalEditBase.NameBoxListener, ConditionalEditBase.PickSingleListener, ConditionalEditBase.SelectionMode -
Field Summary
FieldsModifier and TypeFieldDescription(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) JLabel(package private) JComboBox<Conditional.ItemType>(package private) JLabel(package private) List<ConditionalAction>(package private) JTextField(package private) JLabel(package private) JButton(package private) JLabel(package private) JComboBox<Conditional.Action>(package private) JLabel(package private) ConditionalTreeEdit.ActionTypeListener(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) JPanel(package private) String(package private) JLabel(package private) JButton(package private) TreeSelectionListener(package private) DefaultTreeModel(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) DefaultMutableTreeNode(package private) JTree(package private) JPanel(package private) NamedBeanComboBox<?>(package private) JLabel(package private) ConditionalAction(package private) Conditional.ItemType(package private) Conditional(package private) String(package private) JPanel(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) String(package private) int(package private) String(package private) String(package private) TreePath(package private) ConditionalVariable(package private) Conditional.ItemType(package private) JPanel(package private) JPanel(package private) JPanel(package private) boolean(package private) JTextField(package private) JTextField(package private) JTextField(package private) JComboBox<Conditional.AntecedentOperator>(package private) JPanel(package private) JPanel(package private) JPanel(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) JPanel(package private) Conditional.AntecedentOperator(package private) JLabel(package private) JLabel(package private) JTextField(package private) JPanel(package private) boolean(package private) boolean(package private) String(package private) Conditional.ItemType(package private) JLabel(package private) JTextField(package private) JPanel(package private) boolean(package private) JLabel(package private) JButton(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) JComboBox<Conditional.Type>(package private) JTextField(package private) JTextField(package private) JComboBox<Conditional.ItemType>(package private) JLabel(package private) List<ConditionalVariable>(package private) JLabel(package private) JTextField(package private) JLabel(package private) JCheckBox(package private) JLabel(package private) JComboBox<Conditional.Type>(package private) JCheckBox(package private) ConditionalTreeEdit.ConditionalTreeNode(package private) ActionListener(package private) ActionListener(package private) ActionListener(package private) JFileChooser(package private) FocusListenerFocus gained implies intent to make changes, set up for edit.(package private) ScriptFileChooser(package private) ActionListener(package private) ActionListener(package private) JFileChooser(package private) ActionListener(package private) ActionListener(package private) ActionListenerFields inherited from class jmri.jmrit.conditional.ConditionalEditBase
_conditionalManager, _curLogix, _editLogixFrame, _inEditMode, _logixManager, _pickListener, _pickSingleFrame, _pickTable, _pickTables, _pickTabPane, _selectionMode, _showReminder, _suppressIndirectRef, _suppressReminder, listenerList, logixData -
Constructor Summary
ConstructorsConstructorDescriptionConditionalTreeEdit(String sName) Create a new Conditional Tree View editor. -
Method Summary
Modifier and TypeMethodDescription(package private) voidRespond to a change in an Action Type comboBox.(package private) voidAdd new items: Conditionals, Variables or Actions.(package private) voidantecedentChanged(String antecedentText) Update the antecedent.(package private) voidAdd a R# to the antecedent statement.(package private) voidCalled once during class initialization to define the GUI objects.(package private) voidInitialize conditional components.(package private) JTreeCreate the conditional tree structure using the current Logix.(package private) StringbuildNodeText(String nodeType, Object component, int idx) Create the localized node text display strings based on node type.(package private) voidCalled once during class initialization to define the GUI objects.(package private) voidRespond to Cancel action button and window closer of the Edit Action window.(package private) voidRespond to Cancel variable button(package private) voidCancel the current node edit.(package private) booleancheckIsAction(String name, Conditional.ItemType itemType) Check that a state variable is not also used as an action(package private) booleancheckIsVariable(String name, Conditional.ItemType itemType) Check that an action is not also used as a state variable(package private) voidRefresh the Conditional or Variable state.(package private) voidClean up Update and Delete Action buttons.(package private) voidClean up: Cancel, Update and Delete Variable buttons.(package private) voidCreate the tree content.(package private) voidProcess the node delete request.(package private) voidClean up, notify the parent Logix that edit session is done.(package private) voidCreate a Variable or Action based tabbed PickList with appropriate tab selected.(package private) voidCreate a Variable or Action based single pane PickList.(package private) voidMove a conditional, variable or action row down 1 row.(package private) voidSet up the edit environment for the selected node Called fromtreeRowSelected(jmri.jmrit.conditional.ConditionalTreeEdit.ConditionalTreeNode).protected String(package private) voidRespond to Help button press in the Edit Logix menu bar.(package private) voidSet display to show current action (curAction) parameters.(package private) voidSet display to show current state variable (curVariable) parameters.(package private) voidloadJComboBoxWithHeadAppearances(JComboBox<String> box, String signalHeadName) Fetch valid localized appearances for a given Signal Head.(package private) voidloadJComboBoxWithMastAspects(JComboBox<String> box, String mastName) Fetch valid aspects for a given Signal Mast.(package private) voidloadSelectConditionalBox(String logixName) Load the Conditional selection box.(package private) voidLoad the Logix selection box.(package private) voidRespond to a change of Logic Type in the dialog window by showing/hiding the _antecedentPanel when Mixed is selected.(package private) voidBuild the antecedent statement.(package private) voidThis grid is used to edit the Antecedent when the Logic Type is Mixed.(package private) voidAdd the change/trigger box the grid.(package private) voidThis grid is used to edit the Conditional User Name.(package private) voidCreate the Logix and Conditional rows and the State row.(package private) voidmakeDetailGrid(String gridType) Build new GridBag content.(package private) voidCreate the edit logix window.(package private) voidCreate a one row grid with just the Action Item box.(package private) voidThis grid is used when there are no edit grids required.(package private) voidCreate a one row grid with just the Variable Type box.(package private) voidCreate the Fast Clock start and end time rows.(package private) voidAdd the file selection components.(package private) voidThis grid is used to edit the Logic Type.(package private) voidCreate the Memory specific rows.(package private) voidmakeNameTypeActionGrid(GridBagConstraints c, boolean finalRow) Create the standard Name and Type rows.(package private) void(package private) voidmakeShortFieldActionGrid(GridBagConstraints c, boolean includeBox) Add the short name field to the grid.(package private) voidAdd the Aspect field for signal heads and signal masts.(package private) voidmakeStandardActionGrid(GridBagConstraints c, boolean finalRow) Add the action box to the grid.(package private) voidCreate the standard Name and State rows.(package private) voidmakeTypeActionGrid(GridBagConstraints c, boolean finalRow) Create the standard Type row.(package private) voidJust a short text field, no name field.(package private) voidmoveTreeNode(String direction) Move a tree node in response to a up or down request.(package private) voidCreate a new action Can be invoked by a Actions or Action node.(package private) voidCreate a new variable Can be invoked by a Variables or Variable node.(package private) voidRemove Action timers and listeners before Action list structure changes.(package private) voidsetActionNameBox(Conditional.ItemType itemType) Update the name combo box selection based on the current contents of the name field.(package private) voidsetEditMode(boolean active) Enable/disable buttons based on edit state.(package private) voidRespond to the [...] button in the Edit Action window action section.(package private) voidAdd the focus listener to each detail edit field.(package private) voidEnable/Disable the Up and Down buttons based on the postion in the list.(package private) voidsetPickWindow(String cmd, Conditional.ItemType item) Ceate tabbed Pick Taba;e or Pick Single based on Selection Mode.(package private) voidsetVariableNameBox(Conditional.ItemType itemType) Update the name combo box selection based on the current contents of the name field.(package private) voidDisplay reminder to finish a node before starting another.(package private) voidUpdate the Actions trigger mode, adjust the Action descriptions.(package private) voidtreeRowSelected(ConditionalTreeEdit.ConditionalTreeNode selectedNode) Change the button row based on the currently selected node type.(package private) voidRespond to Update button.(package private) voidUpdate the conditional action list and refresh the local copy.(package private) voidApply the updates to the current node.(package private) voidRespond to Update Variable button in the Edit Variable pane.(package private) voidUpdate the conditional variable list and refresh the local copy.(package private) voidUpdate the variable negation.(package private) voidUpdate the variable operation.(package private) voidMove a conditional, variable or action row up 1 row.(package private) voiduserNameChanged(String newName) Change the conditional user name.(package private) booleanValidate Action data from Edit Action Window, and transfer it to current action object as appropriate.(package private) booleanvalidateAntecedent(String antecedentText) Check the antecedent and logic type.(package private) booleanValidate Variable data from Edit Variable panel, and transfer it to current variable object as appropriate.Methods inherited from class jmri.jmrit.conditional.ConditionalEditBase
addLogixEventListener, appendToAntecedent, bringToFront, checkConditionalReferences, checkConditionalUserName, closeSinglePanelPickList, confirmActionAsVariable, confirmIndirectMemory, createNameBox, createSinglePanelPickList, displayBadNumberReference, findPickListTabPane, fireLogixEvent, formatTime, getLight, hidePickListTable, loadReferenceNames, loadSelectionMode, locateAt, makeAntecedent, messageDuplicateConditionalUserName, messageInvalidActionItemName, openPickListTable, parseTime, removeLogixEventListener, setPickListTab, showSaveReminder, translateAntecedent, updateWhereUsed, validateAntecedent, validateAudioReference, validateConditionalReference, validateEntryExitReference, validateIntensity, validateIntensityReference, validateLightReference, validateLogixReference, validateMemoryReference, validateOBlockReference, validateRouteReference, validateSensorReference, validateSignalHeadReference, validateSignalMastReference, validateTime, validateTimeReference, validateTurnoutReference, validateWarrantReference
-
Field Details
-
_curDetailPanel
-
_editLogixUserName
-
_comboNameBox
-
_detailGrid
-
_gridPanel
-
_editConditionalUserName
-
_editAntecedent
-
_editOperatorMode
-
_editActive
boolean _editActive -
_cancelAction
-
_updateAction
-
_pickCommand
-
_pickItem
-
_cdlTree
-
_cdlModel
-
_cdlRoot
-
_cdlListener
-
_curTreePath
-
_cdlNode
-
_varHead
-
_varNode
-
_actHead
-
_actNode
-
_leafNode
-
_curNode
-
_curNodeName
-
_curNodeType
-
_curNodeText
-
_curNodeRow
int _curNodeRow -
_leftButtonBar
-
_labelPanel
-
_addButtonPanel
-
_toggleButtonPanel
-
_checkButtonPanel
-
_moveButtonPanel
-
_deleteButtonPanel
-
_helpButtonPanel
-
_conditionalLabel
-
_antecedentLabel
-
_logicTypeLabel
-
_triggerModeLabel
-
_variablesLabel
-
_variableLabel
-
_actionsLabel
-
_actionLabel
-
_curConditional
-
_variableList
-
_actionList
-
_curVariable
-
_curAction
-
_curVariableItem
-
_curActionItem
-
_curConditionalName
-
_antecedent
-
_logicType
-
_triggerMode
boolean _triggerMode -
_newActionItem
boolean _newActionItem -
_newVariableItem
boolean _newVariableItem -
_oldTargetNames
-
_selectLogixBox
-
_selectConditionalBox
-
_selectLogixMap
-
_selectConditionalList
-
_variableItemBox
-
_variableStateBox
-
_variableOperBox
-
_variableNegated
-
_variableTriggerActions
-
_variableNameField
-
_variableNameLabel
-
_variableCompareOpBox
-
_variableSignalBox
-
_variableCompareTypeBox
-
_variableMemoryValueLabel
-
_variableData1Field
-
_variableData2Field
-
_actionItemBox
-
_actionTypeBox
-
_actionTypeLabel
-
_actionNameField
-
_actionNameLabel
-
_actionBox
-
_actionBoxLabel
-
_longActionString
-
_longActionLabel
-
_shortActionString
-
_shortActionLabel
-
_actionOptionBox
-
_actionSetButton
-
detailFocusEvent
Focus gained implies intent to make changes, set up for edit. -
variableSignalHeadNameListener
-
variableSignalMastNameListener
-
variableSignalTestStateListener
-
selectLogixBoxListener
-
selectConditionalBoxListener
-
compareTypeBoxListener
-
sndFileChooser
-
scriptFileChooser
-
defaultFileChooser
-
_actionTypeListener
-
actionSignalHeadNameListener
-
actionSignalMastNameListener
-
-
Constructor Details
-
ConditionalTreeEdit
Create a new Conditional Tree View editor.- Parameters:
sName- The system name of the current Logix
-
ConditionalTreeEdit
public ConditionalTreeEdit()
-
-
Method Details
-
makeEditLogixWindow
void makeEditLogixWindow()Create the edit logix window.The left side contains a tree structure containing the conditionals for the current Logix. The right side contains detail edit panes based on the current tree row selection.
-
buildConditionalComponents
void buildConditionalComponents()Initialize conditional components. -
makeDetailGrid
Build new GridBag content. The grid panel is hidden, emptied, re-built and made visible.- Parameters:
gridType- The type of grid to create
-
makeEmptyGrid
This grid is used when there are no edit grids required.- Parameters:
c- The constraints object used for the grid construction
-
makeConditionalGrid
This grid is used to edit the Conditional User Name.- Parameters:
c- The constraints object used for the grid construction
-
makeAntecedentGrid
This grid is used to edit the Antecedent when the Logic Type is Mixed.- Parameters:
c- The constraints object used for the grid construction
-
makeLogicTypeGrid
This grid is used to edit the Logic Type.- Parameters:
c- The constraints object used for the grid construction
-
addPressed
void addPressed()Add new items: Conditionals, Variables or Actions. -
newVariable
void newVariable()Create a new variable Can be invoked by a Variables or Variable node. -
newAction
void newAction()Create a new action Can be invoked by a Actions or Action node. -
editPressed
void editPressed()Set up the edit environment for the selected node Called fromtreeRowSelected(jmri.jmrit.conditional.ConditionalTreeEdit.ConditionalTreeNode). This takes the place of an actual button. -
updatePressed
void updatePressed()Apply the updates to the current node. -
userNameChanged
Change the conditional user name.- Parameters:
newName- The proposed new name
-
logicTypeChanged
Respond to a change of Logic Type in the dialog window by showing/hiding the _antecedentPanel when Mixed is selected.- Parameters:
newType- The selected logic type
-
antecedentChanged
Update the antecedent.- Parameters:
antecedentText- the new antecedent
-
makeAntecedent
void makeAntecedent()Build the antecedent statement. -
appendToAntecedent
void appendToAntecedent()Add a R# to the antecedent statement. -
validateAntecedent
Check the antecedent and logic type.- Parameters:
antecedentText- The user supplied antecedent text- Returns:
- false if antecedent can't be validated
-
togglePressed
void togglePressed()Update the Actions trigger mode, adjust the Action descriptions. -
checkPressed
void checkPressed()Refresh the Conditional or Variable state. -
deletePressed
void deletePressed()Process the node delete request. -
upPressed
void upPressed()Move a conditional, variable or action row up 1 row. -
downPressed
void downPressed()Move a conditional, variable or action row down 1 row. -
removeActionTimers
void removeActionTimers()Remove Action timers and listeners before Action list structure changes. This relates to moving and deleting rows. New actions at the end are not problem. The issue is that the timer listeners are tied to the action row number. This can result in orphan timers and listeners that keep running.- Since:
- 4.11.2
-
moveTreeNode
Move a tree node in response to a up or down request.- Parameters:
direction- The direction of movement, Up or Down
-
setMoveButtons
void setMoveButtons()Enable/Disable the Up and Down buttons based on the postion in the list. -
helpPressed
void helpPressed()Respond to Help button press in the Edit Logix menu bar. Only visible when using mixed mode and an antecedent node is selected. -
cancelPressed
void cancelPressed()Cancel the current node edit. -
donePressed
void donePressed()Clean up, notify the parent Logix that edit session is done. -
buildConditionalTree
Create the conditional tree structure using the current Logix.- Returns:
- _cdlTree The tree ddefinition with its content
-
createConditionalContent
void createConditionalContent()Create the tree content. Level 1 are the conditionals, Level 2 includes the antecedent, logic type, trigger mode and parent nodes for Variables and Actions, Level 3 contains the detail Variable and Action entries. -
treeRowSelected
Change the button row based on the currently selected node type. Invoke edit where appropriate.- Parameters:
selectedNode- The node object
-
buildNodeText
Create the localized node text display strings based on node type.- Parameters:
nodeType- The type of the nodecomponent- The conditional object or child objectidx- Optional index value- Returns:
- nodeText containing the text to display on the node
-
showNodeEditMessage
void showNodeEditMessage()Display reminder to finish a node before starting another. This is a session reminder. -
setFocusListeners
void setFocusListeners()Add the focus listener to each detail edit field. -
setEditMode
Enable/disable buttons based on edit state. Open pick lists based on the current SelectionMode. The edit state controls the ability to select tree nodes.- Parameters:
active- True to make edit active, false to make edit inactive
-
setPickWindow
Ceate tabbed Pick Taba;e or Pick Single based on Selection Mode. Called bysetEditMode(boolean)when edit mode becomes active. Called byvariableTypeChanged(jmri.Conditional.ItemType)andactionItemChanged(jmri.Conditional.ItemType)when item type changes.- Parameters:
cmd- The source or action to be performed.item- The item type for Variable or Action or zero
-
doPickList
void doPickList()Create a Variable or Action based tabbed PickList with appropriate tab selected. -
doPickSingle
void doPickSingle()Create a Variable or Action based single pane PickList. -
buildVariableComponents
void buildVariableComponents()Called once during class initialization to define the GUI objects. Where possible, the combo box content is loaded. -
makeEmptyVariableGrid
Create a one row grid with just the Variable Type box. This is the base for larger grids as well as the initial grid for new State Variables.- Parameters:
c- the constraints object used for the grid construction
-
makeOptionsVariableGrid
-
makeStandardVariableGrid
Create the standard Name and State rows. The name field will be either a text field or a combo box. The name field label is a variable to support run time changes.- Parameters:
c- The constraints object used for the grid construction
-
makeSignalAspectVariableGrid
Add the Aspect field for signal heads and signal masts.- Parameters:
c- The constraints object used for the grid construction
-
makeConditionalVariableGrid
Create the Logix and Conditional rows and the State row.- Parameters:
c- The constraints object used for the grid construction
-
makeMemoryVariableGrid
Create the Memory specific rows.- Parameters:
c- The constraints object used for the grid construction
-
makeFastClockVariableGrid
Create the Fast Clock start and end time rows.- Parameters:
c- The constraints object used for the grid construction
-
initializeStateVariables
void initializeStateVariables()Set display to show current state variable (curVariable) parameters. -
setVariableNameBox
Update the name combo box selection based on the current contents of the name field. Called by variableItemChanged.- Parameters:
itemType- The item type, such as sensor or turnout.- Since:
- 4.7.3
-
cancelEditVariable
void cancelEditVariable()Respond to Cancel variable button -
updateVariable
void updateVariable()Respond to Update Variable button in the Edit Variable pane. -
cleanUpVariable
void cleanUpVariable()Clean up: Cancel, Update and Delete Variable buttons. -
loadSelectLogixBox
void loadSelectLogixBox()Load the Logix selection box. Set the selection to the current Logix.- Since:
- 4.7.4
-
loadSelectConditionalBox
Load the Conditional selection box. The first row is a prompt.- Parameters:
logixName- The Logix system name for selecting the owned Conditionals- Since:
- 4.7.4
-
loadJComboBoxWithHeadAppearances
Fetch valid localized appearances for a given Signal Head.Warn if head is not found.
- Parameters:
box- the comboBox on the setup pane to fillsignalHeadName- user or system name of the Signal Head
-
loadJComboBoxWithMastAspects
Fetch valid aspects for a given Signal Mast.Warn if mast is not found.
- Parameters:
box- the comboBox on the setup pane to fillmastName- user or system name of the Signal Mast
-
validateVariable
boolean validateVariable()Validate Variable data from Edit Variable panel, and transfer it to current variable object as appropriate.Messages are sent to the user for any errors found. This routine returns false immediately after finding the first error, even if there might be more errors.
- Returns:
- true if all data checks out OK, otherwise false
-
updateVariableOperator
void updateVariableOperator()Update the variable operation. If a change has occurred, also update the antecedent and antecedent tree node. -
updateVariableNegation
void updateVariableNegation()Update the variable negation. If a change has occurred, also update the antecedent and antecedent tree node. -
updateVariableList
void updateVariableList()Update the conditional variable list and refresh the local copy. The parent Logix is de-activated and re-activated. This ensures that listeners are properly handled.- Since:
- 4.11.2
-
buildActionComponents
void buildActionComponents()Called once during class initialization to define the GUI objects. Where possible, the combo box content is loaded. -
makeEmptyActionGrid
Create a one row grid with just the Action Item box. This is the base for larger grids as well as the initial grid for new Actions.- Parameters:
c- the constraints object used for the grid construction
-
makeNameTypeActionGrid
Create the standard Name and Type rows. The name field will be either a text field or a combo box. The name field label is a variable to support run time changes.- Parameters:
c- The constraints object used for the grid constructionfinalRow- Controls whether the tigger combo box is included
-
makeTypeActionGrid
Create the standard Type row.- Parameters:
c- The constraints object used for the grid constructionfinalRow- Controls whether the tigger combo box is included
-
makeStandardActionGrid
Add the action box to the grid.- Parameters:
c- The constraints object used for the grid constructionfinalRow- Controls whether the tigger combo box is included
-
makeShortFieldActionGrid
Add the short name field to the grid.- Parameters:
c- The constraints object used for the grid constructionincludeBox- Controls whether the normal action type combo box is included
-
makeTypeShortActionGrid
Just a short text field, no name field. Used by set clock and jython command.- Parameters:
c- The constraints object used for the grid construction
-
makeFileActionGrid
Add the file selection components.- Parameters:
c- The constraints object used for the grid construction
-
makeChangeTriggerActionGrid
Add the change/trigger box the grid. This is the last item in an Action and is usually called from one of the other entry points.- Parameters:
c- The constraints object used for the grid construction
-
initializeActionVariables
void initializeActionVariables()Set display to show current action (curAction) parameters. -
actionItemChanged
Respond to a change in an Action Type comboBox.Set components visible for the selected type.
- Parameters:
type- index of the newly selected Action type
-
setActionNameBox
Update the name combo box selection based on the current contents of the name field.- Parameters:
itemType- The item type, such as sensor or turnout.- Since:
- 4.7.3
-
cancelEditAction
void cancelEditAction()Respond to Cancel action button and window closer of the Edit Action window.Also does cleanup of Update and Delete buttons.
-
updateAction
void updateAction()Respond to Update button. -
cleanUpAction
void cleanUpAction()Clean up Update and Delete Action buttons. -
setFileLocation
Respond to the [...] button in the Edit Action window action section.Ask user to select an audio or python script file on disk.
- Parameters:
e- the event heard
-
validateAction
boolean validateAction()Validate Action data from Edit Action Window, and transfer it to current action object as appropriate.Messages are sent to the user for any errors found. This routine returns false immediately after finding an error, even if there might be more errors.
- Returns:
- true if all data checks out OK, otherwise false.
-
updateActionList
void updateActionList()Update the conditional action list and refresh the local copy. The parent Logix is de-activated and re-activated. This ensures that listeners are properly handled, specifically the delayed sensor and turnout options.- Since:
- 4.11.2
-
checkIsAction
Check that a state variable is not also used as an action- Parameters:
name- of the state variableitemType- item type of the state variable- Returns:
- true if variable is not an action of if the user OK's its use as an action also.
-
checkIsVariable
Check that an action is not also used as a state variable- Parameters:
name- of the actionitemType- item type of the action- Returns:
- true if action is not a state variable of if the user OK's its use as such.
-
getClassName
- Overrides:
getClassNamein classConditionalEditBase
-