Merge lp:~tapaal-contributor/tapaal/cpn-variable-color-tool-window into lp:~tapaal-contributor/tapaal/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
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.

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

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?

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
=== modified file 'src/net/tapaal/gui/GuiFrameController.java'
--- src/net/tapaal/gui/GuiFrameController.java 2022-02-21 18:32:54 +0000
+++ src/net/tapaal/gui/GuiFrameController.java 2022-03-06 11:11:17 +0000
@@ -735,6 +735,7 @@
735 public void showSimpleWorkspace() {735 public void showSimpleWorkspace() {
736 showAdvancedWorkspace(false);736 showAdvancedWorkspace(false);
737 }737 }
738
738 private void showAdvancedWorkspace(boolean advanced){739 private void showAdvancedWorkspace(boolean advanced){
739 QueryDialog.setAdvancedView(advanced);740 QueryDialog.setAdvancedView(advanced);
740 setComponents(advanced);741 setComponents(advanced);
741742
=== modified file 'src/net/tapaal/gui/TabActions.java'
--- src/net/tapaal/gui/TabActions.java 2022-02-21 07:29:48 +0000
+++ src/net/tapaal/gui/TabActions.java 2022-03-06 11:11:17 +0000
@@ -108,6 +108,8 @@
108108
109 void showChangeNameVisibility();109 void showChangeNameVisibility();
110110
111 void showColorTypesVariables();
112
111 void alignToGrid();113 void alignToGrid();
112114
113 void copy();115 void copy();
114116
=== modified file 'src/net/tapaal/gui/petrinet/editor/ConstantsPane.java'
--- src/net/tapaal/gui/petrinet/editor/ConstantsPane.java 2022-02-20 20:18:49 +0000
+++ src/net/tapaal/gui/petrinet/editor/ConstantsPane.java 2022-03-06 11:11:17 +0000
@@ -59,7 +59,7 @@
5959
60 private static final String titleBorder = "Global constants, Color types and Variables";60 private static final String titleBorder = "Global constants, Color types and Variables";
61 private static final String titleBorderNoColor = "Global constants";61 private static final String titleBorderNoColor = "Global constants";
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>";
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";
6464
65 private static final String CONSTANTS = "Constants";65 private static final String CONSTANTS = "Constants";
6666
=== modified file 'src/pipe/gui/GuiFrame.java'
--- src/pipe/gui/GuiFrame.java 2022-02-21 14:38:38 +0000
+++ src/pipe/gui/GuiFrame.java 2022-03-06 11:11:17 +0000
@@ -17,10 +17,7 @@
17import javax.swing.*;17import javax.swing.*;
1818
19import com.sun.jna.Platform;19import com.sun.jna.Platform;
20import net.tapaal.gui.GuiFrameActions;20import net.tapaal.gui.*;
21import net.tapaal.gui.GuiFrameControllerActions;
22import net.tapaal.gui.SafeGuiFrameActions;
23import net.tapaal.gui.TabActions;
24import net.tapaal.gui.debug.DEBUG;21import net.tapaal.gui.debug.DEBUG;
25import dk.aau.cs.util.JavaUtil;22import dk.aau.cs.util.JavaUtil;
26import dk.aau.cs.verification.VerifyTAPN.VerifyPN;23import dk.aau.cs.verification.VerifyTAPN.VerifyPN;
@@ -225,7 +222,11 @@
225 guiFrameController.ifPresent(GuiFrameControllerActions::clearPreferences);222 guiFrameController.ifPresent(GuiFrameControllerActions::clearPreferences);
226 }223 }
227 };224 };
228225 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"))) {
226 public void actionPerformed(ActionEvent arg0) {
227 currentTab.ifPresent(TabActions::showColorTypesVariables);
228 }
229 };
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)) {
230 public void actionPerformed(ActionEvent arg0) {231 public void actionPerformed(ActionEvent arg0) {
231 currentTab.ifPresent(TabActions::verifySelectedQuery);232 currentTab.ifPresent(TabActions::verifySelectedQuery);
@@ -796,6 +797,8 @@
796 mergeComponentsDialog.setMnemonic('c');797 mergeComponentsDialog.setMnemonic('c');
797 toolsMenu.add(mergeComponentsDialog);798 toolsMenu.add(mergeComponentsDialog);
798799
800 toolsMenu.add(showColorTypesVariables);
801
799 toolsMenu.addSeparator();802 toolsMenu.addSeparator();
800803
801 JMenuItem batchProcessing = new JMenuItem(batchProcessingAction);804 JMenuItem batchProcessing = new JMenuItem(batchProcessingAction);
@@ -964,6 +967,8 @@
964967
965 verifyAction.setEnabled(getCurrentTab().isQueryPossible());968 verifyAction.setEnabled(getCurrentTab().isQueryPossible());
966969
970 showColorTypesVariables.setEnabled(getCurrentTab().lens.isColored());
971
967 smartDrawAction.setEnabled(true);972 smartDrawAction.setEnabled(true);
968 mergeComponentsDialogAction.setEnabled(true);973 mergeComponentsDialogAction.setEnabled(true);
969 if (gameFeatureOptions.getSelectedIndex() == 1 || colorFeatureOptions.getSelectedIndex() == 1) {974 if (gameFeatureOptions.getSelectedIndex() == 1 || colorFeatureOptions.getSelectedIndex() == 1) {
@@ -1005,6 +1010,8 @@
1005 redoAction.setEnabled(false);1010 redoAction.setEnabled(false);
1006 verifyAction.setEnabled(false);1011 verifyAction.setEnabled(false);
10071012
1013 showColorTypesVariables.setEnabled(getCurrentTab().lens.isColored());
1014
1008 smartDrawAction.setEnabled(false);1015 smartDrawAction.setEnabled(false);
1009 mergeComponentsDialogAction.setEnabled(false);1016 mergeComponentsDialogAction.setEnabled(false);
1010 workflowDialogAction.setEnabled(false);1017 workflowDialogAction.setEnabled(false);
@@ -1022,6 +1029,8 @@
1022 importTraceAction.setEnabled(false);1029 importTraceAction.setEnabled(false);
1023 verifyAction.setEnabled(false);1030 verifyAction.setEnabled(false);
10241031
1032 showColorTypesVariables.setEnabled(false);
1033
1025 annotationAction.setEnabled(false);1034 annotationAction.setEnabled(false);
1026 selectAllAction.setEnabled(false);1035 selectAllAction.setEnabled(false);
10271036
@@ -1245,6 +1254,8 @@
1245 mergeComponentsDialog.setMnemonic('c');1254 mergeComponentsDialog.setMnemonic('c');
1246 toolsMenu.add(mergeComponentsDialog);1255 toolsMenu.add(mergeComponentsDialog);
12471256
1257 toolsMenu.add(showColorTypesVariables);
1258
1248 for(GuiAction action : toolsActions){1259 for(GuiAction action : toolsActions){
1249 toolsMenu.add(action);1260 toolsMenu.add(action);
1250 }1261 }
12511262
=== modified file 'src/pipe/gui/petrinet/PetriNetTab.java'
--- src/pipe/gui/petrinet/PetriNetTab.java 2022-02-22 13:27:24 +0000
+++ src/pipe/gui/petrinet/PetriNetTab.java 2022-03-06 11:11:17 +0000
@@ -3,6 +3,21 @@
3import dk.aau.cs.TCTL.Parsing.ParseException;3import dk.aau.cs.TCTL.Parsing.ParseException;
4import dk.aau.cs.TCTL.*;4import dk.aau.cs.TCTL.*;
5import dk.aau.cs.debug.Logger;5import dk.aau.cs.debug.Logger;
6import dk.aau.cs.model.CPN.ColorType;
7import dk.aau.cs.model.CPN.Variable;
8import net.tapaal.gui.GuiFrameActions;
9import net.tapaal.gui.GuiFrameControllerActions;
10import net.tapaal.gui.SafeGuiFrameActions;
11import net.tapaal.gui.TabActions;
12import net.tapaal.gui.petrinet.*;
13import net.tapaal.gui.petrinet.model.ModelViolation;
14import net.tapaal.gui.petrinet.model.Result;
15import net.tapaal.gui.petrinet.editor.TemplateExplorer;
16import net.tapaal.gui.petrinet.model.GuiModelManager;
17import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane;
18import net.tapaal.gui.petrinet.dialog.NameVisibilityPanel;
19import net.tapaal.gui.petrinet.dialog.StatisticsPanel;
20import net.tapaal.gui.petrinet.animation.TransitionFiringComponent;
6import dk.aau.cs.io.*;21import dk.aau.cs.io.*;
7import dk.aau.cs.io.queries.SUMOQueryLoader;22import dk.aau.cs.io.queries.SUMOQueryLoader;
8import dk.aau.cs.io.queries.XMLQueryLoader;23import dk.aau.cs.io.queries.XMLQueryLoader;
@@ -43,10 +58,13 @@
43import net.tapaal.gui.petrinet.widgets.QueryPane;58import net.tapaal.gui.petrinet.widgets.QueryPane;
44import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane;59import net.tapaal.gui.swingcomponents.BugHandledJXMultisplitPane;
45import net.tapaal.helpers.Reference.MutableReference;60import net.tapaal.helpers.Reference.MutableReference;
61import net.tapaal.resourcemanager.ResourceManager;
46import net.tapaal.swinghelpers.JSplitPaneFix;62import net.tapaal.swinghelpers.JSplitPaneFix;
47import org.jdesktop.swingx.MultiSplitLayout.Divider;63import org.jdesktop.swingx.MultiSplitLayout.Divider;
48import org.jdesktop.swingx.MultiSplitLayout.Leaf;64import org.jdesktop.swingx.MultiSplitLayout.Leaf;
49import org.jdesktop.swingx.MultiSplitLayout.Split;65import org.jdesktop.swingx.MultiSplitLayout.Split;
66import pipe.gui.petrinet.dataLayer.DataLayer;
67import pipe.gui.petrinet.action.GuiAction;
50import pipe.gui.Constants;68import pipe.gui.Constants;
51import pipe.gui.GuiFrame;69import pipe.gui.GuiFrame;
52import pipe.gui.MessengerImpl;70import pipe.gui.MessengerImpl;
@@ -54,12 +72,10 @@
54import pipe.gui.canvas.DrawingSurfaceImpl;72import pipe.gui.canvas.DrawingSurfaceImpl;
55import pipe.gui.canvas.Grid;73import pipe.gui.canvas.Grid;
56import pipe.gui.canvas.Zoomer;74import pipe.gui.canvas.Zoomer;
57import pipe.gui.petrinet.action.GuiAction;
58import pipe.gui.petrinet.animation.AnimationControlSidePanel;75import pipe.gui.petrinet.animation.AnimationControlSidePanel;
59import pipe.gui.petrinet.animation.AnimationHistoryList;76import pipe.gui.petrinet.animation.AnimationHistoryList;
60import pipe.gui.petrinet.animation.AnimationHistorySidePanel;77import pipe.gui.petrinet.animation.AnimationHistorySidePanel;
61import pipe.gui.petrinet.animation.Animator;78import pipe.gui.petrinet.animation.Animator;
62import pipe.gui.petrinet.dataLayer.DataLayer;
63import pipe.gui.petrinet.graphicElements.*;79import pipe.gui.petrinet.graphicElements.*;
64import pipe.gui.petrinet.graphicElements.tapn.*;80import pipe.gui.petrinet.graphicElements.tapn.*;
65import pipe.gui.petrinet.undo.UndoManager;81import pipe.gui.petrinet.undo.UndoManager;
@@ -1425,6 +1441,106 @@
1425 }1441 }
14261442
1427 @Override1443 @Override
1444 public void showColorTypesVariables() {
1445 StringBuilder buffer = new StringBuilder();
1446 Context context = new Context(TAPAALGUI.getCurrentTab());
1447
1448 List<ColorType> listColorTypes = context.network().colorTypes();
1449 List<Variable> variableList = context.network().variables();
1450 List<Constant> constantsList = new ArrayList<>(context.network().constants());
1451
1452 getColorTypesFormattedString(listColorTypes, buffer);
1453
1454 if(!variableList.isEmpty()) {
1455 buffer.append("<br>");
1456 }
1457
1458 getVariablesFormattedString(variableList, buffer);
1459
1460 if(!constantsList.isEmpty()) {
1461 buffer.append("<br><br>");
1462 }
1463
1464 getConstantsFormattedString(constantsList, buffer);
1465
1466 JLabel label = new JLabel("<html>" + buffer + "</html>");
1467 label.setFont(new Font(label.getFont().getName(), Font.PLAIN, label.getFont().getSize()));
1468
1469 JOptionPane.showMessageDialog(null, label, "Global color types/variables", JOptionPane.INFORMATION_MESSAGE);
1470 }
1471
1472 private String getColorTypesFormattedString(List<ColorType> listColorTypes, StringBuilder buffer) {
1473 String stringColorList = "";
1474 for(int i = 0; i < listColorTypes.size(); i++) {
1475 if(i == 0) {
1476 buffer.append("Color Types:<br>");
1477 }
1478 buffer.append(listColorTypes.get(i).getName() + " <b>is</b> ");
1479
1480 if(listColorTypes.get(i).isProductColorType()) {
1481 buffer.append("&lt;");
1482 for(int x = 0; x < listColorTypes.get(i).getProductColorTypes().size(); x++) {
1483 stringColorList += listColorTypes.get(i).getProductColorTypes().get(x).getName();
1484
1485 if(x != listColorTypes.get(i).getProductColorTypes().size() - 1){
1486 stringColorList += ", ";
1487 }
1488 }
1489 buffer.append(stringColorList + "&gt;<br>");
1490 stringColorList = "";
1491
1492 } else if(listColorTypes.get(i).isIntegerRange()) {
1493 if(listColorTypes.get(i).size() > 1) {
1494 int listSize = listColorTypes.get(i).size();
1495 buffer.append("[" + listColorTypes.get(i).getColors().get(0).getColorName() + ".." + listColorTypes.get(i).getColors().get(listSize - 1).getColorName() + "]");
1496 } else {
1497 buffer.append("[" + listColorTypes.get(i).getFirstColor().getColorName() + "]");
1498 }
1499 buffer.append("<br>");
1500
1501 } else {
1502 buffer.append("[");
1503 for(int x = 0; x < listColorTypes.get(i).getColors().size(); x++) {
1504 stringColorList += listColorTypes.get(i).getColors().get(x).getName();
1505
1506 if(x != listColorTypes.get(i).getColors().size() - 1){
1507 stringColorList += ", ";
1508 }
1509 }
1510 buffer.append(stringColorList + "]<br>");
1511 stringColorList = "";
1512 }
1513 }
1514
1515 return buffer.toString();
1516 }
1517
1518 private String getVariablesFormattedString(List<Variable> variableList, StringBuilder buffer) {
1519 for(int i = 0; i < variableList.size(); i++) {
1520 if (i == 0) {
1521 buffer.append("Variables:<br>");
1522 }
1523 buffer.append(variableList.get(i).getName() + " <b>in</b> " + variableList.get(i).getColorType().getName());
1524 if(i != variableList.size() - 1) {
1525 buffer.append("<br>");
1526 }
1527 }
1528 return buffer.toString();
1529 }
1530
1531 private String getConstantsFormattedString(List<Constant> constantsList, StringBuilder buffer) {
1532 for (int i = 0; i < constantsList.size(); i++) {
1533 if (i == 0) {
1534 buffer.append("Constants:<br>");
1535 }
1536 buffer.append(constantsList.get(i).toString());
1537 if (i != constantsList.size() - 1) {
1538 buffer.append("<br>");
1539 }
1540 }
1541 return buffer.toString();
1542 }
1543
1428 public void alignToGrid() {1544 public void alignToGrid() {
1429 ArrayList<PetriNetObject> petriNetObjects = drawingSurface.getGuiModel().getPlaceTransitionObjects();1545 ArrayList<PetriNetObject> petriNetObjects = drawingSurface.getGuiModel().getPlaceTransitionObjects();
1430 undoManager.newEdit();1546 undoManager.newEdit();

Subscribers

People subscribed via source and target branches

to all changes: