Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2017-08-09 12:37:45 +0000
committerJeremie Tatibouet2017-09-01 12:38:40 +0000
commit4f99ac85cda6a1e00d50bfdd22af6de1919f32d4 (patch)
tree20b4a9033acbeb1a79915c73621c72a42776b071 /plugins/uml
parent911d78adea35b8833b036b495b7bfb00a5a8439a (diff)
downloadorg.eclipse.papyrus-4f99ac85cda6a1e00d50bfdd22af6de1919f32d4.tar.gz
org.eclipse.papyrus-4f99ac85cda6a1e00d50bfdd22af6de1919f32d4.tar.xz
org.eclipse.papyrus-4f99ac85cda6a1e00d50bfdd22af6de1919f32d4.zip
Bug 520325 - [ActivityDiagram] Bad initial position for an activity
parameter node created from the palette -Add CREATION_ROLE editPolicy on ActivityEditPart -Change ActivityParameterNodePositionLocation behavior (to be on the correct side when don't click on the side of the activity) Change-Id: I7b2bf658c8f96fa49f5cad66d604ee5a183e63c4 Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivitySideAffixedNodesCreationEditPolicy.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/locator/ActivityParameterNodePositionLocator.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen8
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPart.java2
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPartCN.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/SideAffixedNodesCreationEditPolicy.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ISideAffixedNodeBorderItemLocator.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java17
8 files changed, 107 insertions, 31 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivitySideAffixedNodesCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivitySideAffixedNodesCreationEditPolicy.java
new file mode 100644
index 00000000000..1c7a82d11a1
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivitySideAffixedNodesCreationEditPolicy.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.edit.policies;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.papyrus.uml.diagram.activity.locator.ActivityParameterNodePositionLocator;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.SideAffixedNodesCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.ISideAffixedNodeBorderItemLocator;
+
+/**
+ * This class extends {@link SideAffixedNodesCreationEditPolicy} to redefine the PositionLocator
+ * and use the {@link ActivityParameterNodePositionLocator}
+ */
+public class ActivitySideAffixedNodesCreationEditPolicy extends SideAffixedNodesCreationEditPolicy {
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.editpolicies.SideAffixedNodesCreationEditPolicy#getPositionLocator()
+ *
+ * @return
+ */
+ @Override
+ protected ISideAffixedNodeBorderItemLocator getPositionLocator() {
+ return new ActivityParameterNodePositionLocator(getHostFigure(), PositionConstants.NONE);
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/locator/ActivityParameterNodePositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/locator/ActivityParameterNodePositionLocator.java
index d7799b2725c..6b060b57f71 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/locator/ActivityParameterNodePositionLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/locator/ActivityParameterNodePositionLocator.java
@@ -19,10 +19,10 @@ import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator;
+import org.eclipse.papyrus.uml.diagram.common.locator.ISideAffixedNodeBorderItemLocator;
-public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLocator implements IBorderItemLocator {
+public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLocator implements ISideAffixedNodeBorderItemLocator {
/**
* The offset to add to default position. (to avoid corner of rounded
@@ -55,10 +55,10 @@ public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLoca
Rectangle realLocation = new Rectangle(proposedLocation);
- if(realLocation.width < DEFAULT_PIN_SIZE) {
+ if (realLocation.width < DEFAULT_PIN_SIZE) {
realLocation.setWidth(DEFAULT_PIN_SIZE);
}
- else if(realLocation.height < DEFAULT_PIN_SIZE){
+ if (realLocation.height < DEFAULT_PIN_SIZE) {
realLocation.setHeight(DEFAULT_PIN_SIZE);
}
@@ -113,7 +113,7 @@ public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLoca
switch (suggestedSide) {
case PositionConstants.NORTH:
- int northY = parent.y() - borderItemSize.height/2;
+ int northY = parent.y() - borderItemSize.height / 2;
if (suggestedLocation.y != northY) {
newY = northY;
}
@@ -132,7 +132,7 @@ public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLoca
break;
case PositionConstants.WEST:
default:
- int westX = parent.x() - borderItemSize.width / 2;
+ int westX = parent.x() - borderItemSize.width / 2;
if (suggestedLocation.x != westX) {
newX = westX;
}
@@ -184,22 +184,13 @@ public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLoca
setCurrentSideOfParent(findClosestSideOfParent(borderItem.getBounds(), getParentBorder()));
}
- @Override
- protected Point getPreferredLocation(int side, IFigure borderItem) {
- return super.getPreferredLocation(side, borderItem);
- }
-
-
- @Override protected Point locateOnBorder(Point suggestedLocation, int suggestedSide, int circuitCount, IFigure borderItem) {
- return super.locateOnBorder(suggestedLocation, suggestedSide, circuitCount, borderItem);
- }
-
/**
*
* @param proposedLocation
* the proposed location
* @return a possible location on parent figure border
*/
+ @Override
public Rectangle getPreferredLocation(Rectangle proposedLocation) {
// Initialize port location with proposed location
// and resolve the bounds of it graphical parent
@@ -230,10 +221,21 @@ public class ActivityParameterNodePositionLocator extends AdvancedBorderItemLoca
// Modify position if needed.
if ((realLocation.y != yMin) && (realLocation.y != yMax)) {
if ((realLocation.x != xMin) && (realLocation.x != xMax)) {
- if (realLocation.x <= (xMin + (parentRec.width / 2))) {
+ int preferedSide = findClosestSideOfParent(realLocation, parentRec);
+ switch (preferedSide) {
+ case PositionConstants.NORTH:
+ realLocation.y = yMin;
+ break;
+ case PositionConstants.SOUTH:
+ realLocation.y = yMax;
+ break;
+ case PositionConstants.WEST:
realLocation.x = xMin;
- } else {
+ break;
+ case PositionConstants.EAST:
+ default:
realLocation.x = xMax;
+ break;
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
index 9c236978e74..f5410f9a3d2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen
@@ -8574,6 +8574,10 @@
xsi:type="gmfgen:CustomBehaviour"
key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomSideAffixedNodesCreationEditPolicy"/>
<modelFacet>
<metaClass
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity"/>
@@ -19015,6 +19019,10 @@
xsi:type="gmfgen:CustomBehaviour"
key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="EditPolicyRoles.CREATION_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomSideAffixedNodesCreationEditPolicy"/>
<modelFacet>
<metaClass
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity"/>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPart.java
index fbe6c84c8a5..7987a8f4d12 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPart.java
@@ -29,6 +29,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivitySideAffixedNodesCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy;
import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ResizeActivityEditPolicy;
import org.eclipse.papyrus.uml.diagram.activity.figures.ActivityFigure;
@@ -87,6 +88,7 @@ public class ActivityEditPart extends RoundedCompartmentEditPart {
installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizeActivityEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new ActivitySideAffixedNodesCreationEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPartCN.java
index 6f3289037fc..6c4e641f72c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityEditPartCN.java
@@ -29,6 +29,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy;
+import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivitySideAffixedNodesCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy;
import org.eclipse.papyrus.uml.diagram.activity.figures.ActivityFigureCN;
import org.eclipse.papyrus.uml.diagram.activity.locator.ActivityParameterNodePositionLocator;
@@ -90,6 +91,7 @@ public class ActivityEditPartCN extends RoundedCompartmentEditPart {
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new ActivitySideAffixedNodesCreationEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/SideAffixedNodesCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/SideAffixedNodesCreationEditPolicy.java
index 18943fb9231..569550b745e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/SideAffixedNodesCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/SideAffixedNodesCreationEditPolicy.java
@@ -33,6 +33,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool;
import org.eclipse.papyrus.infra.gmfdiag.common.snap.NodeSnapHelper;
+import org.eclipse.papyrus.uml.diagram.common.locator.ISideAffixedNodeBorderItemLocator;
import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
@@ -60,11 +61,11 @@ public class SideAffixedNodesCreationEditPolicy extends DefaultCreationEditPolic
Point requestedLocation = realWantedLocation.getCopy();
getHostFigure().translateToRelative(requestedLocation);
// Create proposed creation bounds and use the locator to find the expected position
- PortPositionLocator locator = getPositionLocator();
+ ISideAffixedNodeBorderItemLocator locator = getPositionLocator();
if (locator == null) {
return null;
}
- final Rectangle preferredBounds = locator.getPreferredLocation(new Rectangle(requestedLocation, new Dimension(20, 20)));
+ final Rectangle preferredBounds = locator.getPreferredLocation(new Rectangle(requestedLocation, new Dimension(-1, -1)));
Rectangle retainedBounds = preferredBounds.getCopy();
// find the current side of the wanted position
final Rectangle parentBounds = getHostFigure().getBounds().getCopy();
@@ -76,8 +77,8 @@ public class SideAffixedNodesCreationEditPolicy extends DefaultCreationEditPolic
// we find the best location with snap
Point wantedPoint = preferredBounds.getLocation();
getHostFigure().translateToAbsolute(wantedPoint);
- Rectangle portBounds = new Rectangle(wantedPoint, new Dimension(20, 20));
- NodeSnapHelper helper = new NodeSnapHelper((SnapToHelper) getHost().getAdapter(SnapToHelper.class), portBounds, false, false, true);
+ Rectangle portBounds = new Rectangle(wantedPoint, new Dimension(-1, -1));
+ NodeSnapHelper helper = new NodeSnapHelper(getHost().getAdapter(SnapToHelper.class), portBounds, false, false, true);
final ChangeBoundsRequest tmpRequest = new ChangeBoundsRequest("move"); //$NON-NLS-1$
tmpRequest.setEditParts(Collections.emptyList());
tmpRequest.setSnapToEnabled(true);
@@ -103,7 +104,7 @@ public class SideAffixedNodesCreationEditPolicy extends DefaultCreationEditPolic
return setBoundsCommand;
}
- protected PortPositionLocator getPositionLocator() {
+ protected ISideAffixedNodeBorderItemLocator getPositionLocator() {
return new PortPositionLocator(getHostFigure(), PositionConstants.NONE);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ISideAffixedNodeBorderItemLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ISideAffixedNodeBorderItemLocator.java
new file mode 100644
index 00000000000..7b0d28ef913
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ISideAffixedNodeBorderItemLocator.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.locator;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+
+public interface ISideAffixedNodeBorderItemLocator extends IBorderItemLocator {
+
+ public Rectangle getPreferredLocation(final Rectangle proposedLocation);
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java
index ef24e9ce14d..f90d8331598 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/PortPositionLocator.java
@@ -21,7 +21,6 @@ import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IRoundedRectangleFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
@@ -49,7 +48,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.PortPositionEnum;
* </pre>
*
*/
-public class PortPositionLocator implements IBorderItemLocator {
+public class PortPositionLocator implements ISideAffixedNodeBorderItemLocator {
/** Default port height. */
private static final int DEFAULT_HEIGHT = 20;
@@ -73,7 +72,7 @@ public class PortPositionLocator implements IBorderItemLocator {
private IFigure figure;
/**
- * Constructor
+ * Constructor
*
* @param parentFigure
* the parent figure
@@ -81,7 +80,7 @@ public class PortPositionLocator implements IBorderItemLocator {
* unused
* @deprecated use PortPositionLocator(final IFigure parentFigure)
*/
- @Deprecated
+ @Deprecated
public PortPositionLocator(final IFigure parentFigure, final int preferredSide) {
// The preferredSide parameter is not used, just kept here to ensure compatibility
// with GMF generated code.
@@ -89,15 +88,16 @@ public class PortPositionLocator implements IBorderItemLocator {
}
/**
- * Constructor
+ * Constructor
+ *
* @param parentFigure
* the parent figure
*/
public PortPositionLocator(final IFigure parentFigure) {
this.parentFigure = parentFigure;
- }
-
-
+ }
+
+
public int getBorderItemOffset() {
return borderItemOffset;
}
@@ -172,6 +172,7 @@ public class PortPositionLocator implements IBorderItemLocator {
* the proposed location
* @return a possible location on parent figure border
*/
+ @Override
public Rectangle getPreferredLocation(final Rectangle proposedLocation) {
// If it's a SVGNodePlate get the anchor to get the position
if (parentFigure instanceof SVGNodePlateFigure &&

Back to the top