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

Proposed by Kenneth Yrke Jørgensen
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 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
=== modified file 'src/pipe/gui/graphicElements/Arc.java'
--- src/pipe/gui/graphicElements/Arc.java 2019-03-22 11:17:59 +0000
+++ src/pipe/gui/graphicElements/Arc.java 2019-05-06 12:33:46 +0000
@@ -28,7 +28,7 @@
28 0, -10, -7, -10 }, 4);28 0, -10, -7, -10 }, 4);
29 protected boolean fillHead = true; //If true, fill the shape when drawing, if false, fill with bg color.29 protected boolean fillHead = true; //If true, fill the shape when drawing, if false, fill with bg color.
3030
31 protected NameLabel label;31 //protected NameLabel label;
3232
33 private static Point2D.Double point;33 private static Point2D.Double point;
3434
@@ -62,7 +62,7 @@
62 double endPositionXInput, double endPositionYInput,62 double endPositionXInput, double endPositionYInput,
63 PlaceTransitionObject sourceInput,63 PlaceTransitionObject sourceInput,
64 PlaceTransitionObject targetInput, int weightInput, String idInput) {64 PlaceTransitionObject targetInput, int weightInput, String idInput) {
65 label = new NameLabel(zoom);65 pnName = new NameLabel(zoom);
66 myPath.addPoint((float) startPositionXInput,66 myPath.addPoint((float) startPositionXInput,
67 (float) startPositionYInput, ArcPathPoint.STRAIGHT);67 (float) startPositionYInput, ArcPathPoint.STRAIGHT);
68 myPath.addPoint((float) endPositionXInput, (float) endPositionYInput,68 myPath.addPoint((float) endPositionXInput, (float) endPositionYInput,
@@ -83,7 +83,7 @@
83 */83 */
84 public Arc(PlaceTransitionObject newSource) {84 public Arc(PlaceTransitionObject newSource) {
85 isPrototype = true;85 isPrototype = true;
86 label = new NameLabel(zoom);86 pnName = new NameLabel(zoom);
87 source = newSource;87 source = newSource;
88 myPath.addPoint();88 myPath.addPoint();
89 myPath.addPoint();89 myPath.addPoint();
@@ -96,7 +96,7 @@
96 public Arc() {96 public Arc() {
97 super();97 super();
9898
99 label = new NameLabel(zoom);99 pnName = new NameLabel(zoom);
100 //XXX see comment in function100 //XXX see comment in function
101 setLableHandler();101 setLableHandler();
102 }102 }
@@ -138,8 +138,14 @@
138 }138 }
139139
140 public void setLabelPosition() {140 public void setLabelPosition() {
141<<<<<<< TREE
141 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),142 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
142 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));143 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
144=======
145
146 pnName.setPosition(Grid.getModifiedX((double) (myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
147 Grid.getModifiedY((double) (myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
148>>>>>>> MERGE-SOURCE
143 }149 }
144 @Override150 @Override
145 public void updateLabelLocation() {151 public void updateLabelLocation() {
@@ -170,7 +176,7 @@
170 176
171 @Override 177 @Override
172 public NameLabel getNameLabel() {178 public NameLabel getNameLabel() {
173 return label;179 return pnName;
174 }180 }
175181
176 /**182 /**
@@ -279,10 +285,10 @@
279 //Draw Path285 //Draw Path
280 if (selected) {286 if (selected) {
281 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);287 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
282 this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);288 //this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
283 } else {289 } else {
284 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);290 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
285 this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);291 //this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
286 }292 }
287293
288 g2.setStroke(new BasicStroke(0.01f * zoom));294 g2.setStroke(new BasicStroke(0.01f * zoom));
@@ -302,10 +308,10 @@
302308
303 if (selected) {309 if (selected) {
304 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);310 g2.setPaint(Pipe.SELECTION_LINE_COLOUR);
305 this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);311 //this.label.setForeground(Pipe.SELECTION_LINE_COLOUR);
306 } else {312 } else {
307 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);313 g2.setPaint(Pipe.ELEMENT_LINE_COLOUR);
308 this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);314 //this.label.setForeground(Pipe.ELEMENT_LINE_COLOUR);
309 }315 }
310316
311 g2.setStroke(new BasicStroke(0.8f));317 g2.setStroke(new BasicStroke(0.8f));
@@ -350,8 +356,8 @@
350 myPath.addPointsToGui(getParent());356 myPath.addPointsToGui(getParent());
351357
352 updateArcPosition();358 updateArcPosition();
353 if (getParent() != null && label.getParent() == null) {359 if (getParent() != null && pnName.getParent() == null) {
354 getParent().add(label);360 getParent().add(pnName);
355 }361 }
356 }362 }
357363
@@ -359,7 +365,7 @@
359 public void delete() {365 public void delete() {
360 if (!deleted) {366 if (!deleted) {
361 if (getParent() != null) {367 if (getParent() != null) {
362 getParent().remove(label);368 getParent().remove(pnName);
363 }369 }
364 if(source != null) source.removeFromArc(this);370 if(source != null) source.removeFromArc(this);
365 if(target != null) target.removeToArc(this);371 if(target != null) target.removeToArc(this);
@@ -388,7 +394,7 @@
388394
389 public void removeFromView() {395 public void removeFromView() {
390 if (getParent() != null) {396 if (getParent() != null) {
391 getParent().remove(label);397 getParent().remove(pnName);
392 }398 }
393 myPath.forceHidePoints();399 myPath.forceHidePoints();
394 removeFromContainer();400 removeFromContainer();
@@ -429,8 +435,8 @@
429 zoom = percent;435 zoom = percent;
430 this.updateArcPosition();436 this.updateArcPosition();
431 this.updateOnMoveOrZoom();437 this.updateOnMoveOrZoom();
432 label.zoomUpdate(percent);438 pnName.zoomUpdate(percent);
433 label.updateSize();439 pnName.updateSize();
434 }440 }
435441
436 public void setZoom(int percent) {442 public void setZoom(int percent) {
437443
=== modified file 'src/pipe/gui/graphicElements/PetriNetObject.java'
--- src/pipe/gui/graphicElements/PetriNetObject.java 2019-03-22 10:13:18 +0000
+++ src/pipe/gui/graphicElements/PetriNetObject.java 2019-05-06 12:33:46 +0000
@@ -217,17 +217,28 @@
217 }217 }
218218
219 public void select(boolean shouldRepaint) {219 public void select(boolean shouldRepaint) {
220 if (selectable && !selected) {220 if (selectable && !selected) {
221 selected = true;221 selected = true;
222
223 if (pnName != null) {
224 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
225 }
226
222 if (shouldRepaint) {227 if (shouldRepaint) {
223 repaint();228 repaint();
224 }229 }
225 }230 }
231
226 }232 }
227233
228 public void deselect() {234 public void deselect() {
229 if (selected) {235 if (selected) {
230 selected = false;236 selected = false;
237
238 if (pnName != null) {
239 pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
240 }
241
231 repaint();242 repaint();
232 }243 }
233 }244 }
234245
=== modified file 'src/pipe/gui/graphicElements/Place.java'
--- src/pipe/gui/graphicElements/Place.java 2019-03-22 10:13:18 +0000
+++ src/pipe/gui/graphicElements/Place.java 2019-05-06 12:33:46 +0000
@@ -67,10 +67,10 @@
6767
68 if (selected) {68 if (selected) {
69 g2.setColor(Pipe.SELECTION_FILL_COLOUR);69 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
70 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);70 //pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
71 } else {71 } else {
72 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);72 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);
73 pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);73 //pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
74 }74 }
75 g2.fill(placeEllipse);75 g2.fill(placeEllipse);
7676
7777
=== modified file 'src/pipe/gui/graphicElements/PlaceTransitionObject.java'
--- src/pipe/gui/graphicElements/PlaceTransitionObject.java 2019-03-23 07:20:46 +0000
+++ src/pipe/gui/graphicElements/PlaceTransitionObject.java 2019-05-06 12:33:46 +0000
@@ -318,6 +318,10 @@
318 if (selectable && !selected) {318 if (selectable && !selected) {
319 selected = true;319 selected = true;
320320
321 if (pnName != null) {
322 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
323 }
324
321 // Select arcs that are connected from this object to another selected object.325 // Select arcs that are connected from this object to another selected object.
322 for (Arc arc : getPostset()) {326 for (Arc arc : getPostset()) {
323 if(arc.getTarget().isSelected()){327 if(arc.getTarget().isSelected()){
324328
=== modified file 'src/pipe/gui/graphicElements/Transition.java'
--- src/pipe/gui/graphicElements/Transition.java 2019-03-23 07:14:56 +0000
+++ src/pipe/gui/graphicElements/Transition.java 2019-05-06 12:33:46 +0000
@@ -97,10 +97,10 @@
9797
98 if (selected) {98 if (selected) {
99 g2.setColor(Pipe.SELECTION_FILL_COLOUR);99 g2.setColor(Pipe.SELECTION_FILL_COLOUR);
100 pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);100 //pnName.setForeground(Pipe.SELECTION_LINE_COLOUR);
101 } else {101 } else {
102 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);102 g2.setColor(Pipe.ELEMENT_FILL_COLOUR);
103 pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);103 //pnName.setForeground(Pipe.ELEMENT_LINE_COLOUR);
104 }104 }
105105
106 if (highlighted) {106 if (highlighted) {
107107
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-03-22 10:13:18 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedInhibitorArcComponent.java 2019-05-06 12:33:46 +0000
@@ -71,9 +71,9 @@
7171
72 @Override72 @Override
73 public void updateLabel(boolean displayConstantNames) {73 public void updateLabel(boolean displayConstantNames) {
74 label.setText("");74 pnName.setText("");
75 if(getWeight().value() > 1 || displayConstantNames){75 if(getWeight().value() > 1 || displayConstantNames){
76 label.setText(getWeight().toString(displayConstantNames));76 pnName.setText(getWeight().toString(displayConstantNames));
77 }77 }
78 78
79 boolean focusedConstant = false;79 boolean focusedConstant = false;
@@ -83,9 +83,9 @@
83 }83 }
84 }84 }
85 if(focusedConstant){85 if(focusedConstant){
86 label.setForeground(Pipe.SELECTION_TEXT_COLOUR);86 pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
87 }else{87 }else{
88 label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);88 pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
89 }89 }
90 90
91 this.setLabelPosition();91 this.setLabelPosition();
9292
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2019-03-22 11:17:59 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedInputArcComponent.java 2019-05-06 12:33:46 +0000
@@ -113,21 +113,21 @@
113 }113 }
114 if (!CreateGui.getModel().netType().equals(NetType.UNTIMED)) {114 if (!CreateGui.getModel().netType().equals(NetType.UNTIMED)) {
115 if (inputArc == null)115 if (inputArc == null)
116 label.setText("");116 pnName.setText("");
117 else {117 else {
118 if (!CreateGui.getApp().showZeroToInfinityIntervals()) {118 if (!CreateGui.getApp().showZeroToInfinityIntervals()) {
119 if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){119 if (inputArc.interval().toString(showConstantNames).equals("[0,inf)")){
120 label.setText("");120 pnName.setText("");
121 }121 }
122 else {122 else {
123 label.setText(inputArc.interval().toString(showConstantNames));123 pnName.setText(inputArc.interval().toString(showConstantNames));
124 } 124 }
125 }125 }
126 else {126 else {
127 label.setText(inputArc.interval().toString(showConstantNames));127 pnName.setText(inputArc.interval().toString(showConstantNames));
128 }128 }
129 129
130 label.setText(getWeight().toString(showConstantNames)+" "+label.getText());130 pnName.setText(getWeight().toString(showConstantNames)+" "+pnName.getText());
131 131
132 // Handle constant highlighting132 // Handle constant highlighting
133 boolean focusedConstant = false;133 boolean focusedConstant = false;
@@ -147,9 +147,9 @@
147 }147 }
148 }148 }
149 if(focusedConstant){149 if(focusedConstant){
150 label.setForeground(Pipe.SELECTION_TEXT_COLOUR);150 pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
151 }else{151 }else{
152 label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);152 pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
153 }153 }
154 154
155 }155 }
@@ -162,8 +162,15 @@
162 /*label.setPosition((int) (myPath.midPoint.x + nameOffsetX)162 /*label.setPosition((int) (myPath.midPoint.x + nameOffsetX)
163 + label.getWidth() / 2 - 4, (int) (myPath.midPoint.y + nameOffsetY)163 + label.getWidth() / 2 - 4, (int) (myPath.midPoint.y + nameOffsetY)
164 - ((zoom / 55) * (zoom / 55)));*/164 - ((zoom / 55) * (zoom / 55)));*/
165<<<<<<< TREE
165 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),166 label.setPosition(Grid.getModifiedX((myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
166 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));167 Grid.getModifiedY((myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
168=======
169
170 pnName.setPosition(Grid.getModifiedX((double) (myPath.midPoint.x + Zoomer.getZoomedValue(nameOffsetX, zoom))),
171 Grid.getModifiedY((double) (myPath.midPoint.y + Zoomer.getZoomedValue(nameOffsetY, zoom))));
172
173>>>>>>> MERGE-SOURCE
167 }174 }
168175
169 public dk.aau.cs.model.tapn.TimedInputArc underlyingTimedInputArc() {176 public dk.aau.cs.model.tapn.TimedInputArc underlyingTimedInputArc() {
170177
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-05-03 10:22:45 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedOutputArcComponent.java 2019-05-06 12:33:46 +0000
@@ -114,8 +114,8 @@
114 }114 }
115115
116 public void updateLabel(boolean displayConstantNames) {116 public void updateLabel(boolean displayConstantNames) {
117 label.setText("");117 pnName.setText("");
118 label.setText(getWeight().toString(displayConstantNames)+" " + label.getText());118 pnName.setText(getWeight().toString(displayConstantNames)+" " + pnName.getText());
119 setLabelPosition();119 setLabelPosition();
120 }120 }
121121
122122
=== modified file 'src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java'
--- src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2019-03-22 10:59:57 +0000
+++ src/pipe/gui/graphicElements/tapn/TimedTransportArcComponent.java 2019-05-06 12:33:46 +0000
@@ -96,17 +96,23 @@
96 public void updateLabel(boolean displayConstantNames) {96 public void updateLabel(boolean displayConstantNames) {
97 if (isInPreSet && underlyingTransportArc != null) {97 if (isInPreSet && underlyingTransportArc != null) {
98 if (CreateGui.getApp().showZeroToInfinityIntervals()){98 if (CreateGui.getApp().showZeroToInfinityIntervals()){
99 label.setText(underlyingTransportArc.interval().toString(99 pnName.setText(underlyingTransportArc.interval().toString(
100 displayConstantNames)100 displayConstantNames)
101 + " : " + getGroup());101 + " : " + getGroup());
102 }102 }
103 else {103 else {
104 if (underlyingTransportArc.interval().toString(104 if (underlyingTransportArc.interval().toString(
105 displayConstantNames).equals("[0,inf)")) {105 displayConstantNames).equals("[0,inf)")) {
106<<<<<<< TREE
106 label.setText(" : " + getGroup());107 label.setText(" : " + getGroup());
108=======
109
110 pnName.setText(" : " + String.valueOf(getGroup()));
111
112>>>>>>> MERGE-SOURCE
107 }113 }
108 else {114 else {
109 label.setText(underlyingTransportArc.interval().toString(115 pnName.setText(underlyingTransportArc.interval().toString(
110 displayConstantNames)116 displayConstantNames)
111 + " : " + getGroup());117 + " : " + getGroup());
112 } 118 }
@@ -130,19 +136,23 @@
130 }136 }
131 }137 }
132 if(focusedConstant){138 if(focusedConstant){
133 label.setForeground(Pipe.SELECTION_TEXT_COLOUR);139 pnName.setForeground(Pipe.SELECTION_TEXT_COLOUR);
134 }else{140 }else{
135 label.setForeground(Pipe.ELEMENT_TEXT_COLOUR);141 pnName.setForeground(Pipe.ELEMENT_TEXT_COLOUR);
136 }142 }
137 143
138 } else if (!isInPreSet) {144 } else if (!isInPreSet) {
145<<<<<<< TREE
139 label.setText(" : " + getGroup());146 label.setText(" : " + getGroup());
147=======
148 pnName.setText(" : " + String.valueOf(getGroup()));
149>>>>>>> MERGE-SOURCE
140 } else {150 } else {
141 label.setText("");151 pnName.setText("");
142 }152 }
143 153
144 if(underlyingTransportArc != null){154 if(underlyingTransportArc != null){
145 label.setText(getWeight().toString(displayConstantNames)+" "+label.getText());155 pnName.setText(getWeight().toString(displayConstantNames)+" "+pnName.getText());
146 }156 }
147 157
148 this.setLabelPosition();158 this.setLabelPosition();

Subscribers

People subscribed via source and target branches

to all changes: