Merge lp:~yrke/tapaal/remove-staticIgnoreSelect into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 979
Merged at revision: 990
Proposed branch: lp:~yrke/tapaal/remove-staticIgnoreSelect
Merge into: lp:tapaal
Diff against target: 240 lines (+35/-48)
10 files modified
src/pipe/gui/Export.java (+0/-2)
src/pipe/gui/GuiFrame.java (+0/-2)
src/pipe/gui/graphicElements/AnnotationNote.java (+2/-2)
src/pipe/gui/graphicElements/Arc.java (+2/-2)
src/pipe/gui/graphicElements/ArcPathPoint.java (+26/-26)
src/pipe/gui/graphicElements/PetriNetObject.java (+1/-5)
src/pipe/gui/graphicElements/Place.java (+2/-2)
src/pipe/gui/graphicElements/Transition.java (+2/-2)
src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java (+0/-3)
src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java (+0/-2)
To merge this branch: bzr merge lp:~yrke/tapaal/remove-staticIgnoreSelect
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Kenneth Yrke Jørgensen Needs Resubmitting
Review via email: mp+361277@code.launchpad.net

Commit message

Merged branch ~yrke/tapaal/remove-staticIgnoreSelect

Removed unneeded static ignoreSelection from PetriNetObjec, changed behaviour in png/ps export to now show selection. But can be refactored to get original behaviour

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Tested and the behaviour is actually nicer.

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

Needs to resovle conflicts with the trunk before it can be merged.

review: Needs Fixing
979. By Kenneth Yrke Jørgensen

Merged trunk

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

