Merge lp:~tapaal-contributor/tapaal/draw-urgent-transition-timed-net-icon-1951026 into lp:tapaal
- draw-urgent-transition-timed-net-icon-1951026
- Merge into trunk
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 | ||||
Related bugs: |
|
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 | # |
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
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-20 20:35:25 +0000 | |||
3 | +++ src/dk/aau/cs/gui/TabContent.java 2021-11-20 21:04:35 +0000 | |||
4 | @@ -171,10 +171,11 @@ | |||
5 | 171 | return new Result<>(pnObject); | 171 | return new Result<>(pnObject); |
6 | 172 | } | 172 | } |
7 | 173 | 173 | ||
9 | 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) { |
10 | 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))); |
11 | 176 | 176 | ||
12 | 177 | transition.setUncontrollable(isUncontrollable); | 177 | transition.setUncontrollable(isUncontrollable); |
13 | 178 | transition.setUrgent(isUrgent); | ||
14 | 178 | TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens); | 179 | TimedTransitionComponent pnObject = new TimedTransitionComponent(p.x, p.y, transition, lens); |
15 | 179 | 180 | ||
16 | 180 | guiModelToModel.get(c).add(transition); | 181 | guiModelToModel.get(c).add(transition); |
17 | @@ -1859,9 +1860,15 @@ | |||
18 | 1859 | case TAPNTRANS: | 1860 | case TAPNTRANS: |
19 | 1860 | setManager(new CanvasTransitionDrawController()); | 1861 | setManager(new CanvasTransitionDrawController()); |
20 | 1861 | break; | 1862 | break; |
21 | 1863 | case TAPNURGENTTRANS: | ||
22 | 1864 | setManager(new CanvasUrgentTransitionDrawController()); | ||
23 | 1865 | break; | ||
24 | 1862 | case UNCONTROLLABLETRANS: | 1866 | case UNCONTROLLABLETRANS: |
25 | 1863 | setManager(new CanvasUncontrollableTransitionDrawController()); | 1867 | setManager(new CanvasUncontrollableTransitionDrawController()); |
26 | 1864 | break; | 1868 | break; |
27 | 1869 | case TAPNURGENTUNCONTROLLABLETRANS: | ||
28 | 1870 | setManager(new CanvasUncontrollableUrgentTransitionDrawController()); | ||
29 | 1871 | break; | ||
30 | 1865 | case ANNOTATION: | 1872 | case ANNOTATION: |
31 | 1866 | setManager(new CanvasAnnotationNoteDrawController()); | 1873 | setManager(new CanvasAnnotationNoteDrawController()); |
32 | 1867 | break; | 1874 | break; |
33 | @@ -2235,7 +2242,22 @@ | |||
34 | 2235 | public void drawingSurfaceMousePressed(MouseEvent e) { | 2242 | public void drawingSurfaceMousePressed(MouseEvent e) { |
35 | 2236 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); | 2243 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); |
36 | 2237 | 2244 | ||
38 | 2238 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false); | 2245 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, false); |
39 | 2246 | } | ||
40 | 2247 | |||
41 | 2248 | @Override | ||
42 | 2249 | public void registerEvents() { | ||
43 | 2250 | |||
44 | 2251 | } | ||
45 | 2252 | } | ||
46 | 2253 | |||
47 | 2254 | class CanvasUrgentTransitionDrawController extends AbstractDrawingSurfaceManager { | ||
48 | 2255 | |||
49 | 2256 | @Override | ||
50 | 2257 | public void drawingSurfaceMousePressed(MouseEvent e) { | ||
51 | 2258 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); | ||
52 | 2259 | |||
53 | 2260 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, false, true); | ||
54 | 2239 | } | 2261 | } |
55 | 2240 | 2262 | ||
56 | 2241 | @Override | 2263 | @Override |
57 | @@ -2250,7 +2272,22 @@ | |||
58 | 2250 | public void drawingSurfaceMousePressed(MouseEvent e) { | 2272 | public void drawingSurfaceMousePressed(MouseEvent e) { |
59 | 2251 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); | 2273 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); |
60 | 2252 | 2274 | ||
62 | 2253 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true); | 2275 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, false); |
63 | 2276 | } | ||
64 | 2277 | |||
65 | 2278 | @Override | ||
66 | 2279 | public void registerEvents() { | ||
67 | 2280 | |||
68 | 2281 | } | ||
69 | 2282 | } | ||
70 | 2283 | |||
71 | 2284 | class CanvasUncontrollableUrgentTransitionDrawController extends AbstractDrawingSurfaceManager { | ||
72 | 2285 | |||
73 | 2286 | @Override | ||
74 | 2287 | public void drawingSurfaceMousePressed(MouseEvent e) { | ||
75 | 2288 | Point p = canvas.adjustPointToGridAndZoom(e.getPoint(), canvas.getZoom()); | ||
76 | 2289 | |||
77 | 2290 | guiModelManager.addNewTimedTransitions(drawingSurface.getGuiModel(), p, true, true); | ||
78 | 2254 | } | 2291 | } |
79 | 2255 | 2292 | ||
80 | 2256 | @Override | 2293 | @Override |
81 | @@ -2387,7 +2424,7 @@ | |||
82 | 2387 | var r = guiModelManager.addNewTimedPlace(getModel(), p); | 2424 | var r = guiModelManager.addNewTimedPlace(getModel(), p); |
83 | 2388 | placeClicked(r.result, e); | 2425 | placeClicked(r.result, e); |
84 | 2389 | } else { //Transition | 2426 | } else { //Transition |
86 | 2390 | var r = guiModelManager.addNewTimedTransitions(getModel(), p, false); | 2427 | var r = guiModelManager.addNewTimedTransitions(getModel(), p, false, false); |
87 | 2391 | transitionClicked(r.result, e); | 2428 | transitionClicked(r.result, e); |
88 | 2392 | } | 2429 | } |
89 | 2393 | } | 2430 | } |
90 | @@ -2831,11 +2868,11 @@ | |||
91 | 2831 | } | 2868 | } |
92 | 2832 | } | 2869 | } |
93 | 2833 | public List<GuiAction> getAvailableDrawActions(){ | 2870 | public List<GuiAction> getAvailableDrawActions(){ |
99 | 2834 | if (lens.isTimed() && !lens.isGame()) { | 2871 | if (lens.isTimed() && lens.isGame()) { |
100 | 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)); |
101 | 2836 | } else if (lens.isTimed()) { | 2873 | } else if (lens.isTimed() && !lens.isGame()) { |
102 | 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)); |
103 | 2838 | } else if (lens.isGame()){ | 2875 | } else if (!lens.isTimed() && lens.isGame()){ |
104 | 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)); |
105 | 2840 | } else { | 2877 | } else { |
106 | 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)); |
107 | @@ -2872,11 +2909,21 @@ | |||
108 | 2872 | setMode(Pipe.ElementType.TAPNTRANS); | 2909 | setMode(Pipe.ElementType.TAPNTRANS); |
109 | 2873 | } | 2910 | } |
110 | 2874 | }; | 2911 | }; |
111 | 2912 | private final GuiAction urgentTransAction = new GuiAction("Urgent transition", "Add an urgent transition (Y)", "Y", true) { | ||
112 | 2913 | public void actionPerformed(ActionEvent e) { | ||
113 | 2914 | setMode(Pipe.ElementType.TAPNURGENTTRANS); | ||
114 | 2915 | } | ||
115 | 2916 | }; | ||
116 | 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) { |
117 | 2876 | public void actionPerformed(ActionEvent e) { | 2918 | public void actionPerformed(ActionEvent e) { |
118 | 2877 | setMode(Pipe.ElementType.UNCONTROLLABLETRANS); | 2919 | setMode(Pipe.ElementType.UNCONTROLLABLETRANS); |
119 | 2878 | } | 2920 | } |
120 | 2879 | }; | 2921 | }; |
121 | 2922 | private final GuiAction uncontrollableUrgentTransAction = new GuiAction("Uncontrollable urgent transition", "Add an uncontrollable urgent transition (O)", "O", true) { | ||
122 | 2923 | public void actionPerformed(ActionEvent e) { | ||
123 | 2924 | setMode(Pipe.ElementType.TAPNURGENTUNCONTROLLABLETRANS); | ||
124 | 2925 | } | ||
125 | 2926 | }; | ||
126 | 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) { |
127 | 2881 | public void actionPerformed(ActionEvent e) { | 2928 | public void actionPerformed(ActionEvent e) { |
128 | 2882 | setMode(Pipe.ElementType.ADDTOKEN); | 2929 | setMode(Pipe.ElementType.ADDTOKEN); |
129 | @@ -2929,7 +2976,9 @@ | |||
130 | 2929 | // deselect other actions | 2976 | // deselect other actions |
131 | 2930 | selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT); | 2977 | selectAction.setSelected(CreateGui.guiMode == Pipe.ElementType.SELECT); |
132 | 2931 | transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS); | 2978 | transAction.setSelected(editorMode == Pipe.ElementType.TAPNTRANS); |
133 | 2979 | urgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTTRANS); | ||
134 | 2932 | uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS); | 2980 | uncontrollableTransAction.setSelected(editorMode == Pipe.ElementType.UNCONTROLLABLETRANS); |
135 | 2981 | uncontrollableUrgentTransAction.setSelected(editorMode == Pipe.ElementType.TAPNURGENTUNCONTROLLABLETRANS); | ||
136 | 2933 | timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE); | 2982 | timedPlaceAction.setSelected(editorMode == Pipe.ElementType.TAPNPLACE); |
137 | 2934 | timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC); | 2983 | timedArcAction.setSelected(editorMode == Pipe.ElementType.TAPNARC); |
138 | 2935 | transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC); | 2984 | transportArcAction.setSelected(editorMode == Pipe.ElementType.TRANSPORTARC); |
139 | @@ -2944,7 +2993,9 @@ | |||
140 | 2944 | case draw: | 2993 | case draw: |
141 | 2945 | selectAction.setEnabled(true); | 2994 | selectAction.setEnabled(true); |
142 | 2946 | transAction.setEnabled(true); | 2995 | transAction.setEnabled(true); |
143 | 2996 | urgentTransAction.setEnabled(true); | ||
144 | 2947 | uncontrollableTransAction.setEnabled(true); | 2997 | uncontrollableTransAction.setEnabled(true); |
145 | 2998 | uncontrollableUrgentTransAction.setEnabled(true); | ||
146 | 2948 | toggleUrgentAction.setEnabled(true); | 2999 | toggleUrgentAction.setEnabled(true); |
147 | 2949 | timedPlaceAction.setEnabled(true); | 3000 | timedPlaceAction.setEnabled(true); |
148 | 2950 | timedArcAction.setEnabled(true); | 3001 | timedArcAction.setEnabled(true); |
149 | @@ -2959,7 +3010,9 @@ | |||
150 | 2959 | case noNet: | 3010 | case noNet: |
151 | 2960 | selectAction.setEnabled(false); | 3011 | selectAction.setEnabled(false); |
152 | 2961 | transAction.setEnabled(false); | 3012 | transAction.setEnabled(false); |
153 | 3013 | urgentTransAction.setEnabled(false); | ||
154 | 2962 | uncontrollableTransAction.setEnabled(false); | 3014 | uncontrollableTransAction.setEnabled(false); |
155 | 3015 | uncontrollableUrgentTransAction.setEnabled(false); | ||
156 | 2963 | toggleUrgentAction.setEnabled(false); | 3016 | toggleUrgentAction.setEnabled(false); |
157 | 2964 | timedPlaceAction.setEnabled(false); | 3017 | timedPlaceAction.setEnabled(false); |
158 | 2965 | timedArcAction.setEnabled(false); | 3018 | timedArcAction.setEnabled(false); |
159 | @@ -2973,7 +3026,9 @@ | |||
160 | 2973 | case animation: | 3026 | case animation: |
161 | 2974 | selectAction.setEnabled(false); | 3027 | selectAction.setEnabled(false); |
162 | 2975 | transAction.setEnabled(false); | 3028 | transAction.setEnabled(false); |
163 | 3029 | urgentTransAction.setEnabled(false); | ||
164 | 2976 | uncontrollableTransAction.setEnabled(false); | 3030 | uncontrollableTransAction.setEnabled(false); |
165 | 3031 | uncontrollableUrgentTransAction.setEnabled(false); | ||
166 | 2977 | toggleUrgentAction.setEnabled(false); | 3032 | toggleUrgentAction.setEnabled(false); |
167 | 2978 | timedPlaceAction.setEnabled(false); | 3033 | timedPlaceAction.setEnabled(false); |
168 | 2979 | timedArcAction.setEnabled(false); | 3034 | timedArcAction.setEnabled(false); |
169 | 2980 | 3035 | ||
170 | === modified file 'src/pipe/gui/Pipe.java' | |||
171 | --- src/pipe/gui/Pipe.java 2021-04-04 09:31:58 +0000 | |||
172 | +++ src/pipe/gui/Pipe.java 2021-11-20 21:04:35 +0000 | |||
173 | @@ -8,7 +8,7 @@ | |||
174 | 8 | public enum ElementType { | 8 | public enum ElementType { |
175 | 9 | PLACE, IMMTRANS, TIMEDTRANS, ANNOTATION, ARC, INHIBARC, | 9 | PLACE, IMMTRANS, TIMEDTRANS, ANNOTATION, ARC, INHIBARC, |
176 | 10 | //TAPN Elements | 10 | //TAPN Elements |
178 | 11 | TAPNPLACE, TAPNTRANS, UNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC, | 11 | TAPNPLACE, TAPNTRANS, TAPNURGENTTRANS, UNCONTROLLABLETRANS, TAPNURGENTUNCONTROLLABLETRANS, TAPNARC, TRANSPORTARC, TAPNINHIBITOR_ARC, |
179 | 12 | //Others (might refactore) | 12 | //Others (might refactore) |
180 | 13 | ADDTOKEN, DELTOKEN, SELECT, DRAW, DRAG, | 13 | ADDTOKEN, DELTOKEN, SELECT, DRAW, DRAG, |
181 | 14 | } | 14 | } |
182 | 15 | 15 | ||
183 | === added file 'src/resources/Images/Uncontrollable urgent transition.png' | |||
184 | 16 | Binary 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 | 16 | Binary 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 |
185 | === added file 'src/resources/Images/Urgent transition.png' | |||
186 | 17 | Binary 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 | 17 | Binary 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 |
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.