Merge lp:~tapaal-contributor/tapaal/fix-is-enabled-transition-query into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1118
Merged at revision: 1113
Proposed branch: lp:~tapaal-contributor/tapaal/fix-is-enabled-transition-query
Merge into: lp:tapaal
Diff against target: 231 lines (+33/-30)
1 file modified
src/pipe/gui/widgets/QueryDialog.java (+33/-30)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/fix-is-enabled-transition-query
Reviewer Review Type Date Requested Status
Kenneth Yrke Jørgensen Approve
Jiri Srba Approve
Review via email: mp+393444@code.launchpad.net

Description of the change

When net is untimed, the predicate for transitions are now shown as "is enabled" instead of " = 0".
When net is game, it is not possible to select any transitions.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Open untimed game and make a query; the text "is enabled" is prited next to predicate - it should only show if you select transition from the list.

review: Needs Fixing
1118. By Lena Ernstsen

Removed extra 'is enabled' when net is untimed and game

Revision history for this message
Jiri Srba (srba) wrote :

Tested and fixes the problem.

review: Approve
Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pipe/gui/widgets/QueryDialog.java'
--- src/pipe/gui/widgets/QueryDialog.java 2020-10-30 21:14:42 +0000
+++ src/pipe/gui/widgets/QueryDialog.java 2020-11-06 13:15:27 +0000
@@ -127,7 +127,7 @@
127 private JPanel predicatePanel;127 private JPanel predicatePanel;
128 private JButton addPredicateButton;128 private JButton addPredicateButton;
129 private JComboBox templateBox;129 private JComboBox templateBox;
130 private JComboBox<String> placesBox;130 private JComboBox<String> placeTransitionBox;
131 private JComboBox<String> relationalOperatorBox;131 private JComboBox<String> relationalOperatorBox;
132 private JLabel transitionIsEnabledLabel;132 private JLabel transitionIsEnabledLabel;
133 private CustomJSpinner placeMarking;133 private CustomJSpinner placeMarking;
@@ -703,10 +703,10 @@
703 } else {703 } else {
704 templateBox.setSelectedItem(tapnNetwork.getTAPNByName(transitionNode.getTemplate()));704 templateBox.setSelectedItem(tapnNetwork.getTAPNByName(transitionNode.getTemplate()));
705 }705 }
706 placesBox.setSelectedItem(transitionNode.getTransition());706 placeTransitionBox.setSelectedItem(transitionNode.getTransition());
707 userChangedAtomicPropSelection = true;707 userChangedAtomicPropSelection = true;
708 }708 }
709 if (!lens.isTimed()) {709 if (!lens.isTimed() && !lens.isGame()) {
710 setEnablednessOfOperatorAndMarkingBoxes();710 setEnablednessOfOperatorAndMarkingBoxes();
711 }711 }
712 }712 }
@@ -718,7 +718,7 @@
718 TCTLPlaceNode placeNode = (TCTLPlaceNode) node.getLeft();718 TCTLPlaceNode placeNode = (TCTLPlaceNode) node.getLeft();
719 TCTLConstNode placeMarkingNode = (TCTLConstNode) node.getRight();719 TCTLConstNode placeMarkingNode = (TCTLConstNode) node.getRight();
720720
721 placesBox.setSelectedItem(placeNode.getPlace());721 placeTransitionBox.setSelectedItem(placeNode.getPlace());
722 relationalOperatorBox.setSelectedItem(node.getOp());722 relationalOperatorBox.setSelectedItem(node.getOp());
723 placeMarking.setValue(placeMarkingNode.getConstant());723 placeMarking.setValue(placeMarkingNode.getConstant());
724 userChangedAtomicPropSelection = true;724 userChangedAtomicPropSelection = true;
@@ -728,10 +728,10 @@
728 userChangedAtomicPropSelection = false;728 userChangedAtomicPropSelection = false;
729 if (node.getLeft() instanceof TCTLPlaceNode) {729 if (node.getLeft() instanceof TCTLPlaceNode) {
730 TCTLPlaceNode placeNode = (TCTLPlaceNode) node.getLeft();730 TCTLPlaceNode placeNode = (TCTLPlaceNode) node.getLeft();
731 placesBox.setSelectedItem(placeNode.getPlace());731 placeTransitionBox.setSelectedItem(placeNode.getPlace());
732 } else {732 } else {
733 if (placesBox.getItemCount() > 0) {733 if (placeTransitionBox.getItemCount() > 0) {
734 placesBox.setSelectedIndex(0);734 placeTransitionBox.setSelectedIndex(0);
735 }735 }
736 }736 }
737 relationalOperatorBox.setSelectedItem(node.getOp());737 relationalOperatorBox.setSelectedItem(node.getOp());
@@ -756,7 +756,7 @@
756 }756 }
757757
758 private boolean transitionIsSelected() {758 private boolean transitionIsSelected() {
759 String itemName = (String) placesBox.getSelectedItem();759 String itemName = (String) placeTransitionBox.getSelectedItem();
760 if (itemName == null) return false;760 if (itemName == null) return false;
761 boolean transitionSelected = false;761 boolean transitionSelected = false;
762 boolean sharedTransitionSelected = false;762 boolean sharedTransitionSelected = false;
@@ -980,7 +980,7 @@
980 disjunctionButton.setEnabled(false);980 disjunctionButton.setEnabled(false);
981 negationButton.setEnabled(false);981 negationButton.setEnabled(false);
982 templateBox.setEnabled(false);982 templateBox.setEnabled(false);
983 placesBox.setEnabled(false);983 placeTransitionBox.setEnabled(false);
984 relationalOperatorBox.setEnabled(false);984 relationalOperatorBox.setEnabled(false);
985 placeMarking.setEnabled(false);985 placeMarking.setEnabled(false);
986 addPredicateButton.setEnabled(false);986 addPredicateButton.setEnabled(false);
@@ -1005,7 +1005,7 @@
1005 disjunctionButton.setEnabled(false);1005 disjunctionButton.setEnabled(false);
1006 negationButton.setEnabled(false);1006 negationButton.setEnabled(false);
1007 templateBox.setEnabled(false);1007 templateBox.setEnabled(false);
1008 placesBox.setEnabled(false);1008 placeTransitionBox.setEnabled(false);
1009 relationalOperatorBox.setEnabled(false);1009 relationalOperatorBox.setEnabled(false);
1010 placeMarking.setEnabled(false);1010 placeMarking.setEnabled(false);
1011 addPredicateButton.setEnabled(false);1011 addPredicateButton.setEnabled(false);
@@ -1028,7 +1028,7 @@
1028 disjunctionButton.setEnabled(true);1028 disjunctionButton.setEnabled(true);
1029 negationButton.setEnabled(true);1029 negationButton.setEnabled(true);
1030 templateBox.setEnabled(true);1030 templateBox.setEnabled(true);
1031 placesBox.setEnabled(true);1031 placeTransitionBox.setEnabled(true);
1032 relationalOperatorBox.setEnabled(true);1032 relationalOperatorBox.setEnabled(true);
1033 placeMarking.setEnabled(true);1033 placeMarking.setEnabled(true);
1034 truePredicateButton.setEnabled(true);1034 truePredicateButton.setEnabled(true);
@@ -1051,7 +1051,7 @@
1051 disjunctionButton.setEnabled(true);1051 disjunctionButton.setEnabled(true);
1052 negationButton.setEnabled(true);1052 negationButton.setEnabled(true);
1053 templateBox.setEnabled(true);1053 templateBox.setEnabled(true);
1054 placesBox.setEnabled(true);1054 placeTransitionBox.setEnabled(true);
1055 relationalOperatorBox.setEnabled(true);1055 relationalOperatorBox.setEnabled(true);
1056 placeMarking.setEnabled(true);1056 placeMarking.setEnabled(true);
1057 truePredicateButton.setEnabled(true);1057 truePredicateButton.setEnabled(true);
@@ -1076,7 +1076,7 @@
1076 disjunctionButton.setEnabled(false);1076 disjunctionButton.setEnabled(false);
1077 negationButton.setEnabled(false);1077 negationButton.setEnabled(false);
1078 templateBox.setEnabled(false);1078 templateBox.setEnabled(false);
1079 placesBox.setEnabled(false);1079 placeTransitionBox.setEnabled(false);
1080 relationalOperatorBox.setEnabled(false);1080 relationalOperatorBox.setEnabled(false);
1081 placeMarking.setEnabled(false);1081 placeMarking.setEnabled(false);
1082 addPredicateButton.setEnabled(false);1082 addPredicateButton.setEnabled(false);
@@ -1086,7 +1086,7 @@
1086 }1086 }
10871087
1088 private void setEnablednessOfAddPredicateButton() {1088 private void setEnablednessOfAddPredicateButton() {
1089 if (placesBox.getSelectedItem() == null)1089 if (placeTransitionBox.getSelectedItem() == null)
1090 addPredicateButton.setEnabled(false);1090 addPredicateButton.setEnabled(false);
1091 else1091 else
1092 addPredicateButton.setEnabled(true);1092 addPredicateButton.setEnabled(true);
@@ -1145,10 +1145,10 @@
1145 TCTLAbstractStateProperty property;1145 TCTLAbstractStateProperty property;
11461146
1147 if (!lens.isTimed() && transitionIsSelected()) {1147 if (!lens.isTimed() && transitionIsSelected()) {
1148 property = new TCTLTransitionNode(template, (String) placesBox.getSelectedItem());1148 property = new TCTLTransitionNode(template, (String) placeTransitionBox.getSelectedItem());
1149 } else {1149 } else {
1150 property = new TCTLAtomicPropositionNode(1150 property = new TCTLAtomicPropositionNode(
1151 new TCTLPlaceNode(template, (String) placesBox.getSelectedItem()),1151 new TCTLPlaceNode(template, (String) placeTransitionBox.getSelectedItem()),
1152 (String) relationalOperatorBox.getSelectedItem(),1152 (String) relationalOperatorBox.getSelectedItem(),
1153 new TCTLConstNode((Integer) placeMarking.getValue()));1153 new TCTLConstNode((Integer) placeMarking.getValue()));
1154 }1154 }
@@ -2002,10 +2002,10 @@
2002 predicatePanel = new JPanel(new GridBagLayout());2002 predicatePanel = new JPanel(new GridBagLayout());
2003 predicatePanel.setBorder(BorderFactory.createTitledBorder("Predicates"));2003 predicatePanel.setBorder(BorderFactory.createTitledBorder("Predicates"));
20042004
2005 placesBox = new JComboBox();2005 placeTransitionBox = new JComboBox();
2006 Dimension d = new Dimension(125, 27);2006 Dimension d = new Dimension(125, 27);
2007 placesBox.setMaximumSize(d);2007 placeTransitionBox.setMaximumSize(d);
2008 placesBox.setPreferredSize(d);2008 placeTransitionBox.setPreferredSize(d);
20092009
2010 Vector<Object> items = new Vector<Object>(tapnNetwork.activeTemplates().size()+1);2010 Vector<Object> items = new Vector<Object>(tapnNetwork.activeTemplates().size()+1);
2011 items.addAll(tapnNetwork.activeTemplates());2011 items.addAll(tapnNetwork.activeTemplates());
@@ -2025,7 +2025,7 @@
2025 placeNames.add(place.name());2025 placeNames.add(place.name());
2026 }2026 }
2027 }2027 }
2028 if (!lens.isTimed()) {2028 if (!lens.isTimed() && !lens.isGame()) {
2029 for (TimedTransition transition : tapn.transitions()) {2029 for (TimedTransition transition : tapn.transitions()) {
2030 if (!transition.isShared()) {2030 if (!transition.isShared()) {
2031 placeNames.add(transition.name());2031 placeNames.add(transition.name());
@@ -2034,7 +2034,7 @@
2034 }2034 }
20352035
2036 placeNames.sort(String::compareToIgnoreCase);2036 placeNames.sort(String::compareToIgnoreCase);
2037 placesBox.setModel(new DefaultComboBoxModel<>(placeNames));2037 placeTransitionBox.setModel(new DefaultComboBoxModel<>(placeNames));
20382038
2039 currentlySelected = tapn;2039 currentlySelected = tapn;
2040 setEnablednessOfAddPredicateButton();2040 setEnablednessOfAddPredicateButton();
@@ -2053,7 +2053,7 @@
2053 }2053 }
2054 }2054 }
2055 placeNames.sort(String::compareToIgnoreCase);2055 placeNames.sort(String::compareToIgnoreCase);
2056 placesBox.setModel(new DefaultComboBoxModel<>(placeNames));2056 placeTransitionBox.setModel(new DefaultComboBoxModel<>(placeNames));
20572057
2058 currentlySelected = SHARED;2058 currentlySelected = SHARED;
2059 setEnablednessOfAddPredicateButton();2059 setEnablednessOfAddPredicateButton();
@@ -2061,7 +2061,7 @@
2061 updateQueryOnAtomicPropositionChange();2061 updateQueryOnAtomicPropositionChange();
2062 }2062 }
2063 }2063 }
2064 if (!lens.isTimed()) setEnablednessOfOperatorAndMarkingBoxes();2064 if (!lens.isTimed() && !lens.isGame()) setEnablednessOfOperatorAndMarkingBoxes();
20652065
2066 }2066 }
2067 });2067 });
@@ -2085,7 +2085,7 @@
2085 JPanel placeRow = new JPanel(new FlowLayout(FlowLayout.CENTER));2085 JPanel placeRow = new JPanel(new FlowLayout(FlowLayout.CENTER));
2086 gbc.gridy = 1;2086 gbc.gridy = 1;
2087 predicatePanel.add(placeRow, gbc);2087 predicatePanel.add(placeRow, gbc);
2088 placeRow.add(placesBox);2088 placeRow.add(placeTransitionBox);
20892089
2090 String[] relationalSymbols = { "=", "!=", "<=", "<", ">=", ">" };2090 String[] relationalSymbols = { "=", "!=", "<=", "<", ">=", ">" };
2091 relationalOperatorBox = new JComboBox(new DefaultComboBoxModel(relationalSymbols));2091 relationalOperatorBox = new JComboBox(new DefaultComboBoxModel(relationalSymbols));
@@ -2098,7 +2098,7 @@
20982098
2099 transitionIsEnabledLabel = new JLabel(" is enabled");2099 transitionIsEnabledLabel = new JLabel(" is enabled");
2100 transitionIsEnabledLabel.setPreferredSize(new Dimension(165, 27));2100 transitionIsEnabledLabel.setPreferredSize(new Dimension(165, 27));
2101 if (!lens.isTimed()) placeRow.add(transitionIsEnabledLabel);2101 if (!lens.isTimed() && !lens.isGame()) placeRow.add(transitionIsEnabledLabel);
21022102
2103 JPanel addPredicateRow = new JPanel(new FlowLayout(FlowLayout.CENTER));2103 JPanel addPredicateRow = new JPanel(new FlowLayout(FlowLayout.CENTER));
2104 gbc.gridy = 2;2104 gbc.gridy = 2;
@@ -2144,7 +2144,7 @@
2144 queryPanel.add(predicatePanel, gbc);2144 queryPanel.add(predicatePanel, gbc);
21452145
2146 //Add tool tips for predicate panel2146 //Add tool tips for predicate panel
2147 placesBox.setToolTipText(TOOL_TIP_PLACESBOX);2147 placeTransitionBox.setToolTipText(TOOL_TIP_PLACESBOX);
2148 templateBox.setToolTipText(TOOL_TIP_TEMPLATEBOX);2148 templateBox.setToolTipText(TOOL_TIP_TEMPLATEBOX);
2149 relationalOperatorBox.setToolTipText(TOOL_TIP_RELATIONALOPERATORBOX);2149 relationalOperatorBox.setToolTipText(TOOL_TIP_RELATIONALOPERATORBOX);
2150 placeMarking.setToolTipText(TOOL_TIP_PLACEMARKING);2150 placeMarking.setToolTipText(TOOL_TIP_PLACEMARKING);
@@ -2160,11 +2160,11 @@
2160 String template = templateBox.getSelectedItem().toString();2160 String template = templateBox.getSelectedItem().toString();
2161 if(template.equals(SHARED)) template = "";2161 if(template.equals(SHARED)) template = "";
21622162
2163 if ((lens.isTimed() || lens.isGame()) && transitionIsSelected()) {2163 if ((!lens.isTimed() && !lens.isGame()) && transitionIsSelected()) {
2164 addPropertyToQuery(new TCTLTransitionNode(template, (String) placesBox.getSelectedItem()));2164 addPropertyToQuery(new TCTLTransitionNode(template, (String) placeTransitionBox.getSelectedItem()));
2165 } else {2165 } else {
2166 TCTLAtomicPropositionNode property = new TCTLAtomicPropositionNode(2166 TCTLAtomicPropositionNode property = new TCTLAtomicPropositionNode(
2167 new TCTLPlaceNode(template, (String) placesBox.getSelectedItem()),2167 new TCTLPlaceNode(template, (String) placeTransitionBox.getSelectedItem()),
2168 (String) relationalOperatorBox.getSelectedItem(),2168 (String) relationalOperatorBox.getSelectedItem(),
2169 new TCTLConstNode((Integer) placeMarking.getValue()));2169 new TCTLConstNode((Integer) placeMarking.getValue()));
2170 addPropertyToQuery(property);2170 addPropertyToQuery(property);
@@ -2193,10 +2193,13 @@
2193 }2193 }
2194 });2194 });
21952195
2196 placesBox.addActionListener(e -> {2196 placeTransitionBox.addActionListener(e -> {
2197 if (userChangedAtomicPropSelection) {2197 if (userChangedAtomicPropSelection) {
2198 updateQueryOnAtomicPropositionChange();2198 updateQueryOnAtomicPropositionChange();
2199 }2199 }
2200 if (!lens.isTimed() && !lens.isGame()) {
2201 setEnablednessOfOperatorAndMarkingBoxes();
2202 }
2200 });2203 });
22012204
2202 relationalOperatorBox.addActionListener(e -> {2205 relationalOperatorBox.addActionListener(e -> {

Subscribers

People subscribed via source and target branches