Conflict resolved,

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/Export.java'
2--- src/pipe/gui/Export.java 2018-07-13 18:08:43 +0000
3+++ src/pipe/gui/Export.java 2019-03-13 07:27:44 +0000
4@@ -286,14 +286,12 @@
5 if (gridEnabled) {
6 Grid.enableGrid();
7 }
8- PetriNetObject.ignoreSelection(false);
9 g.repaint();
10 }
11
12 private static void setupViewForExport(DrawingSurfaceImpl g, boolean gridEnabled) {
13 // Stuff to make it export properly
14 g.updatePreferredSize();
15- PetriNetObject.ignoreSelection(true);
16 if (gridEnabled) {
17 Grid.disableGrid();
18 }
19
20=== modified file 'src/pipe/gui/GuiFrame.java'
21--- src/pipe/gui/GuiFrame.java 2019-03-10 20:07:06 +0000
22+++ src/pipe/gui/GuiFrame.java 2019-03-13 07:27:44 +0000
23@@ -2192,7 +2192,6 @@
24 CreateGui.getCurrentTab().setSelectedTemplateWasActive();
25 }
26 restoreMode();
27- PetriNetObject.ignoreSelection(true);
28 setAnimationMode(!appView.isInAnimationMode());
29 if (CreateGui.getCurrentTab().templateWasActiveBeforeSimulationMode()) {
30 CreateGui.getCurrentTab().restoreSelectedTemplate();
31@@ -2213,7 +2212,6 @@
32 stepbackwardAction.setEnabled(false);
33 } else {
34 //setMode(ElementType.START);
35- PetriNetObject.ignoreSelection(false);
36 appView.getSelectionObject().clearSelection();
37 setAnimationMode(!appView.isInAnimationMode());
38 CreateGui.getCurrentTab().restoreSelectedTemplate();
39
40=== modified file 'src/pipe/gui/graphicElements/AnnotationNote.java'
41--- src/pipe/gui/graphicElements/AnnotationNote.java 2018-09-06 13:03:37 +0000
42+++ src/pipe/gui/graphicElements/AnnotationNote.java 2019-03-13 07:27:44 +0000
43@@ -187,7 +187,7 @@
44 RenderingHints.VALUE_STROKE_NORMALIZE);
45
46 g2.transform(Zoomer.getTransform(zoom));
47- if (selected && !ignoreSelection) {
48+ if (selected) {
49 g2.setPaint(Pipe.SELECTION_FILL_COLOUR);
50 g2.fill(noteRect);
51 if (drawBorder) {
52@@ -312,7 +312,7 @@
53 public void myPaintComponent(Graphics g) {
54 Graphics2D g2 = (Graphics2D) g;
55 g2.setTransform(prova);
56- if (myNote.selected && !PetriNetObject.ignoreSelection) {
57+ if (myNote.selected) {
58 g2.translate(this.getLocation().x, this.getLocation().y);
59 shape = new Rectangle(0, 0, 2 * SIZE, 2 * SIZE);
60 g2.fill(shape);
61
62=== modified file 'src/pipe/gui/graphicElements/Arc.java'
63--- src/pipe/gui/graphicElements/Arc.java 2019-03-10 20:02:56 +0000
64+++ src/pipe/gui/graphicElements/Arc.java 2019-03-13 07:27:44 +0000
65@@ -277,7 +277,7 @@
66 AffineTransform reset = g2.getTransform();
67
68 //Draw Path
69- if (selected && !ignoreSelection) {
70+ if (selected) {
71 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
72 this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
73 } else {
74@@ -300,7 +300,7 @@
75 g2.transform(Zoomer.getTransform(zoom));
76 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
77
78- if (selected && !ignoreSelection) {
79+ if (selected) {
80 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
81 this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
82 } else {
83
84=== modified file 'src/pipe/gui/graphicElements/ArcPathPoint.java'
85--- src/pipe/gui/graphicElements/ArcPathPoint.java 2019-01-03 19:24:03 +0000
86+++ src/pipe/gui/graphicElements/ArcPathPoint.java 2019-03-13 07:27:44 +0000
87@@ -150,32 +150,32 @@
88 @Override
89 public void paintComponent(Graphics g) {
90 super.paintComponent(g);
91- if (!ignoreSelection) {
92- Graphics2D g2 = (Graphics2D) g;
93-
94- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
95- RenderingHints.VALUE_ANTIALIAS_ON);
96- g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
97- RenderingHints.VALUE_STROKE_NORMALIZE);
98-
99- if (pointType == CURVED) {
100- shape = new Ellipse2D.Double(0, 0, 2 * SIZE, 2 * SIZE);
101- } else {
102- shape = new Rectangle2D.Double(0, 0, 2 * SIZE, 2 * SIZE);
103- }
104-
105- if (selected) {
106- g2.setPaint(Pipe.SELECTION_FILL_COLOUR);
107- g2.fill(shape);
108- g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
109- g2.draw(shape);
110- } else {
111- g2.setPaint(Pipe.ELEMENT_FILL_COLOUR);
112- g2.fill(shape);
113- g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
114- g2.draw(shape);
115- }
116- }
117+
118+ Graphics2D g2 = (Graphics2D) g;
119+
120+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
121+ RenderingHints.VALUE_ANTIALIAS_ON);
122+ g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
123+ RenderingHints.VALUE_STROKE_NORMALIZE);
124+
125+ if (pointType == CURVED) {
126+ shape = new Ellipse2D.Double(0, 0, 2 * SIZE, 2 * SIZE);
127+ } else {
128+ shape = new Rectangle2D.Double(0, 0, 2 * SIZE, 2 * SIZE);
129+ }
130+
131+ if (selected) {
132+ g2.setPaint(Pipe.SELECTION_FILL_COLOUR);
133+ g2.fill(shape);
134+ g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
135+ g2.draw(shape);
136+ } else {
137+ g2.setPaint(Pipe.ELEMENT_FILL_COLOUR);
138+ g2.fill(shape);
139+ g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
140+ g2.draw(shape);
141+ }
142+
143 }
144
145 public int getIndex() {
146
147=== modified file 'src/pipe/gui/graphicElements/PetriNetObject.java'
148--- src/pipe/gui/graphicElements/PetriNetObject.java 2018-10-18 17:48:59 +0000
149+++ src/pipe/gui/graphicElements/PetriNetObject.java 2019-03-13 07:27:44 +0000
150@@ -48,7 +48,7 @@
151 protected boolean selected = false; // True if part of the current selection.
152 protected boolean selectable = true; // True if object can be selected.
153 protected boolean draggable = true; // True if object can be dragged.
154- protected static boolean ignoreSelection = false;
155+
156 protected Rectangle bounds = new Rectangle();
157
158 protected boolean deleted = false;
159@@ -242,10 +242,6 @@
160 selectable = allow;
161 }
162
163- public static void ignoreSelection(boolean ignore) {
164- ignoreSelection = ignore;
165- }
166-
167 public boolean isDraggable() {
168 return draggable;
169 }
170
171=== modified file 'src/pipe/gui/graphicElements/Place.java'
172--- src/pipe/gui/graphicElements/Place.java 2018-10-21 18:14:13 +0000
173+++ src/pipe/gui/graphicElements/Place.java 2019-03-13 07:27:44 +0000
174@@ -72,7 +72,7 @@
175 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
176 RenderingHints.VALUE_ANTIALIAS_ON);
177
178- if (selected && !ignoreSelection) {
179+ if (selected) {
180 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
181 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
182 } else {
183@@ -81,7 +81,7 @@
184 }
185 g2.fill(placeEllipse);
186
187- if (selected && !ignoreSelection) {
188+ if (selected) {
189 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
190 } else {
191 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
192
193=== modified file 'src/pipe/gui/graphicElements/Transition.java'
194--- src/pipe/gui/graphicElements/Transition.java 2018-10-14 19:12:41 +0000
195+++ src/pipe/gui/graphicElements/Transition.java 2019-03-13 07:27:44 +0000
196@@ -95,7 +95,7 @@
197 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
198 RenderingHints.VALUE_ANTIALIAS_ON);
199
200- if (selected && !ignoreSelection) {
201+ if (selected) {
202 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
203 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
204 } else {
205@@ -107,7 +107,7 @@
206 g2.setPaint(Pipe.ENABLED_TRANSITION_COLOUR);
207 } else if (delayEnabled && CreateGui.getApp().isShowingDelayEnabledTransitions() && !Animator.isUrgentTransitionEnabled()) {
208 g2.setPaint(Pipe.YELLOW_TRANSITION_COLOR);
209- } else if (selected && !ignoreSelection) {
210+ } else if (selected) {
211 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
212 } else {
213 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
214
215=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java'
216--- src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-03-10 20:02:56 +0000
217+++ src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-03-13 07:27:44 +0000
218@@ -133,9 +133,6 @@
219 return inhibitorArc.interval();
220 }
221
222- @Override
223-
224-
225 public TimedInhibitorArcComponent copy(TimedArcPetriNet tapn, Hashtable<PlaceTransitionObject, PlaceTransitionObject> oldToNewMapping) {
226 TimedInhibitorArcComponent arc = new TimedInhibitorArcComponent(this);
227 arc.setSource(oldToNewMapping.get(this.getSource()));
228
229=== modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java'
230--- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-03-10 20:02:56 +0000
231+++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-03-13 07:27:44 +0000
232@@ -161,8 +161,6 @@
233
234 }
235
236-
237-
238 public dk.aau.cs.model.tapn.TimedOutputArc underlyingArc() {
239 return outputArc;
240 }

Subscribers

People subscribed via source and target branches