Merge lp:~tapaal-contributor/tapaal/cpn-variable-color-tool-window into lp:~tapaal-contributor/tapaal/cpn-gui-dev
- cpn-variable-color-tool-window
- Merge into cpn-gui-dev
Proposed by
Kristian Morsing Pedersen
Status: | Superseded |
---|---|
Proposed branch: | lp:~tapaal-contributor/tapaal/cpn-variable-color-tool-window |
Merge into: | lp:~tapaal-contributor/tapaal/cpn-gui-dev |
Diff against target: |
271 lines (+138/-8) 5 files modified
src/net/tapaal/gui/GuiFrameController.java (+1/-0) src/net/tapaal/gui/TabActions.java (+2/-0) src/net/tapaal/gui/petrinet/editor/ConstantsPane.java (+1/-1) src/pipe/gui/GuiFrame.java (+16/-5) src/pipe/gui/petrinet/PetriNetTab.java (+118/-2) |
To merge this branch: | bzr merge lp:~tapaal-contributor/tapaal/cpn-variable-color-tool-window |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jiri Srba | Needs Fixing | ||
Review via email: mp+416247@code.launchpad.net |
This proposal supersedes a proposal from 2022-02-23.
This proposal has been superseded by a proposal from 2022-03-06.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote : Posted in a previous version of this proposal | # |
review:
Needs Fixing
Revision history for this message
Jiri Srba (srba) wrote : | # |
The ctrl-0 abbreviation clashes with "show token age" in case of timed CPNs. Perhaps change it to ctrl-F (but double check if it is free).
review:
Needs Fixing
- 1620. By Kristian Morsing Pedersen <email address hidden>
-
Changed shortcut key
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/net/tapaal/gui/GuiFrameController.java' | |||
2 | --- src/net/tapaal/gui/GuiFrameController.java 2022-02-21 18:32:54 +0000 | |||
3 | +++ src/net/tapaal/gui/GuiFrameController.java 2022-03-06 11:11:17 +0000 | |||
4 | @@ -735,6 +735,7 @@ | |||
5 | 735 | public void showSimpleWorkspace() { | 735 | public void showSimpleWorkspace() { |
6 | 736 | showAdvancedWorkspace(false); | 736 | showAdvancedWorkspace(false); |
7 | 737 | } | 737 | } |
8 | 738 | |||
9 | 738 | private void showAdvancedWorkspace(boolean advanced){ | 739 | private void showAdvancedWorkspace(boolean advanced){ |
10 | 739 | QueryDialog.setAdvancedView(advanced); | 740 | QueryDialog.setAdvancedView(advanced); |
11 | 740 | setComponents(advanced); | 741 | setComponents(advanced); |
12 | 741 | 742 | ||
13 | === modified file 'src/net/tapaal/gui/TabActions.java' | |||
14 | --- src/net/tapaal/gui/TabActions.java 2022-02-21 07:29:48 +0000 | |||
15 | +++ src/net/tapaal/gui/TabActions.java 2022-03-06 11:11:17 +0000 | |||
16 | @@ -108,6 +108,8 @@ | |||
17 | 108 | 108 | ||
18 | 109 | void showChangeNameVisibility(); | 109 | void showChangeNameVisibility(); |
19 | 110 | 110 | ||
20 | 111 | void showColorTypesVariables(); | ||
21 | 112 | |||
22 | 111 | void alignToGrid(); | 113 | void alignToGrid(); |
23 | 112 | 114 | ||
24 | 113 | void copy(); | 115 | void copy(); |
25 | 114 | 116 | ||
26 | === modified file 'src/net/tapaal/gui/petrinet/editor/ConstantsPane.java' | |||
27 | --- src/net/tapaal/gui/petrinet/editor/ConstantsPane.java 2022-02-20 20:18:49 +0000 | |||
28 | +++ src/net/tapaal/gui/petrinet/editor/ConstantsPane.java 2022-03-06 11:11:17 +0000 | |||
29 | @@ -59,7 +59,7 @@ | |||
30 | 59 | 59 | ||
31 | 60 | private static final String titleBorder = "Global constants, Color types and Variables"; | 60 | private static final String titleBorder = "Global constants, Color types and Variables"; |
32 | 61 | private static final String titleBorderNoColor = "Global constants"; | 61 | private static final String titleBorderNoColor = "Global constants"; |
34 | 62 | private static final String titleBorderToolTip = "Declaration of global constants that can be used in intervals and age invariants, declaration of Colors types and declaration of Variables"; | 62 | private static final String titleBorderToolTip = "<html>Declaration of colors types, color variables and global integer constants.<br>To see a summary list press SHIFT + F</html>"; |
35 | 63 | private static final String titleBorderToolTipNoColor = "Declaration of global constants that can be used in intervals and age invariants"; | 63 | private static final String titleBorderToolTipNoColor = "Declaration of global constants that can be used in intervals and age invariants"; |
36 | 64 | 64 | ||
37 | 65 | private static final String CONSTANTS = "Constants"; | 65 | private static final String CONSTANTS = "Constants"; |
38 | 66 | 66 | ||
39 | === modified file 'src/pipe/gui/GuiFrame.java' | |||
40 | --- src/pipe/gui/GuiFrame.java 2022-02-21 14:38:38 +0000 | |||
41 | +++ src/pipe/gui/GuiFrame.java 2022-03-06 11:11:17 +0000 | |||
42 | @@ -17,10 +17,7 @@ | |||
43 | 17 | import javax.swing.*; | 17 | import javax.swing.*; |
44 | 18 | 18 | ||
45 | 19 | import com.sun.jna.Platform; | 19 | import com.sun.jna.Platform; |
50 | 20 | import net.tapaal.gui.GuiFrameActions; | 20 | import net.tapaal.gui.*; |
47 | 21 | import net.tapaal.gui.GuiFrameControllerActions; | ||
48 | 22 | import net.tapaal.gui.SafeGuiFrameActions; | ||
49 | 23 | import net.tapaal.gui.TabActions; | ||
51 | 24 | import net.tapaal.gui.debug.DEBUG; | 21 | import net.tapaal.gui.debug.DEBUG; |
52 | 25 | import dk.aau.cs.util.JavaUtil; | 22 | import dk.aau.cs.util.JavaUtil; |
53 | 26 | import dk.aau.cs.verification.VerifyTAPN.VerifyPN; | 23 | import dk.aau.cs.verification.VerifyTAPN.VerifyPN; |
54 | @@ -225,7 +222,11 @@ | |||
55 | 225 | guiFrameController.ifPresent(GuiFrameControllerActions::clearPreferences); | 222 | guiFrameController.ifPresent(GuiFrameControllerActions::clearPreferences); |
56 | 226 | } | 223 | } |
57 | 227 | }; | 224 | }; |
59 | 228 | 225 | private final GuiAction showColorTypesVariables = new GuiAction("Show color types/variables/constants", "Opens a floating window showing the global color types/variables/constants for the net.", KeyStroke.getKeyStroke(("shift F"))) { | |
60 | 226 | public void actionPerformed(ActionEvent arg0) { | ||
61 | 227 | currentTab.ifPresent(TabActions::showColorTypesVariables); | ||
62 | 228 | } | ||
63 | 229 | }; | ||
64 | 229 | private final GuiAction verifyAction = new GuiAction("Verify query", "Verifies the currently selected query", KeyStroke.getKeyStroke(KeyEvent.VK_M, shortcutkey)) { | 230 | private final GuiAction verifyAction = new GuiAction("Verify query", "Verifies the currently selected query", KeyStroke.getKeyStroke(KeyEvent.VK_M, shortcutkey)) { |
65 | 230 | public void actionPerformed(ActionEvent arg0) { | 231 | public void actionPerformed(ActionEvent arg0) { |
66 | 231 | currentTab.ifPresent(TabActions::verifySelectedQuery); | 232 | currentTab.ifPresent(TabActions::verifySelectedQuery); |
67 | @@ -796,6 +797,8 @@ | |||
68 | 796 | mergeComponentsDialog.setMnemonic('c'); | 797 | mergeComponentsDialog.setMnemonic('c'); |
69 | 797 | toolsMenu.add(mergeComponentsDialog); | 798 | toolsMenu.add(mergeComponentsDialog); |
70 | 798 | 799 | ||
71 | 800 | toolsMenu.add(showColorTypesVariables); | ||
72 | 801 | |||
73 | 799 | toolsMenu.addSeparator(); | 802 | toolsMenu.addSeparator(); |
74 | 800 | 803 | ||
75 | 801 | JMenuItem batchProcessing = new JMenuItem(batchProcessingAction); | 804 | JMenuItem batchProcessing = new JMenuItem(batchProcessingAction); |
76 | @@ -964,6 +967,8 @@ | |||
77 | 964 | 967 | ||
78 | 965 | verifyAction.setEnabled(getCurrentTab().isQueryPossible()); | 968 | verifyAction.setEnabled(getCurrentTab().isQueryPossible()); |
79 | 966 | 969 | ||
80 | 970 | showColorTypesVariables.setEnabled(getCurrentTab().lens.isColored()); | ||
81 | 971 | |||
82 | 967 | smartDrawAction.setEnabled(true); | 972 | smartDrawAction.setEnabled(true); |
83 | 968 | mergeComponentsDialogAction.setEnabled(true); | 973 | mergeComponentsDialogAction.setEnabled(true); |
84 | 969 | if (gameFeatureOptions.getSelectedIndex() == 1 || colorFeatureOptions.getSelectedIndex() == 1) { | 974 | if (gameFeatureOptions.getSelectedIndex() == 1 || colorFeatureOptions.getSelectedIndex() == 1) { |
85 | @@ -1005,6 +1010,8 @@ | |||
86 | 1005 | redoAction.setEnabled(false); | 1010 | redoAction.setEnabled(false); |
87 | 1006 | verifyAction.setEnabled(false); | 1011 | verifyAction.setEnabled(false); |
88 | 1007 | 1012 | ||
89 | 1013 | showColorTypesVariables.setEnabled(getCurrentTab().lens.isColored()); | ||
90 | 1014 | |||
91 | 1008 | smartDrawAction.setEnabled(false); | 1015 | smartDrawAction.setEnabled(false); |
92 | 1009 | mergeComponentsDialogAction.setEnabled(false); | 1016 | mergeComponentsDialogAction.setEnabled(false); |
93 | 1010 | workflowDialogAction.setEnabled(false); | 1017 | workflowDialogAction.setEnabled(false); |
94 | @@ -1022,6 +1029,8 @@ | |||
95 | 1022 | importTraceAction.setEnabled(false); | 1029 | importTraceAction.setEnabled(false); |
96 | 1023 | verifyAction.setEnabled(false); | 1030 | verifyAction.setEnabled(false); |
97 | 1024 | 1031 | ||
98 | 1032 | showColorTypesVariables.setEnabled(false); | ||
99 | 1033 | |||
100 | 1025 | annotationAction.setEnabled(false); | 1034 | annotationAction.setEnabled(false); |
101 | 1026 | selectAllAction.setEnabled(false); | 1035 | selectAllAction.setEnabled(false); |
102 | 1027 | 1036 | ||
103 | @@ -1245,6 +1254,8 @@ | |||
104 | 1245 | mergeComponentsDialog.setMnemonic('c'); | 1254 | mergeComponentsDialog.setMnemonic('c'); |
105 | 1246 | toolsMenu.add(mergeComponentsDialog); | 1255 | toolsMenu.add(mergeComponentsDialog); |
106 | 1247 | 1256 | ||
107 | 1257 | toolsMenu.add(showColorTypesVariables); | ||
108 | 1258 | |||
109 | 1248 | for(GuiAction action : toolsActions){ | 1259 | for(GuiAction action : toolsActions){ |
110 | 1249 | toolsMenu.add(action); | 1260 | toolsMenu.add(action); |
111 | 1250 | } | 1261 | } |
112 | 1251 | 1262 | ||
113 | === modified file 'src/pipe/gui/petrinet/PetriNetTab.java' | |||
114 | --- src/pipe/gui/petrinet/PetriNetTab.java 2022-02-22 13:27:24 +0000 | |||
115 | +++ src/pipe/gui/petrinet/PetriNetTab.java 2022-03-06 11:11:17 +0000 | |||
116 | @@ -3,6 +3,21 @@ | |||
117 | 3 | import dk.aau.cs.TCTL.Parsing.ParseException; | 3 | import dk.aau.cs.TCTL.Parsing.ParseException; |
118 | 4 | import dk.aau.cs.TCTL.*; | 4 | import dk.aau.cs.TCTL.*; |
119 | 5 | import dk.aau.cs.debug.Logger; | 5 | import dk.aau.cs.debug.Logger; |
120 | 6 | import dk.aau.cs.model.CPN.ColorType; | ||
121 | 7 | import dk.aau.cs.model.CPN.Variable; | ||
122 | 8 | import net.tapaal.gui.GuiFrameActions; | ||
123 | 9 | import net.tapaal.gui.GuiFrameControllerActions; | ||
124 | 10 | import net.tapaal.gui.SafeGuiFrameActions; | ||
125 | 11 | import net.tapaal.gui.TabActions; | ||
126 | 12 | import net.tapaal.gui.petrinet.*; | ||
127 | 13 | import net.tapaal.gui.petrinet.model.ModelViolation; | ||
128 | 14 | import net.tapaal.gui.petrinet.model.Result; | ||
129 | 15 | import net.tapaal.gui.petrinet.editor.TemplateExplorer; | ||
130 | 16 | import net.tapaal.gui.petrinet.model.GuiModelManager; | ||
131 | 17 | import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane; | ||
132 | 18 | import net.tapaal.gui.petrinet.dialog.NameVisibilityPanel; | ||
133 | 19 | import net.tapaal.gui.petrinet.dialog.StatisticsPanel; | ||
134 | 20 | import net.tapaal.gui.petrinet.animation.TransitionFiringComponent; | ||
135 | 6 | import dk.aau.cs.io.*; | 21 | import dk.aau.cs.io.*; |
136 | 7 | import dk.aau.cs.io.queries.SUMOQueryLoader; | 22 | import dk.aau.cs.io.queries.SUMOQueryLoader; |
137 | 8 | import dk.aau.cs.io.queries.XMLQueryLoader; | 23 | import dk.aau.cs.io.queries.XMLQueryLoader; |
138 | @@ -43,10 +58,13 @@ | |||
139 | 43 | import net.tapaal.gui.petrinet.widgets.QueryPane; | 58 | import net.tapaal.gui.petrinet.widgets.QueryPane; |
140 | 44 | import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane; | 59 | import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane; |
141 | 45 | import net.tapaal.helpers.Reference.MutableReference; | 60 | import net.tapaal.helpers.Reference.MutableReference; |
142 | 61 | import net.tapaal.resourcemanager.ResourceManager; | ||
143 | 46 | import net.tapaal.swinghelpers.JSplitPaneFix; | 62 | import net.tapaal.swinghelpers.JSplitPaneFix; |
144 | 47 | import org.jdesktop.swingx.MultiSplitLayout.Divider; | 63 | import org.jdesktop.swingx.MultiSplitLayout.Divider; |
145 | 48 | import org.jdesktop.swingx.MultiSplitLayout.Leaf; | 64 | import org.jdesktop.swingx.MultiSplitLayout.Leaf; |
146 | 49 | import org.jdesktop.swingx.MultiSplitLayout.Split; | 65 | import org.jdesktop.swingx.MultiSplitLayout.Split; |
147 | 66 | import pipe.gui.petrinet.dataLayer.DataLayer; | ||
148 | 67 | import pipe.gui.petrinet.action.GuiAction; | ||
149 | 50 | import pipe.gui.Constants; | 68 | import pipe.gui.Constants; |
150 | 51 | import pipe.gui.GuiFrame; | 69 | import pipe.gui.GuiFrame; |
151 | 52 | import pipe.gui.MessengerImpl; | 70 | import pipe.gui.MessengerImpl; |
152 | @@ -54,12 +72,10 @@ | |||
153 | 54 | import pipe.gui.canvas.DrawingSurfaceImpl; | 72 | import pipe.gui.canvas.DrawingSurfaceImpl; |
154 | 55 | import pipe.gui.canvas.Grid; | 73 | import pipe.gui.canvas.Grid; |
155 | 56 | import pipe.gui.canvas.Zoomer; | 74 | import pipe.gui.canvas.Zoomer; |
156 | 57 | import pipe.gui.petrinet.action.GuiAction; | ||
157 | 58 | import pipe.gui.petrinet.animation.AnimationControlSidePanel; | 75 | import pipe.gui.petrinet.animation.AnimationControlSidePanel; |
158 | 59 | import pipe.gui.petrinet.animation.AnimationHistoryList; | 76 | import pipe.gui.petrinet.animation.AnimationHistoryList; |
159 | 60 | import pipe.gui.petrinet.animation.AnimationHistorySidePanel; | 77 | import pipe.gui.petrinet.animation.AnimationHistorySidePanel; |
160 | 61 | import pipe.gui.petrinet.animation.Animator; | 78 | import pipe.gui.petrinet.animation.Animator; |
161 | 62 | import pipe.gui.petrinet.dataLayer.DataLayer; | ||
162 | 63 | import pipe.gui.petrinet.graphicElements.*; | 79 | import pipe.gui.petrinet.graphicElements.*; |
163 | 64 | import pipe.gui.petrinet.graphicElements.tapn.*; | 80 | import pipe.gui.petrinet.graphicElements.tapn.*; |
164 | 65 | import pipe.gui.petrinet.undo.UndoManager; | 81 | import pipe.gui.petrinet.undo.UndoManager; |
165 | @@ -1425,6 +1441,106 @@ | |||
166 | 1425 | } | 1441 | } |
167 | 1426 | 1442 | ||
168 | 1427 | @Override | 1443 | @Override |
169 | 1444 | public void showColorTypesVariables() { | ||
170 | 1445 | StringBuilder buffer = new StringBuilder(); | ||
171 | 1446 | Context context = new Context(TAPAALGUI.getCurrentTab()); | ||
172 | 1447 | |||
173 | 1448 | List<ColorType> listColorTypes = context.network().colorTypes(); | ||
174 | 1449 | List<Variable> variableList = context.network().variables(); | ||
175 | 1450 | List<Constant> constantsList = new ArrayList<>(context.network().constants()); | ||
176 | 1451 | |||
177 | 1452 | getColorTypesFormattedString(listColorTypes, buffer); | ||
178 | 1453 | |||
179 | 1454 | if(!variableList.isEmpty()) { | ||
180 | 1455 | buffer.append("<br>"); | ||
181 | 1456 | } | ||
182 | 1457 | |||
183 | 1458 | getVariablesFormattedString(variableList, buffer); | ||
184 | 1459 | |||
185 | 1460 | if(!constantsList.isEmpty()) { | ||
186 | 1461 | buffer.append("<br><br>"); | ||
187 | 1462 | } | ||
188 | 1463 | |||
189 | 1464 | getConstantsFormattedString(constantsList, buffer); | ||
190 | 1465 | |||
191 | 1466 | JLabel label = new JLabel("<html>" + buffer + "</html>"); | ||
192 | 1467 | label.setFont(new Font(label.getFont().getName(), Font.PLAIN, label.getFont().getSize())); | ||
193 | 1468 | |||
194 | 1469 | JOptionPane.showMessageDialog(null, label, "Global color types/variables", JOptionPane.INFORMATION_MESSAGE); | ||
195 | 1470 | } | ||
196 | 1471 | |||
197 | 1472 | private String getColorTypesFormattedString(List<ColorType> listColorTypes, StringBuilder buffer) { | ||
198 | 1473 | String stringColorList = ""; | ||
199 | 1474 | for(int i = 0; i < listColorTypes.size(); i++) { | ||
200 | 1475 | if(i == 0) { | ||
201 | 1476 | buffer.append("Color Types:<br>"); | ||
202 | 1477 | } | ||
203 | 1478 | buffer.append(listColorTypes.get(i).getName() + " <b>is</b> "); | ||
204 | 1479 | |||
205 | 1480 | if(listColorTypes.get(i).isProductColorType()) { | ||
206 | 1481 | buffer.append("<"); | ||
207 | 1482 | for(int x = 0; x < listColorTypes.get(i).getProductColorTypes().size(); x++) { | ||
208 | 1483 | stringColorList += listColorTypes.get(i).getProductColorTypes().get(x).getName(); | ||
209 | 1484 | |||
210 | 1485 | if(x != listColorTypes.get(i).getProductColorTypes().size() - 1){ | ||
211 | 1486 | stringColorList += ", "; | ||
212 | 1487 | } | ||
213 | 1488 | } | ||
214 | 1489 | buffer.append(stringColorList + "><br>"); | ||
215 | 1490 | stringColorList = ""; | ||
216 | 1491 | |||
217 | 1492 | } else if(listColorTypes.get(i).isIntegerRange()) { | ||
218 | 1493 | if(listColorTypes.get(i).size() > 1) { | ||
219 | 1494 | int listSize = listColorTypes.get(i).size(); | ||
220 | 1495 | buffer.append("[" + listColorTypes.get(i).getColors().get(0).getColorName() + ".." + listColorTypes.get(i).getColors().get(listSize - 1).getColorName() + "]"); | ||
221 | 1496 | } else { | ||
222 | 1497 | buffer.append("[" + listColorTypes.get(i).getFirstColor().getColorName() + "]"); | ||
223 | 1498 | } | ||
224 | 1499 | buffer.append("<br>"); | ||
225 | 1500 | |||
226 | 1501 | } else { | ||
227 | 1502 | buffer.append("["); | ||
228 | 1503 | for(int x = 0; x < listColorTypes.get(i).getColors().size(); x++) { | ||
229 | 1504 | stringColorList += listColorTypes.get(i).getColors().get(x).getName(); | ||
230 | 1505 | |||
231 | 1506 | if(x != listColorTypes.get(i).getColors().size() - 1){ | ||
232 | 1507 | stringColorList += ", "; | ||
233 | 1508 | } | ||
234 | 1509 | } | ||
235 | 1510 | buffer.append(stringColorList + "]<br>"); | ||
236 | 1511 | stringColorList = ""; | ||
237 | 1512 | } | ||
238 | 1513 | } | ||
239 | 1514 | |||
240 | 1515 | return buffer.toString(); | ||
241 | 1516 | } | ||
242 | 1517 | |||
243 | 1518 | private String getVariablesFormattedString(List<Variable> variableList, StringBuilder buffer) { | ||
244 | 1519 | for(int i = 0; i < variableList.size(); i++) { | ||
245 | 1520 | if (i == 0) { | ||
246 | 1521 | buffer.append("Variables:<br>"); | ||
247 | 1522 | } | ||
248 | 1523 | buffer.append(variableList.get(i).getName() + " <b>in</b> " + variableList.get(i).getColorType().getName()); | ||
249 | 1524 | if(i != variableList.size() - 1) { | ||
250 | 1525 | buffer.append("<br>"); | ||
251 | 1526 | } | ||
252 | 1527 | } | ||
253 | 1528 | return buffer.toString(); | ||
254 | 1529 | } | ||
255 | 1530 | |||
256 | 1531 | private String getConstantsFormattedString(List<Constant> constantsList, StringBuilder buffer) { | ||
257 | 1532 | for (int i = 0; i < constantsList.size(); i++) { | ||
258 | 1533 | if (i == 0) { | ||
259 | 1534 | buffer.append("Constants:<br>"); | ||
260 | 1535 | } | ||
261 | 1536 | buffer.append(constantsList.get(i).toString()); | ||
262 | 1537 | if (i != constantsList.size() - 1) { | ||
263 | 1538 | buffer.append("<br>"); | ||
264 | 1539 | } | ||
265 | 1540 | } | ||
266 | 1541 | return buffer.toString(); | ||
267 | 1542 | } | ||
268 | 1543 | |||
269 | 1428 | public void alignToGrid() { | 1544 | public void alignToGrid() { |
270 | 1429 | ArrayList<PetriNetObject> petriNetObjects = drawingSurface.getGuiModel().getPlaceTransitionObjects(); | 1545 | ArrayList<PetriNetObject> petriNetObjects = drawingSurface.getGuiModel().getPlaceTransitionObjects(); |
271 | 1430 | undoManager.newEdit(); | 1546 | undoManager.newEdit(); |
open CPN token-ring net and show the color type information and it does not do it correctly for the product type Couple is (after which it does not print anything).
Could this be a problem also in tikz export?