Merge lp:~yrke/tapaal/tapaal-fix1827039-constantHightlight into lp:tapaal/dev

Proposed by Kenneth Yrke Jørgensen on 2019-05-06
Status: Merged
Merge reported by: Kenneth Yrke Jørgensen
Merged at revision: not available
Proposed branch: lp:~yrke/tapaal/tapaal-fix1827039-constantHightlight
Merge into: lp:tapaal/dev
Diff against target: 373 lines (+78/-40) (has conflicts)
9 files modified
src/pipe/gui/graphicElements/Arc.java (+21/-15)
src/pipe/gui/graphicElements/PetriNetObject.java (+12/-1)
src/pipe/gui/graphicElements/Place.java (+2/-2)
src/pipe/gui/graphicElements/PlaceTransitionObject.java (+4/-0)
src/pipe/gui/graphicElements/Transition.java (+2/-2)
src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java (+4/-4)
src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java (+15/-8)
src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java (+2/-2)
src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java (+16/-6)
Text conflict in src/pipe/gui/graphicElements/Arc.java
Text conflict in src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java
Text conflict in src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java
To merge this branch: bzr merge lp:~yrke/tapaal/tapaal-fix1827039-constantHightlight
Reviewer Review Type Date Requested Status
TAPAAL Maintainers 2019-05-06 Pending
Review via email: mp+366983@code.launchpad.net

Commit message

Fixed bug 1827039, constant hightlight not working

Fixed bug where hightlight of constants was not working, after refactoring. The color hightlight was overwritten in drawComponent. Now select() and hightlight() sets the color of lable correctly

