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
=== modified file 'src/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2021-11-05 14:11:49 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2021-11-16 20:18:23 +0000
@@ -171,10 +171,11 @@
171 return new Result<>(pnObject);171 return new Result<>(pnObject);
172 }172 }
173173
174 public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p, boolean isUncontrollable) {174 public Result<TimedTransitionComponent, ModelViolation> addNewTimedTransitions(DataLayer c, Point p, boolean isUncontrollable, boolean isUrgent) {
175 dk.aau.cs.model.tapn.TimedTransition transition = new dk.aau.cs.model.tapn.TimedTransition(drawingSurface.getNameGenerator().getNewTransitionName(guiModelToModel.get(c)));175 dk.aau.cs.model.tapn.TimedTransition transition = new dk.aau.cs.model.tapn.TimedTransition(drawingSurface.getNameGenerator().getNewTransitionName(guiModelToModel.get(c)));
176176
177 transition.setUncontrollable(isUncontrollable);177 transition.setUncontrollable(isUncontrollable);
178 transition.setUrgent(isUrgent);
178 TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens);179 TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens);
179180
180 guiModelToModel.get(c).add(transition);181 guiModelToModel.get(c).add(transition);
@@ -1855,6 +1856,9 @@
1855 case TAPNTRANS:1856 case TAPNTRANS:
1856 setManager(new CanvasTransitionDrawController());1857 setManager(new CanvasTransitionDrawController());
1857 break;1858 break;
1859 case TAPNURGENTTRANS:
1860 setManager(new CanvasUrgentTransitionDrawController());
1861 break;
1858 case UNCONTROLLABLETRANS:1862 case UNCONTROLLABLETRANS:
1859 setManager(new CanvasUncontrollableTransitionDrawController());1863 setManager(new CanvasUncontrollableTransitionDrawController());
1860 break;1864 break;
@@ -2231,7 +2235,22 @@
2231 public void drawingSurfaceMousePressed(MouseEvent e) {2235 public void drawingSurfaceMousePressed(MouseEvent e) {
2232 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());2236 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
22332237
2234 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false);2238 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, false);
2239 }
2240
2241 @Override
2242 public void registerEvents() {
2243
2244 }
2245 }
2246
2247 class CanvasUrgentTransitionDrawController extends AbstractDrawingSurfaceManager {
2248
2249 @Override
2250 public void drawingSurfaceMousePressed(MouseEvent e) {
2251 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
2252
2253 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, true);
2235 }2254 }
22362255
2237 @Override2256 @Override
@@ -2246,7 +2265,7 @@
2246 public void drawingSurfaceMousePressed(MouseEvent e) {2265 public void drawingSurfaceMousePressed(MouseEvent e) {
2247 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());2266 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
22482267
2249 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true);2268 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, false);
2250 }2269 }
22512270
2252 @Override2271 @Override
@@ -2383,7 +2402,7 @@
2383 var r = guiModelManager.addNewTimedPlace(getModel(), p);2402 var r = guiModelManager.addNewTimedPlace(getModel(), p);
2384 placeClicked(r.result, e);2403 placeClicked(r.result, e);
2385 } else { //Transition2404 } else { //Transition
2386 var r = guiModelManager.addNewTimedTransitions(getModel(), p, false);2405 var r = guiModelManager.addNewTimedTransitions(getModel(), p, false, false);
2387 transitionClicked(r.result, e);2406 transitionClicked(r.result, e);
2388 }2407 }
2389 }2408 }
@@ -2827,11 +2846,11 @@
2827 }2846 }
2828 }2847 }
2829 public List<GuiAction> getAvailableDrawActions(){2848 public List<GuiAction> getAvailableDrawActions(){
2830 if (lens.isTimed() && !lens.isGame()) {2849 if (lens.isTimed() && lens.isGame()) {
2831 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));2850 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, uncontrollableTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));
2832 } else if (lens.isTimed()) {2851 } else if (lens.isTimed() && !lens.isGame()) {
2833 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));2852 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));
2834 } else if (lens.isGame()){2853 } else if (!lens.isTimed() && lens.isGame()){
2835 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUncontrollableAction));2854 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUncontrollableAction));
2836 } else {2855 } else {
2837 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction));2856 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction));
@@ -2868,6 +2887,11 @@
2868 setMode(Pipe.ElementType.TAPNTRANS);2887 setMode(Pipe.ElementType.TAPNTRANS);
2869 }2888 }
2870 };2889 };
2890 private final GuiAction urgentTransAction = new GuiAction("Urgent transition", "Add an urgent transition (Y)", "Y", true) {
2891 public void actionPerformed(ActionEvent e) {
2892 setMode(Pipe.ElementType.TAPNURGENTTRANS);
2893 }
2894 };
2871 private final GuiAction uncontrollableTransAction = new GuiAction("Uncontrollable transition", "Add an uncontrollable transition (L)", "L", true) {2895 private final GuiAction uncontrollableTransAction = new GuiAction("Uncontrollable transition", "Add an uncontrollable transition (L)", "L", true) {
2872 public void actionPerformed(ActionEvent e) {2896 public void actionPerformed(ActionEvent e) {
2873 setMode(Pipe.ElementType.UNCONTROLLABLETRANS);2897 setMode(Pipe.ElementType.UNCONTROLLABLETRANS);
@@ -2925,6 +2949,7 @@
2925 // deselect other actions2949 // deselect other actions
2926 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);2950 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);
2927 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);2951 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);
2952 urgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTTRANS);
2928 uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS);2953 uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS);
2929 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);2954 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);
2930 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);2955 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);
@@ -2940,6 +2965,7 @@
2940 case draw:2965 case draw:
2941 selectAction.setEnabled(true);2966 selectAction.setEnabled(true);
2942 transAction.setEnabled(true);2967 transAction.setEnabled(true);
2968 urgentTransAction.setEnabled(true);
2943 uncontrollableTransAction.setEnabled(true);2969 uncontrollableTransAction.setEnabled(true);
2944 timedPlaceAction.setEnabled(true);2970 timedPlaceAction.setEnabled(true);
2945 timedArcAction.setEnabled(true);2971 timedArcAction.setEnabled(true);
@@ -2954,6 +2980,7 @@
2954 case noNet:2980 case noNet:
2955 selectAction.setEnabled(false);2981 selectAction.setEnabled(false);
2956 transAction.setEnabled(false);2982 transAction.setEnabled(false);
2983 urgentTransAction.setEnabled(false);
2957 uncontrollableTransAction.setEnabled(false);2984 uncontrollableTransAction.setEnabled(false);
2958 timedPlaceAction.setEnabled(false);2985 timedPlaceAction.setEnabled(false);
2959 timedArcAction.setEnabled(false);2986 timedArcAction.setEnabled(false);
@@ -2967,6 +2994,7 @@
2967 case animation:2994 case animation:
2968 selectAction.setEnabled(false);2995 selectAction.setEnabled(false);
2969 transAction.setEnabled(false);2996 transAction.setEnabled(false);
2997 urgentTransAction.setEnabled(false);
2970 uncontrollableTransAction.setEnabled(false);2998 uncontrollableTransAction.setEnabled(false);
2971 timedPlaceAction.setEnabled(false);2999 timedPlaceAction.setEnabled(false);
2972 timedArcAction.setEnabled(false);3000 timedArcAction.setEnabled(false);
29733001
=== modified file 'src/pipe/gui/Pipe.java'
--- src/pipe/gui/Pipe.java 2021-04-04 09:31:58 +0000
+++ src/pipe/gui/Pipe.java 2021-11-16 20:18:23 +0000
@@ -8,7 +8,7 @@
8 public enum ElementType {8 public enum ElementType {
9 PLACE, IMMTRANS, TIMEDTRANS, ANNOTATION, ARC, INHIBARC, 9 PLACE, IMMTRANS, TIMEDTRANS, ANNOTATION, ARC, INHIBARC,
10 //TAPN Elements10 //TAPN Elements
11 TAPNPLACE, TAPNTRANS, UNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC,11 TAPNPLACE, TAPNTRANS, TAPNURGENTTRANS, UNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC,
12 //Others (might refactore)12 //Others (might refactore)
13 ADDTOKEN, DELTOKEN, SELECT, DRAW, DRAG,13 ADDTOKEN, DELTOKEN, SELECT, DRAW, DRAG,
14 }14 }
1515
=== added file 'src/resources/Images/Urgent transition.png'
16Binary 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 differ16Binary 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