Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratischenko2015-10-26 22:47:27 +0000
committerGerrit Code Review @ Eclipse.org2015-10-30 11:27:04 +0000
commitc05970d1d362d6f9d907fbcda4e372f6838acd3f (patch)
tree1754c94042f640e67ff917cf7a7383675c580503 /plugins
parent9bcb16dd9b5c2bf056707eb3ac6b989a00f4ce11 (diff)
downloadorg.eclipse.papyrus-c05970d1d362d6f9d907fbcda4e372f6838acd3f.tar.gz
org.eclipse.papyrus-c05970d1d362d6f9d907fbcda4e372f6838acd3f.tar.xz
org.eclipse.papyrus-c05970d1d362d6f9d907fbcda4e372f6838acd3f.zip
Bug 474382 - [Composite Structure Diagram] Behavior port notation should
not be an independant figure - change port figure to oval - fill background oval figure with foreground color - fix line decorator paint and its locator - change behavior position when port in compartment to south - add refresh behaviorFigure when portEP refresh Change-Id: If4deb43510d04a8e89b3cfaf6e0b858e5bc42599 Signed-off-by: atischenko <tischenko@montages.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortEditPart.java36
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/BehaviorFigure.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/LineDecorator.java33
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PortFigure.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BasePortChildLocator.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPositionLocator.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/LineDecoratorLocator.java35
9 files changed, 128 insertions, 62 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
index cc4368c752f..ef0899bffe3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
@@ -21,6 +21,7 @@ import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPartCN
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.DurationObservationStereotypeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ParameterAppliedStereotypeEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.TimeObservationStereotypeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UMLEditPartFactory;
@@ -46,6 +47,8 @@ public class CustomEditPartFactory extends UMLEditPartFactory {
return new CustomConnectorMultiplicityTargetEditPart(view);
case ConstraintEditPartCN.VISUAL_ID:
return new CustomConstraintEditPartCN(view);
+ case PortEditPart.VISUAL_ID:
+ return new CustomPortEditPart(view);
case PortNameEditPart.VISUAL_ID:
return new CustomPortNameEditPart(view);
case DurationObservationStereotypeLabelEditPart.VISUAL_ID:
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortEditPart.java
new file mode 100644
index 00000000000..a6d15f90141
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortEditPart.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorPortEditPolicy;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
+
+/**
+ * @author atischenko
+ *
+ */
+public class CustomPortEditPart extends PortEditPart {
+
+ public CustomPortEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ BehaviorPortEditPolicy policy = (BehaviorPortEditPolicy)getEditPolicy(BehaviorPortEditPolicy.BEHAVIOR_PORT);
+ policy.udaptePortBehavior();
+ super.refreshVisuals();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
index 5a044bad55e..120fdb5b38e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/BehaviorPortEditPolicy.java
@@ -40,6 +40,7 @@ import org.eclipse.papyrus.uml.diagram.composite.custom.edit.command.CreateBehav
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.PortFigure;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortLinkEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
+import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.UMLPackage;
@@ -48,9 +49,7 @@ import org.eclipse.uml2.uml.UMLPackage;
* This editpolicy calls explicitly BehaviorPortLocator in order to place the symbol behavior at the good place (inside the composite).
*/
public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
- public static String BEHAVIOR_PORT = "BehaviorPortPolicy";
-
- private Port hostSemanticElement;
+ public static final String BEHAVIOR_PORT = "BehaviorPortPolicy";
@Override
public void notifyChanged(Notification notification) {
@@ -60,8 +59,9 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
}
}
- protected void udaptePortBehavior() {
- ShapeCompartmentEditPart targetEditPart = getPossibleCompartment(((GraphicalEditPart) getHost()).getParent());
+ public void udaptePortBehavior() {
+ GraphicalEditPart parentEditPart = (GraphicalEditPart)((GraphicalEditPart) getHost()).getParent();
+ ShapeCompartmentEditPart targetEditPart = getPossibleCompartment(parentEditPart);
if (targetEditPart != null) {
// remove old BehaviorPort presentation
View behaviorPort = getBehaviorPortNode();
@@ -73,8 +73,12 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
if (hostFigure instanceof PortFigure) {
PortFigure port = (PortFigure) hostFigure;
- if (hostSemanticElement.isBehavior()) {
- port.restoreBehaviorFigure();
+ if (getUMLElement().isBehavior()) {
+ if (parentEditPart.resolveSemanticElement() instanceof Classifier || targetEditPart != null) {
+ port.restoreBehaviorFigure();
+ } else {
+ port.removeBehavior();
+ }
} else {
port.removeBehavior();
}
@@ -147,29 +151,28 @@ public class BehaviorPortEditPolicy extends GraphicalEditPolicy implements Notif
*/
@Override
public void activate() {
+ super.activate();
// retrieve the view and the element managed by the edit part
View view = getView();
if (view == null) {
return;
}
- hostSemanticElement = getUMLElement();
// adds a listener on the view and the element controlled by the
// editpart
getDiagramEventBroker().addNotificationListener(view, this);
- if (hostSemanticElement == null) {
+ if (getUMLElement() == null) {
return;
}
- getDiagramEventBroker().addNotificationListener(hostSemanticElement, this);
+ getDiagramEventBroker().addNotificationListener(getUMLElement(), this);
udaptePortBehavior();
}
@Override
public void deactivate() {
- // TODO Auto-generated method stub
- super.deactivate();
// remove notification on element
- getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this);
+ getDiagramEventBroker().removeNotificationListener(getUMLElement(), this);
+ super.deactivate();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/BehaviorFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/BehaviorFigure.java
index 1c7996ddba0..7f9091a4ea8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/BehaviorFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/BehaviorFigure.java
@@ -14,15 +14,18 @@
package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
public class BehaviorFigure extends RoundedCompartmentFigure {
- public static final int BEHAVIOR_OFFSET = 8;
+ private static final int HEIGHT = 8;
+
+ private static final int WIDTH = 14;
+
+ public static final int BEHAVIOR_OFFSET = 6;
public BehaviorFigure(PortFigure parent) {
- setCornerDimensions(new Dimension(5, 5));
+ setOval(true);
}
public void setPosition(int parentPosition) {
@@ -41,10 +44,10 @@ public class BehaviorFigure extends RoundedCompartmentFigure {
}
private void doVerticalFigure() {
- this.setSize(10, 16);
+ this.setSize(HEIGHT, WIDTH);
}
private void doHorizontalFigure() {
- this.setSize(16, 10);
+ this.setSize(WIDTH, HEIGHT);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/LineDecorator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/LineDecorator.java
index 7b0355a1745..686c392b0ad 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/LineDecorator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/LineDecorator.java
@@ -15,19 +15,48 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.figures;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.geometry.Point;
public class LineDecorator extends Figure {
- private int myLineWidth = 2;
+ private int myLineWidth = 2;//default
+
+ private boolean horizontalNotVertical = true;
+
+ private int myLineStyle = 0; // default
public void setLineWidth(int lineWidth) {
myLineWidth = lineWidth;
}
+ public void setHorizontal(boolean value) {
+ horizontalNotVertical = value;
+ }
+
+ public void setLineStyle(int lineStyle) {
+ myLineStyle = lineStyle;
+ }
+
public void paint(Graphics graphics) {
graphics.pushState();
graphics.setLineWidth(myLineWidth);
- graphics.drawLine(getBounds().getTopLeft(), getBounds().getBottomRight());
+ Point start, end;
+ if (horizontalNotVertical) {
+ int y = (bounds.getTopLeft().y + bounds.getBottomRight().y) / 2;
+ start = new Point(bounds.getTopLeft().x, y);
+ end = new Point(bounds.getBottomRight().x, y);
+ } else {
+ int x = (bounds.getTopLeft().x + bounds.getBottomRight().x) / 2;
+ start = new Point(x, bounds.getTopLeft().y);
+ end = new Point(x, bounds.getBottomRight().y);
+ }
+ graphics.setForegroundColor(this.getForegroundColor());
+ graphics.setLineStyle(myLineStyle);
+ graphics.drawLine(start, end);
graphics.popState();
};
+
+ public int getLineWidth() {
+ return myLineWidth;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PortFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PortFigure.java
index 7d6d6a03aad..a0bdf8895e5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PortFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/figures/PortFigure.java
@@ -63,10 +63,9 @@ public class PortFigure extends AffixedNamedElementFigure {
behavior.setShadow(getShadow());
behavior.setLineStyle(getLineStyle());
behavior.setLineWidth(getLineWidth());
- behavior.setGradientData(getGradientColor1(), getGradientColor2(), getGradientStyle());
- behavior.setIsUsingGradient(isUsingGradient());
+ behavior.setIsUsingGradient(false);
behavior.setForegroundColor(getForegroundColor());
- behavior.setBackgroundColor(getBackgroundColor());
+ behavior.setBackgroundColor(getForegroundColor());
return behavior;
}
@@ -75,6 +74,7 @@ public class PortFigure extends AffixedNamedElementFigure {
line.setForegroundColor(getForegroundColor());
line.setBackgroundColor(getBackgroundColor());
line.setLineWidth(getLineWidth());
+ line.setLineStyle(getLineStyle());
return line;
}
@@ -129,6 +129,9 @@ public class PortFigure extends AffixedNamedElementFigure {
if (myBehavior != null) {
myBehavior.setLineStyle(s);
}
+ if (myLineDecor != null) {
+ myLineDecor.setLineStyle(s);
+ }
}
@Override
@@ -143,40 +146,14 @@ public class PortFigure extends AffixedNamedElementFigure {
}
@Override
- public void setGradientData(int gradientColor1, int gradientColor2, int gradientStyle) {
- super.setGradientData(gradientColor1, gradientColor2, gradientStyle);
- if (myBehavior != null) {
- myBehavior.setGradientData(gradientColor1, gradientColor2, gradientStyle);
- }
- }
-
- @Override
- public void setIsUsingGradient(boolean b) {
- super.setIsUsingGradient(b);
- if (myBehavior != null) {
- myBehavior.setIsUsingGradient(b);
- }
- }
-
- @Override
public void setForegroundColor(Color fg) {
super.setForegroundColor(fg);
if (myBehavior != null) {
myBehavior.setForegroundColor(fg);
+ myBehavior.setBackgroundColor(fg);
}
if (myLineDecor != null) {
myLineDecor.setForegroundColor(fg);
}
}
-
- @Override
- public void setBackgroundColor(Color bg) {
- super.setBackgroundColor(bg);
- if (myBehavior != null) {
- myBehavior.setBackgroundColor(bg);
- }
- if (myLineDecor != null) {
- myLineDecor.setBackgroundColor(bg);
- }
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BasePortChildLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BasePortChildLocator.java
index 4a5487a3665..c272bdd4369 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BasePortChildLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BasePortChildLocator.java
@@ -51,7 +51,7 @@ public abstract class BasePortChildLocator implements IBorderItemLocator {
}
//side == 0 the port located not on the board of the parent
- return side == 0 ? PositionConstants.NORTH : side;
+ return side == 0 ? PositionConstants.SOUTH : side;
}
private Rectangle getParentBounds() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPositionLocator.java
index 13659118aa2..1f639ee3e5a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPositionLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/BehaviorPositionLocator.java
@@ -56,7 +56,7 @@ public class BehaviorPositionLocator extends BasePortChildLocator {
behaviorPosition.x = behaviorPosition.x - behaviorPosition.width - BehaviorFigure.BEHAVIOR_OFFSET;
behaviorPosition.y = behaviorPosition.y + portPosition.height / 2 - behaviorPosition.height / 2;
} else if ((portSide & PositionConstants.WEST) != 0) {
- behaviorPosition.x = behaviorPosition.x + portPosition.width + BehaviorFigure.BEHAVIOR_OFFSET + /*correct position*/1;
+ behaviorPosition.x = behaviorPosition.x + portPosition.width + BehaviorFigure.BEHAVIOR_OFFSET;
behaviorPosition.y = behaviorPosition.y + portPosition.height / 2 - behaviorPosition.height / 2;
}
return behaviorPosition;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/LineDecoratorLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/LineDecoratorLocator.java
index f1af3c89de8..a5a5936be02 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/LineDecoratorLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/locators/LineDecoratorLocator.java
@@ -18,6 +18,7 @@ import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.BehaviorFigure;
+import org.eclipse.papyrus.uml.diagram.composite.custom.figures.LineDecorator;
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.PortFigure;
public class LineDecoratorLocator extends BasePortChildLocator {
@@ -29,34 +30,48 @@ public class LineDecoratorLocator extends BasePortChildLocator {
@Override
public void relocate(IFigure target) {
Rectangle portBounds = myPort.getBounds();
-
+
+ // Rectangle constructor add 1 to width and height
+ int lengthAndWidthCorrection = 1;
+
Point start = portBounds.getCenter();
Point end = new Point();
-
+
+ LineDecorator ld = (LineDecorator)target;
+ int lineWidth = ld.getLineWidth();
switch (getPortSide()) {
case PositionConstants.WEST:
- start.x = start.x + portBounds.width / 2;
+ start.x = start.x + portBounds.width / 2 - 1;
end.x = start.x + BehaviorFigure.BEHAVIOR_OFFSET;
- end.y = start.y;
+ start.y = start.y - lineWidth/2 - lengthAndWidthCorrection;
+ end.y = start.y + lineWidth;
+ ld.setHorizontal(true);
break;
case PositionConstants.EAST:
- start.x = start.x - portBounds.width / 2;
+ start.x = start.x - portBounds.width / 2 - 1;
end.x = start.x - BehaviorFigure.BEHAVIOR_OFFSET;
- end.y = start.y;
+ start.y = start.y - lineWidth/2 - lengthAndWidthCorrection;
+ end.y = start.y + lineWidth;
+ ld.setHorizontal(true);
break;
case PositionConstants.SOUTH:
- start.y = start.y - portBounds.height / 2;
+ start.y = start.y - portBounds.height / 2 - 1;
end.y = start.y - BehaviorFigure.BEHAVIOR_OFFSET;
- end.x = start.x;
+ start.x = start.x - lineWidth/2 - lengthAndWidthCorrection;
+ end.x = start.x + lineWidth;
+ ld.setHorizontal(false);
break;
case PositionConstants.NORTH:
- start.y = start.y + portBounds.width / 2;
+ start.y = start.y + portBounds.width / 2 - 1;
end.y = start.y + BehaviorFigure.BEHAVIOR_OFFSET;
- end.x = start.x;
+ start.x = start.x - lineWidth/2 - lengthAndWidthCorrection;
+ end.x = start.x + lineWidth;
+ ld.setHorizontal(false);
break;
default:
break;
}
+
target.setBounds(new Rectangle(start, end));
}
}

Back to the top