Also arcs now uses the pnName label over the lable.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/graphicElements/Arc.java'
2--- src/pipe/gui/graphicElements/Arc.java 2019-03-22 11:17:59 +0000
3+++ src/pipe/gui/graphicElements/Arc.java 2019-05-06 12:33:46 +0000
4@@ -28,7 +28,7 @@
5 0, -10, -7, -10 }, 4);
6 protected boolean fillHead = true; //If true, fill the shape when drawing, if false, fill with bg color.
7
8- protected NameLabel label;
9+ //protected NameLabel label;
10
11 private static Point2D.Double point;
12
13@@ -62,7 +62,7 @@
14 double endPositionXInput, double endPositionYInput,
15 PlaceTransitionObject sourceInput,
16 PlaceTransitionObject targetInput, int weightInput, String idInput) {
17- label = new NameLabel(zoom);
18+ pnName = new NameLabel(zoom);
19 myPath.addPoint((float) startPositionXInput,
20 (float) startPositionYInput, ArcPathPoint.STRAIGHT);
21 myPath.addPoint((float) endPositionXInput, (float) endPositionYInput,
22@@ -83,7 +83,7 @@
23 */
24 public Arc(PlaceTransitionObject newSource) {
25 isPrototype = true;
26- label = new NameLabel(zoom);
27+ pnName = new NameLabel(zoom);
28 source = newSource;
29 myPath.addPoint();
30 myPath.addPoint();
31@@ -96,7 +96,7 @@
32 public Arc() {
33 super();
34
35- label = new NameLabel(zoom);
36+ pnName = new NameLabel(zoom);
37 //XXX see comment in function
38 setLableHandler();
39 }
40@@ -138,8 +138,14 @@
41 }
42
43 public void setLabelPosition() {
44+<<<<<<< TREE
45 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
46 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
47+=======
48+
49+ pnName.setPosition(Grid.getModifiedX((double) (myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
50+ Grid.getModifiedY((double) (myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
51+>>>>>>> MERGE-SOURCE
52 }
53 @Override
54 public void updateLabelLocation() {
55@@ -170,7 +176,7 @@
56
57 @Override
58 public NameLabel getNameLabel() {
59- return label;
60+ return pnName;
61 }
62
63 /**
64@@ -279,10 +285,10 @@
65 //Draw Path
66 if (selected) {
67 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
68- this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
69+ //this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
70 } else {
71 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
72- this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
73+ //this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
74 }
75
76 g2.setStroke(new BasicStroke(0.01f * zoom));
77@@ -302,10 +308,10 @@
78
79 if (selected) {
80 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
81- this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
82+ //this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
83 } else {
84 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
85- this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
86+ //this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
87 }
88
89 g2.setStroke(new BasicStroke(0.8f));
90@@ -350,8 +356,8 @@
91 myPath.addPointsToGui(getParent());
92
93 updateArcPosition();
94- if (getParent() != null && label.getParent() == null) {
95- getParent().add(label);
96+ if (getParent() != null && pnName.getParent() == null) {
97+ getParent().add(pnName);
98 }
99 }
100
101@@ -359,7 +365,7 @@
102 public void delete() {
103 if (!deleted) {
104 if (getParent() != null) {
105- getParent().remove(label);
106+ getParent().remove(pnName);
107 }
108 if(source != null) source.removeFromArc(this);
109 if(target != null) target.removeToArc(this);
110@@ -388,7 +394,7 @@
111
112 public void removeFromView() {
113 if (getParent() != null) {
114- getParent().remove(label);
115+ getParent().remove(pnName);
116 }
117 myPath.forceHidePoints();
118 removeFromContainer();
119@@ -429,8 +435,8 @@
120 zoom = percent;
121 this.updateArcPosition();
122 this.updateOnMoveOrZoom();
123- label.zoomUpdate(percent);
124- label.updateSize();
125+ pnName.zoomUpdate(percent);
126+ pnName.updateSize();
127 }
128
129 public void setZoom(int percent) {
130
131=== modified file 'src/pipe/gui/graphicElements/PetriNetObject.java'
132--- src/pipe/gui/graphicElements/PetriNetObject.java 2019-03-22 10:13:18 +0000
133+++ src/pipe/gui/graphicElements/PetriNetObject.java 2019-05-06 12:33:46 +0000
134@@ -217,17 +217,28 @@
135 }
136
137 public void select(boolean shouldRepaint) {
138- if (selectable && !selected) {
139+ if (selectable && !selected) {
140 selected = true;
141+
142+ if (pnName != null) {
143+ pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
144+ }
145+
146 if (shouldRepaint) {
147 repaint();
148 }
149 }
150+
151 }
152
153 public void deselect() {
154 if (selected) {
155 selected = false;
156+
157+ if (pnName != null) {
158+ pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
159+ }
160+
161 repaint();
162 }
163 }
164
165=== modified file 'src/pipe/gui/graphicElements/Place.java'
166--- src/pipe/gui/graphicElements/Place.java 2019-03-22 10:13:18 +0000
167+++ src/pipe/gui/graphicElements/Place.java 2019-05-06 12:33:46 +0000
168@@ -67,10 +67,10 @@
169
170 if (selected) {
171 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
172- pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
173+ //pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
174 } else {
175 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);
176- pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
177+ //pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
178 }
179 g2.fill(placeEllipse);
180
181
182=== modified file 'src/pipe/gui/graphicElements/PlaceTransitionObject.java'
183--- src/pipe/gui/graphicElements/PlaceTransitionObject.java 2019-03-23 07:20:46 +0000
184+++ src/pipe/gui/graphicElements/PlaceTransitionObject.java 2019-05-06 12:33:46 +0000
185@@ -318,6 +318,10 @@
186 if (selectable && !selected) {
187 selected = true;
188
189+ if (pnName != null) {
190+ pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
191+ }
192+
193 // Select arcs that are connected from this object to another selected object.
194 for (Arc arc : getPostset()) {
195 if(arc.getTarget().isSelected()){
196
197=== modified file 'src/pipe/gui/graphicElements/Transition.java'
198--- src/pipe/gui/graphicElements/Transition.java 2019-03-23 07:14:56 +0000
199+++ src/pipe/gui/graphicElements/Transition.java 2019-05-06 12:33:46 +0000
200@@ -97,10 +97,10 @@
201
202 if (selected) {
203 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
204- pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
205+ //pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
206 } else {
207 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);
208- pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
209+ //pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
210 }
211
212 if (highlighted) {
213
214=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java'
215--- src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-03-22 10:13:18 +0000
216+++ src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-05-06 12:33:46 +0000
217@@ -71,9 +71,9 @@
218
219 @Override
220 public void updateLabel(boolean displayConstantNames) {
221- label.setText("");
222+ pnName.setText("");
223 if(getWeight().value() > 1 || displayConstantNames){
224- label.setText(getWeight().toString(displayConstantNames));
225+ pnName.setText(getWeight().toString(displayConstantNames));
226 }
227
228 boolean focusedConstant = false;
229@@ -83,9 +83,9 @@
230 }
231 }
232 if(focusedConstant){
233- label.setForeground(Pipe.SELECTION_TEXT_COLOUR);
234+ pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
235 }else{
236- label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
237+ pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
238 }
239
240 this.setLabelPosition();
241
242=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java'
243--- src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2019-03-22 11:17:59 +0000
244+++ src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2019-05-06 12:33:46 +0000
245@@ -113,21 +113,21 @@
246 }
247 if (!CreateGui.getModel().netType().equals(NetType.UNTIMED)) {
248 if (inputArc == null)
249- label.setText("");
250+ pnName.setText("");
251 else {
252 if (!CreateGui.getApp().showZeroToInfinityIntervals()) {
253 if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){
254- label.setText("");
255+ pnName.setText("");
256 }
257 else {
258- label.setText(inputArc.interval().toString(showConstantNames));
259+ pnName.setText(inputArc.interval().toString(showConstantNames));
260 }
261 }
262 else {
263- label.setText(inputArc.interval().toString(showConstantNames));
264+ pnName.setText(inputArc.interval().toString(showConstantNames));
265 }
266-
267- label.setText(getWeight().toString(showConstantNames)+" "+label.getText());
268+
269+ pnName.setText(getWeight().toString(showConstantNames)+" "+pnName.getText());
270
271 // Handle constant highlighting
272 boolean focusedConstant = false;
273@@ -147,9 +147,9 @@
274 }
275 }
276 if(focusedConstant){
277- label.setForeground(Pipe.SELECTION_TEXT_COLOUR);
278+ pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
279 }else{
280- label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
281+ pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
282 }
283
284 }
285@@ -162,8 +162,15 @@
286 /*label.setPosition((int) (myPath.midPoint.x + nameOffsetX)
287 + label.getWidth() / 2 - 4, (int) (myPath.midPoint.y + nameOffsetY)
288 - ((zoom / 55) * (zoom / 55)));*/
289+<<<<<<< TREE
290 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
291 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
292+=======
293+
294+ pnName.setPosition(Grid.getModifiedX((double) (myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
295+ Grid.getModifiedY((double) (myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
296+
297+>>>>>>> MERGE-SOURCE
298 }
299
300 public dk.aau.cs.model.tapn.TimedInputArc underlyingTimedInputArc() {
301
302=== modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java'
303--- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-05-03 10:22:45 +0000
304+++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-05-06 12:33:46 +0000
305@@ -114,8 +114,8 @@
306 }
307
308 public void updateLabel(boolean displayConstantNames) {
309- label.setText("");
310- label.setText(getWeight().toString(displayConstantNames)+" " + label.getText());
311+ pnName.setText("");
312+ pnName.setText(getWeight().toString(displayConstantNames)+" " + pnName.getText());
313 setLabelPosition();
314 }
315
316
317=== modified file 'src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java'
318--- src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2019-03-22 10:59:57 +0000
319+++ src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2019-05-06 12:33:46 +0000
320@@ -96,17 +96,23 @@
321 public void updateLabel(boolean displayConstantNames) {
322 if (isInPreSet && underlyingTransportArc != null) {
323 if (CreateGui.getApp().showZeroToInfinityIntervals()){
324- label.setText(underlyingTransportArc.interval().toString(
325+ pnName.setText(underlyingTransportArc.interval().toString(
326 displayConstantNames)
327 + " : " + getGroup());
328 }
329 else {
330 if (underlyingTransportArc.interval().toString(
331 displayConstantNames).equals("[0,inf)")) {
332+<<<<<<< TREE
333 label.setText(" : " + getGroup());
334+=======
335+
336+ pnName.setText(" : " + String.valueOf(getGroup()));
337+
338+>>>>>>> MERGE-SOURCE
339 }
340 else {
341- label.setText(underlyingTransportArc.interval().toString(
342+ pnName.setText(underlyingTransportArc.interval().toString(
343 displayConstantNames)
344 + " : " + getGroup());
345 }
346@@ -130,19 +136,23 @@
347 }
348 }
349 if(focusedConstant){
350- label.setForeground(Pipe.SELECTION_TEXT_COLOUR);
351+ pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
352 }else{
353- label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
354+ pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
355 }
356
357 } else if (!isInPreSet) {
358+<<<<<<< TREE
359 label.setText(" : " + getGroup());
360+=======
361+ pnName.setText(" : " + String.valueOf(getGroup()));
362+>>>>>>> MERGE-SOURCE
363 } else {
364- label.setText("");
365+ pnName.setText("");
366 }
367
368 if(underlyingTransportArc != null){
369- label.setText(getWeight().toString(displayConstantNames)+" "+label.getText());
370+ pnName.setText(getWeight().toString(displayConstantNames)+" "+pnName.getText());
371 }
372
373 this.setLabelPosition();

Subscribers

People subscribed via source and target branches

to all changes: