Merge lp:~tapaal-contributor/tapaal/draw-urgent-transition-timed-net-icon-1951026 into lp:tapaal

Proposed by Kristian Morsing Pedersen
Status: Superseded
Proposed branch: lp:~tapaal-contributor/tapaal/draw-urgent-transition-timed-net-icon-1951026
Merge into: lp:tapaal
Diff against target: 145 lines (+38/-10)
2 files modified
src/dk/aau/cs/gui/TabContent.java (+37/-9)
src/pipe/gui/Pipe.java (+1/-1)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/draw-urgent-transition-timed-net-icon-1951026
Reviewer Review Type Date Requested Status
Jiri Srba Pending
Review via email: mp+411946@code.launchpad.net

This proposal has been superseded by a proposal from 2021-11-16.

Commit message

Added support, and icon, for drawing urgent transitions

Description of the change

In the menu, when the lens is set to a timed net, a new icon with an urgent transition will appear in the menu beside the transition icon. Clicking this will allow to directly draw urgent transitions.
This option has also been added to the "Draw menu"

To post a comment you must log in.
1159. By Kristian Morsing Pedersen <email address hidden>

Added icon for urgent transitions

1160. By Kristian Morsing Pedersen <email address hidden>

Added uncontrollable urgent transition icon and the option to the draw menu

1161. By Kristian Morsing Pedersen <email address hidden>

Fixed merge conflict with trunk

1162. By Kristian Morsing Pedersen <email address hidden>

Toggle uncontrollable transition is now greyed out while in simulation mode

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dk/aau/cs/gui/TabContent.java'
2--- src/dk/aau/cs/gui/TabContent.java 2021-11-05 14:11:49 +0000
3+++ src/dk/aau/cs/gui/TabContent.java 2021-11-16 20:18:23 +0000
4@@ -171,10 +171,11 @@
5 return new Result<>(pnObject);
6 }
7
8- public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p, boolean isUncontrollable) {
9+ public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p, boolean isUncontrollable, boolean isUrgent) {
10 dk.aau.cs.model.tapn.TimedTransition transition = new dk.aau.cs.model.tapn.TimedTransition(drawingSurface.getNameGenerator().getNewTransitionName(guiModelToModel.get(c)));
11
12 transition.setUncontrollable(isUncontrollable);
13+ transition.setUrgent(isUrgent);
14 TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens);
15
16 guiModelToModel.get(c).add(transition);
17@@ -1855,6 +1856,9 @@
18 case TAPNTRANS:
19 setManager(new CanvasTransitionDrawController());
20 break;
21+ case TAPNURGENTTRANS:
22+ setManager(new CanvasUrgentTransitionDrawController());
23+ break;
24 case UNCONTROLLABLETRANS:
25 setManager(new CanvasUncontrollableTransitionDrawController());
26 break;
27@@ -2231,7 +2235,22 @@
28 public void drawingSurfaceMousePressed(MouseEvent e) {
29 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
30
31- guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false);
32+ guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, false);
33+ }
34+
35+ @Override
36+ public void registerEvents() {
37+
38+ }
39+ }
40+
41+ class CanvasUrgentTransitionDrawController extends AbstractDrawingSurfaceManager {
42+
43+ @Override
44+ public void drawingSurfaceMousePressed(MouseEvent e) {
45+ Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
46+
47+ guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, true);
48 }
49
50 @Override
51@@ -2246,7 +2265,7 @@
52 public void drawingSurfaceMousePressed(MouseEvent e) {
53 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
54
55- guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true);
56+ guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, false);
57 }
58
59 @Override
60@@ -2383,7 +2402,7 @@
61 var r = guiModelManager.addNewTimedPlace(getModel(), p);
62 placeClicked(r.result, e);
63 } else { //Transition
64- var r = guiModelManager.addNewTimedTransitions(getModel(), p, false);
65+ var r = guiModelManager.addNewTimedTransitions(getModel(), p, false, false);
66 transitionClicked(r.result, e);
67 }
68 }
69@@ -2827,11 +2846,11 @@
70 }
71 }
72 public List<GuiAction> getAvailableDrawActions(){
73- if (lens.isTimed() && !lens.isGame()) {
74- return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));
75- } else if (lens.isTimed()) {
76- return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));
77- } else if (lens.isGame()){
78+ if (lens.isTimed() && lens.isGame()) {
79+ return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, uncontrollableTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));
80+ } else if (lens.isTimed() && !lens.isGame()) {
81+ return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));
82+ } else if (!lens.isTimed() && lens.isGame()){
83 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUncontrollableAction));
84 } else {
85 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction));
86@@ -2868,6 +2887,11 @@
87 setMode(Pipe.ElementType.TAPNTRANS);
88 }
89 };
90+ private final GuiAction urgentTransAction = new GuiAction("Urgent transition", "Add an urgent transition (Y)", "Y", true) {
91+ public void actionPerformed(ActionEvent e) {
92+ setMode(Pipe.ElementType.TAPNURGENTTRANS);
93+ }
94+ };
95 private final GuiAction uncontrollableTransAction = new GuiAction("Uncontrollable transition", "Add an uncontrollable transition (L)", "L", true) {
96 public void actionPerformed(ActionEvent e) {
97 setMode(Pipe.ElementType.UNCONTROLLABLETRANS);
98@@ -2925,6 +2949,7 @@
99 // deselect other actions
100 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);
101 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);
102+ urgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTTRANS);
103 uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS);
104 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);
105 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);
106@@ -2940,6 +2965,7 @@
107 case draw:
108 selectAction.setEnabled(true);
109 transAction.setEnabled(true);
110+ urgentTransAction.setEnabled(true);
111 uncontrollableTransAction.setEnabled(true);
112 timedPlaceAction.setEnabled(true);
113 timedArcAction.setEnabled(true);
114@@ -2954,6 +2980,7 @@
115 case noNet:
116 selectAction.setEnabled(false);
117 transAction.setEnabled(false);
118+ urgentTransAction.setEnabled(false);
119 uncontrollableTransAction.setEnabled(false);
120 timedPlaceAction.setEnabled(false);
121 timedArcAction.setEnabled(false);
122@@ -2967,6 +2994,7 @@
123 case animation:
124 selectAction.setEnabled(false);
125 transAction.setEnabled(false);
126+ urgentTransAction.setEnabled(false);
127 uncontrollableTransAction.setEnabled(false);
128 timedPlaceAction.setEnabled(false);
129 timedArcAction.setEnabled(false);
130
131=== modified file 'src/pipe/gui/Pipe.java'
132--- src/pipe/gui/Pipe.java 2021-04-04 09:31:58 +0000
133+++ src/pipe/gui/Pipe.java 2021-11-16 20:18:23 +0000
134@@ -8,7 +8,7 @@
135 public enum ElementType {
136 PLACE, IMMTRANS, TIMEDTRANS, ANNOTATION, ARC, INHIBARC,
137 //TAPN Elements
138- TAPNPLACE, TAPNTRANS, UNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC,
139+ TAPNPLACE, TAPNTRANS, TAPNURGENTTRANS, UNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC,
140 //Others (might refactore)
141 ADDTOKEN, DELTOKEN, SELECT, DRAW, DRAG,
142 }
143
144=== added file 'src/resources/Images/Urgent transition.png'
145Binary files src/resources/Images/Urgent transition.png 1970-01-01 00:00:00 +0000 and src/resources/Images/Urgent transition.png 2021-11-16 20:18:23 +0000 differ

Subscribers

People subscribed via source and target branches