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: 186 lines (+65/-10)
2 files modified
src/dk/aau/cs/gui/TabContent.java (+64/-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 Needs Fixing
Review via email: mp+412175@code.launchpad.net

This proposal supersedes a proposal from 2021-11-16.

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

Commit message

Added support, and icon, for drawing urgent transitions and uncontrollable 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.
Revision history for this message
Jiri Srba (srba) wrote : Posted in a previous version of this proposal

Looks good but for timed and game, there has to be also added uncontrollable urgent transition icon (empty rectangle with black dot) and option in the draw menu.

review: Needs Fixing
Revision history for this message
Jiri Srba (srba) :
review: Approve
Revision history for this message
Jiri Srba (srba) wrote :

Has a merge conflict with trunk

review: Needs Fixing
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-20 20:35:25 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2021-11-20 21:04:35 +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);
@@ -1859,9 +1860,15 @@
1859 case TAPNTRANS:1860 case TAPNTRANS:
1860 setManager(new CanvasTransitionDrawController());1861 setManager(new CanvasTransitionDrawController());
1861 break;1862 break;
1863 case TAPNURGENTTRANS:
1864 setManager(new CanvasUrgentTransitionDrawController());
1865 break;
1862 case UNCONTROLLABLETRANS:1866 case UNCONTROLLABLETRANS:
1863 setManager(new CanvasUncontrollableTransitionDrawController());1867 setManager(new CanvasUncontrollableTransitionDrawController());
1864 break;1868 break;
1869 case TAPNURGENTUNCONTROLLABLETRANS:
1870 setManager(new CanvasUncontrollableUrgentTransitionDrawController());
1871 break;
1865 case ANNOTATION:1872 case ANNOTATION:
1866 setManager(new CanvasAnnotationNoteDrawController());1873 setManager(new CanvasAnnotationNoteDrawController());
1867 break;1874 break;
@@ -2235,7 +2242,22 @@
2235 public void drawingSurfaceMousePressed(MouseEvent e) {2242 public void drawingSurfaceMousePressed(MouseEvent e) {
2236 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());2243 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
22372244
2238 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false);2245 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, false);
2246 }
2247
2248 @Override
2249 public void registerEvents() {
2250
2251 }
2252 }
2253
2254 class CanvasUrgentTransitionDrawController extends AbstractDrawingSurfaceManager {
2255
2256 @Override
2257 public void drawingSurfaceMousePressed(MouseEvent e) {
2258 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
2259
2260 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, true);
2239 }2261 }
22402262
2241 @Override2263 @Override
@@ -2250,7 +2272,22 @@
2250 public void drawingSurfaceMousePressed(MouseEvent e) {2272 public void drawingSurfaceMousePressed(MouseEvent e) {
2251 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());2273 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
22522274
2253 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true);2275 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, false);
2276 }
2277
2278 @Override
2279 public void registerEvents() {
2280
2281 }
2282 }
2283
2284 class CanvasUncontrollableUrgentTransitionDrawController extends AbstractDrawingSurfaceManager {
2285
2286 @Override
2287 public void drawingSurfaceMousePressed(MouseEvent e) {
2288 Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom());
2289
2290 guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, true);
2254 }2291 }
22552292
2256 @Override2293 @Override
@@ -2387,7 +2424,7 @@
2387 var r = guiModelManager.addNewTimedPlace(getModel(), p);2424 var r = guiModelManager.addNewTimedPlace(getModel(), p);
2388 placeClicked(r.result, e);2425 placeClicked(r.result, e);
2389 } else { //Transition2426 } else { //Transition
2390 var r = guiModelManager.addNewTimedTransitions(getModel(), p, false);2427 var r = guiModelManager.addNewTimedTransitions(getModel(), p, false, false);
2391 transitionClicked(r.result, e);2428 transitionClicked(r.result, e);
2392 }2429 }
2393 }2430 }
@@ -2831,11 +2868,11 @@
2831 }2868 }
2832 }2869 }
2833 public List<GuiAction> getAvailableDrawActions(){2870 public List<GuiAction> getAvailableDrawActions(){
2834 if (lens.isTimed() && !lens.isGame()) {2871 if (lens.isTimed() && lens.isGame()) {
2835 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));2872 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, uncontrollableTransAction, uncontrollableUrgentTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));
2836 } else if (lens.isTimed()) {2873 } else if (lens.isTimed() && !lens.isGame()) {
2837 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction, toggleUncontrollableAction));2874 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, urgentTransAction, timedArcAction, transportArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUrgentAction));
2838 } else if (lens.isGame()){2875 } else if (!lens.isTimed() && lens.isGame()){
2839 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUncontrollableAction));2876 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, uncontrollableTransAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction, toggleUncontrollableAction));
2840 } else {2877 } else {
2841 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction));2878 return new ArrayList<>(Arrays.asList(selectAction, timedPlaceAction, transAction, timedArcAction, inhibarcAction, tokenAction, deleteTokenAction, annotationAction));
@@ -2872,11 +2909,21 @@
2872 setMode(Pipe.ElementType.TAPNTRANS);2909 setMode(Pipe.ElementType.TAPNTRANS);
2873 }2910 }
2874 };2911 };
2912 private final GuiAction urgentTransAction = new GuiAction("Urgent transition", "Add an urgent transition (Y)", "Y", true) {
2913 public void actionPerformed(ActionEvent e) {
2914 setMode(Pipe.ElementType.TAPNURGENTTRANS);
2915 }
2916 };
2875 private final GuiAction uncontrollableTransAction = new GuiAction("Uncontrollable transition", "Add an uncontrollable transition (L)", "L", true) {2917 private final GuiAction uncontrollableTransAction = new GuiAction("Uncontrollable transition", "Add an uncontrollable transition (L)", "L", true) {
2876 public void actionPerformed(ActionEvent e) {2918 public void actionPerformed(ActionEvent e) {
2877 setMode(Pipe.ElementType.UNCONTROLLABLETRANS);2919 setMode(Pipe.ElementType.UNCONTROLLABLETRANS);
2878 }2920 }
2879 };2921 };
2922 private final GuiAction uncontrollableUrgentTransAction = new GuiAction("Uncontrollable urgent transition", "Add an uncontrollable urgent transition (O)", "O", true) {
2923 public void actionPerformed(ActionEvent e) {
2924 setMode(Pipe.ElementType.TAPNURGENTUNCONTROLLABLETRANS);
2925 }
2926 };
2880 private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) {2927 private final GuiAction tokenAction = new GuiAction("Add token", "Add a token (+)", "typed +", true) {
2881 public void actionPerformed(ActionEvent e) {2928 public void actionPerformed(ActionEvent e) {
2882 setMode(Pipe.ElementType.ADDTOKEN);2929 setMode(Pipe.ElementType.ADDTOKEN);
@@ -2929,7 +2976,9 @@
2929 // deselect other actions2976 // deselect other actions
2930 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);2977 selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT);
2931 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);2978 transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS);
2979 urgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTTRANS);
2932 uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS);2980 uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS);
2981 uncontrollableUrgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTUNCONTROLLABLETRANS);
2933 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);2982 timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE);
2934 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);2983 timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC);
2935 transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC);2984 transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC);
@@ -2944,7 +2993,9 @@
2944 case draw:2993 case draw:
2945 selectAction.setEnabled(true);2994 selectAction.setEnabled(true);
2946 transAction.setEnabled(true);2995 transAction.setEnabled(true);
2996 urgentTransAction.setEnabled(true);
2947 uncontrollableTransAction.setEnabled(true);2997 uncontrollableTransAction.setEnabled(true);
2998 uncontrollableUrgentTransAction.setEnabled(true);
2948 toggleUrgentAction.setEnabled(true);2999 toggleUrgentAction.setEnabled(true);
2949 timedPlaceAction.setEnabled(true);3000 timedPlaceAction.setEnabled(true);
2950 timedArcAction.setEnabled(true);3001 timedArcAction.setEnabled(true);
@@ -2959,7 +3010,9 @@
2959 case noNet:3010 case noNet:
2960 selectAction.setEnabled(false);3011 selectAction.setEnabled(false);
2961 transAction.setEnabled(false);3012 transAction.setEnabled(false);
3013 urgentTransAction.setEnabled(false);
2962 uncontrollableTransAction.setEnabled(false);3014 uncontrollableTransAction.setEnabled(false);
3015 uncontrollableUrgentTransAction.setEnabled(false);
2963 toggleUrgentAction.setEnabled(false);3016 toggleUrgentAction.setEnabled(false);
2964 timedPlaceAction.setEnabled(false);3017 timedPlaceAction.setEnabled(false);
2965 timedArcAction.setEnabled(false);3018 timedArcAction.setEnabled(false);
@@ -2973,7 +3026,9 @@
2973 case animation:3026 case animation:
2974 selectAction.setEnabled(false);3027 selectAction.setEnabled(false);
2975 transAction.setEnabled(false);3028 transAction.setEnabled(false);
3029 urgentTransAction.setEnabled(false);
2976 uncontrollableTransAction.setEnabled(false);3030 uncontrollableTransAction.setEnabled(false);
3031 uncontrollableUrgentTransAction.setEnabled(false);
2977 toggleUrgentAction.setEnabled(false);3032 toggleUrgentAction.setEnabled(false);
2978 timedPlaceAction.setEnabled(false);3033 timedPlaceAction.setEnabled(false);
2979 timedArcAction.setEnabled(false);3034 timedArcAction.setEnabled(false);
29803035
=== 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-20 21:04:35 +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, TAPNURGENTUNCONTROLLABLETRANS, 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/Uncontrollable urgent transition.png'
16Binary files src/resources/Images/Uncontrollable urgent transition.png 1970-01-01 00:00:00 +0000 and src/resources/Images/Uncontrollable urgent transition.png 2021-11-20 21:04:35 +0000 differ16Binary files src/resources/Images/Uncontrollable urgent transition.png 1970-01-01 00:00:00 +0000 and src/resources/Images/Uncontrollable urgent transition.png 2021-11-20 21:04:35 +0000 differ
=== added file 'src/resources/Images/Urgent transition.png'
17Binary files src/resources/Images/Urgent transition.png 1970-01-01 00:00:00 +0000 and src/resources/Images/Urgent transition.png 2021-11-20 21:04:35 +0000 differ17Binary files src/resources/Images/Urgent transition.png 1970-01-01 00:00:00 +0000 and src/resources/Images/Urgent transition.png 2021-11-20 21:04:35 +0000 differ

Subscribers

People subscribed via source and target branches