diff --git a/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF index 38af68c9e3784c683c32ff42abd70cc77ba447ad..791aa8d77355695d76da7a1ea13c3e00bd1cffee 100644 --- a/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Export-Package: org.fortiss.tooling.base.ui, org.fortiss.tooling.base.ui.editor, org.fortiss.tooling.base.ui.editor.annotations, org.fortiss.tooling.base.ui.editor.fx, + org.fortiss.tooling.base.ui.editor.fx.visuals, org.fortiss.tooling.base.ui.editpart, org.fortiss.tooling.base.ui.editpart.allocation, org.fortiss.tooling.base.ui.editpart.command, diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/.ratings new file mode 100644 index 0000000000000000000000000000000000000000..22e27e4c1bc1b40ffc645ab0ee36503bb4188ce5 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/.ratings @@ -0,0 +1,5 @@ +CoordinateCorrections.java f78a936ba49c5fc4daf29237ecb4e86a446316d4 GREEN +LayoutedCircularContentAnchorageVisualBase.java aa546c0c9d975972a33cf22682b5d6634e56d271 GREEN +LayoutedCircularDiagramAnchorageVisualBase.java c5cc5fb41777166bc169011324585e51acda04c3 GREEN +LayoutedLineLinkVisualBase.java 429483c1222a26345fbc3bf5c9b2dbe41c6ad5f1 GREEN +LayoutedRectangularContentVisualBase.java d4cd07a8056df99927b160f2d4ce1cf4778d1dfa GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/CoordinateCorrections.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/CoordinateCorrections.java new file mode 100644 index 0000000000000000000000000000000000000000..f78a936ba49c5fc4daf29237ecb4e86a446316d4 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/CoordinateCorrections.java @@ -0,0 +1,40 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.visuals; + +import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_CONNECTOR_SIZE; + +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.base.ContentAnchorageVisualBase; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.rectangular.RectangularContentVisualBase; +import org.fortiss.tooling.base.layout.DefaultLayoutConstants; + +import javafx.geometry.Dimension2D; + +/** + * This class contains corrections of {@link DefaultLayoutConstants}. + * + * @author hoelzl + */ +class CoordinateCorrections { + /** The insets of the {@link RectangularContentVisualBase}s. */ + /* package */ static final Dimension2D RECTANGLE_INSETS = + new Dimension2D(DEFAULT_CONNECTOR_SIZE / 2, DEFAULT_CONNECTOR_SIZE / 2); + /** The default size of {@link ContentAnchorageVisualBase}s. */ + /* package */ static final Dimension2D ANCHOR_DIMENSION = + new Dimension2D(DEFAULT_CONNECTOR_SIZE, DEFAULT_CONNECTOR_SIZE); + /** The insets of the {@link ContentAnchorageVisualBase}s. */ + /* package */ static final double ANCHOR_INSET = DEFAULT_CONNECTOR_SIZE / 4.5; +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularContentAnchorageVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularContentAnchorageVisualBase.java new file mode 100644 index 0000000000000000000000000000000000000000..aa546c0c9d975972a33cf22682b5d6634e56d271 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularContentAnchorageVisualBase.java @@ -0,0 +1,149 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.visuals; + +import static javafx.scene.paint.Color.BLACK; +import static javafx.scene.paint.Color.rgb; +import static org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_ALLOWED_TAG; +import static org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG; +import static org.fortiss.tooling.base.ui.editor.fx.visuals.CoordinateCorrections.ANCHOR_DIMENSION; +import static org.fortiss.tooling.base.ui.editor.fx.visuals.CoordinateCorrections.ANCHOR_INSET; +import static org.fortiss.tooling.base.ui.utils.LWFXEditorUtils.convertEOrientationToSide; +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectorOffsetOrientation; + +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.layout.ILayout; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.layout.IOffsetLayout; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.layout.ISideLayout; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.elliptic.CircularContentAnchorageVisualBase; +import org.fortiss.tooling.base.model.layout.EOrientation; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.OffsetOrientation; + +import javafx.geometry.Dimension2D; +import javafx.geometry.Point2D; +import javafx.geometry.Rectangle2D; +import javafx.geometry.Side; +import javafx.scene.paint.Color; +import javafx.scene.paint.Paint; + +/** + * {@link CircularContentAnchorageVisualBase} providing a default visual for ports attached to boxes + * in standard boxes-and-wires diagrams based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public abstract class LayoutedCircularContentAnchorageVisualBase + extends CircularContentAnchorageVisualBase implements ISideLayout, IOffsetLayout { + + /** Constructor. */ + public LayoutedCircularContentAnchorageVisualBase(IContentAnchorageMVCBundle mvcb) { + super(mvcb); + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(!(model instanceof ILayoutedModelElement)) { + throw new IllegalArgumentException( + "Expected model of type ILayoutedModelElement, but was " + + model.getClass().getSimpleName() + "."); + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public <T extends ILayout> T getLayout(Class<T> type) { + return (T)this; + } + + /** {@inheritDoc} */ + @Override + public Rectangle2D getModelBounds() { + Point2D locOnParent = getLocationOnParent(); + Dimension2D dim = getDimensions(); + return new Rectangle2D(locOnParent.getX(), locOnParent.getY(), dim.getWidth(), + dim.getHeight()); + } + + /** {@inheritDoc} */ + @Override + public Dimension2D getDimensions() { + return ANCHOR_DIMENSION; + } + + /** {@inheritDoc} */ + @Override + protected double getInset() { + return ANCHOR_INSET; + } + + /** {@inheritDoc} */ + @Override + public double getOffset() { + OffsetOrientation offsetOrientation = getConnectorOffsetOrientation(getLayoutedModelElement()); + double inset = getDimensions().getWidth() / 2; + return offsetOrientation.getOffset() - inset; + } + + /** {@inheritDoc} */ + @Override + public Side getSide() { + // TODO (#3868): Remove null check. + OffsetOrientation offsetOrientation = getConnectorOffsetOrientation(getLayoutedModelElement()); + EOrientation orientation = EOrientation.NORTH; + if(offsetOrientation != null) { + orientation = offsetOrientation.getOrientation(); + } + return convertEOrientationToSide(orientation); + } + + /** {@inheritDoc} */ + @Override + protected Paint getBorderColor() { + return BLACK; + } + + /** {@inheritDoc} */ + @Override + protected double getOpacity() { + return 1.0; + } + + /** {@inheritDoc} */ + @Override + protected double getBorderWidth() { + return 1.0; + } + + /** {@inheritDoc} */ + @Override + protected Color getInteractionColor() { + IContentAnchorageMVCBundle mvcBundle = getMVCBundle(); + if(mvcBundle.hasTag(LINK_TARGET_DENIED_TAG)) { + return rgb(255, 0, 0, .25); + } + if(mvcBundle.hasTag(LINK_TARGET_ALLOWED_TAG)) { + return rgb(0, 255, 0, .25); + } + return super.getInteractionColor(); + } + + /** Return the {@link ILayoutedModelElement}. */ + // TODO(#3877): Implement an equivalent, but generic method in a common base class. + private ILayoutedModelElement getLayoutedModelElement() { + // Safe wild cast due to type check in constructor + return (ILayoutedModelElement)getModel(); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularDiagramAnchorageVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularDiagramAnchorageVisualBase.java new file mode 100644 index 0000000000000000000000000000000000000000..c5cc5fb41777166bc169011324585e51acda04c3 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedCircularDiagramAnchorageVisualBase.java @@ -0,0 +1,115 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.visuals; + +import static javafx.scene.paint.Color.BLACK; +import static javafx.scene.paint.Color.rgb; +import static org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_ALLOWED_TAG; +import static org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG; +import static org.fortiss.tooling.base.ui.editor.fx.visuals.CoordinateCorrections.ANCHOR_DIMENSION; +import static org.fortiss.tooling.base.ui.editor.fx.visuals.CoordinateCorrections.ANCHOR_INSET; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.getNodePosition; + +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.elliptic.CircularDiagramAnchorageVisualBase; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Point; + +import javafx.geometry.Dimension2D; +import javafx.geometry.Rectangle2D; +import javafx.scene.paint.Color; +import javafx.scene.paint.Paint; + +/** + * {@link CircularDiagramAnchorageVisualBase} providing a default visual for diagram ports in + * standard boxes-and-wires diagrams based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public abstract class LayoutedCircularDiagramAnchorageVisualBase + extends CircularDiagramAnchorageVisualBase { + + /** Constructor. */ + public LayoutedCircularDiagramAnchorageVisualBase( + IDiagramAnchorageMVCBundle mvcb) { + super(mvcb); + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(!(model instanceof ILayoutedModelElement)) { + throw new IllegalArgumentException( + "Expected model of type ILayoutedModelElement, but was " + + model.getClass().getSimpleName()); + } + } + + /** {@inheritDoc} */ + @Override + public Rectangle2D getModelBounds() { + Point p = getNodePosition(getLayoutedModelElement()); + Dimension2D dim = getDimensions(); + return new Rectangle2D(p.getX(), p.getY(), dim.getWidth(), dim.getHeight()); + } + + /** {@inheritDoc} */ + @Override + public Dimension2D getDimensions() { + return ANCHOR_DIMENSION; + } + + /** {@inheritDoc} */ + @Override + protected double getInset() { + return ANCHOR_INSET; + } + + /** {@inheritDoc} */ + @Override + protected Paint getBorderColor() { + return BLACK; + } + + /** {@inheritDoc} */ + @Override + protected double getOpacity() { + return 1.0; + } + + /** {@inheritDoc} */ + @Override + protected double getBorderWidth() { + return 1.0; + } + + /** {@inheritDoc} */ + @Override + protected Color getInteractionColor() { + IDiagramAnchorageMVCBundle mvcBundle = getMVCBundle(); + if(mvcBundle.hasTag(LINK_TARGET_DENIED_TAG)) { + return rgb(255, 0, 0, .25); + } + if(mvcBundle.hasTag(LINK_TARGET_ALLOWED_TAG)) { + return rgb(0, 255, 0, .25); + } + return super.getInteractionColor(); + } + + /** Return the {@link ILayoutedModelElement}. */ + // TODO(#3877): Move type checks to a common base class. + private ILayoutedModelElement getLayoutedModelElement() { + // Safe wild cast due to type check in constructor + return (ILayoutedModelElement)getModel(); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedLineLinkVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedLineLinkVisualBase.java new file mode 100644 index 0000000000000000000000000000000000000000..429483c1222a26345fbc3bf5c9b2dbe41c6ad5f1 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedLineLinkVisualBase.java @@ -0,0 +1,117 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.visuals; + +import static java.util.Collections.emptyList; +import static org.fortiss.tooling.base.ui.utils.LWFXEditorUtils.computeLinkToCircleLocation; +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectionPoints; + +import java.util.List; + +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.rectangular.LineLinkVisualBase; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Point; +import org.fortiss.tooling.base.model.layout.Points; + +import javafx.geometry.Rectangle2D; + +/** + * {@link LineLinkVisualBase} providing a default visual for wires in standard + * boxes-and-wires diagrams based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public abstract class LayoutedLineLinkVisualBase extends LineLinkVisualBase { + + /** Constructor. */ + public LayoutedLineLinkVisualBase(ILinkMVCBundle mvcb) { + super(mvcb); + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(!(model instanceof ILayoutedModelElement)) { + throw new IllegalArgumentException( + "Expected model of type ILayoutedModelElement, but was " + + model.getClass().getSimpleName()); + } + } + + /** {@inheritDoc} */ + @Override + public DiagramCoordinate getBendPointLocation(int bpIndex) { + Point point = getBendPointList().get(bpIndex); + return new DiagramCoordinate(point.getX(), point.getY()); + } + + /** {@inheritDoc} */ + @Override + protected DiagramCoordinate getStartAnchorLocation(Rectangle2D anchorBounds, + DiagramCoordinate target) { + return computeLinkToCircleLocation(anchorBounds, target); + } + + /** {@inheritDoc} */ + @Override + protected DiagramCoordinate getEndAnchorLocation(Rectangle2D anchorBounds, + DiagramCoordinate target) { + return computeLinkToCircleLocation(anchorBounds, target); + } + + /** {@inheritDoc} */ + @Override + protected Object getBendPointModel(int i) { + return getBendPointList().get(i); + } + + /** {@inheritDoc} */ + @Override + protected int getNumberOfBendPoints() { + return getBendPointList().size(); + } + + /** Returns the list of bend-points. */ + private List<Point> getBendPointList() { + Points connectionPoints = getConnectionPoints(getLayoutedModelElement()); + if(connectionPoints == null) { + return emptyList(); + } + List<Point> pointList = connectionPoints.getPoints(); + if(pointList == null) { + return emptyList(); + } + return pointList; + } + + /** {@inheritDoc} */ + @Override + protected boolean showArrowOnLastSegment() { + return true; + } + + /** {@inheritDoc} */ + @Override + protected double getInvisibleSelectionLineWidth() { + return 3; + } + + /** Return the {@link ILayoutedModelElement}. */ + // TODO(#3877): Move type checks to a common base class. + private ILayoutedModelElement getLayoutedModelElement() { + // Safe wild cast due to type check in constructor + return (ILayoutedModelElement)getModel(); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedRectangularContentVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedRectangularContentVisualBase.java new file mode 100644 index 0000000000000000000000000000000000000000..d4cd07a8056df99927b160f2d4ce1cf4778d1dfa --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visuals/LayoutedRectangularContentVisualBase.java @@ -0,0 +1,112 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.visuals; + +import static java.lang.Math.min; +import static org.fortiss.tooling.base.ui.editor.fx.visuals.CoordinateCorrections.RECTANGLE_INSETS; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.getNodeBounds; + +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.layout.IOffsetLayout; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.model.layout.ISideLayout; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.IContentAnchorageVisual; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.rectangular.RectangularBorderLocation; +import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.rectangular.RectangularContentVisualBase; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Rectangle; + +import javafx.geometry.Dimension2D; +import javafx.geometry.Rectangle2D; +import javafx.geometry.Side; + +/** + * {@link RectangularContentVisualBase} providing a default visual for boxes in standard + * boxes-and-wires diagrams based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public abstract class LayoutedRectangularContentVisualBase extends RectangularContentVisualBase { + + /** Constructor. */ + public LayoutedRectangularContentVisualBase(IContentMVCBundle mvcb) { + super(mvcb); + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(!(model instanceof ILayoutedModelElement)) { + throw new IllegalArgumentException( + "Expected model of type ILayoutedModelElement, but was " + + model.getClass().getSimpleName()); + } + } + + /** {@inheritDoc} */ + @Override + public Rectangle2D getModelBounds() { + Rectangle rectangle = getNodeBounds(getLayoutedModelElement()); + double insetRadius = RECTANGLE_INSETS.getWidth(); + double insetDiameter = insetRadius * 2; + return new Rectangle2D(rectangle.getX() + insetRadius, rectangle.getY() + insetRadius, + rectangle.getWidth() - insetDiameter, rectangle.getHeight() - insetDiameter); + } + + /** {@inheritDoc} */ + @Override + public DiagramCoordinate getAnchorageLocation(IContentAnchorageVisual visual) { + Rectangle2D contentRectangle = getCurrentBounds(); + Side rectangleSide = visual.getLayout(ISideLayout.class).getSide(); + double sideOffset = visual.getLayout(IOffsetLayout.class).getOffset(); + Dimension2D anchorageDimensions = visual.getDimensions(); + DiagramCoordinate location = new RectangularBorderLocation(rectangleSide, sideOffset, + contentRectangle, anchorageDimensions).getLocation(); + double x = min(location.getX(), + contentRectangle.getWidth() - anchorageDimensions.getWidth() / 2); + double y = min(location.getY(), + contentRectangle.getHeight() - anchorageDimensions.getHeight() / 2); + return new DiagramCoordinate(x, y); + } + + /** {@inheritDoc} */ + @Override + protected double getBorderWidth() { + return 1; + } + + /** {@inheritDoc} */ + @Override + protected double getOpacity() { + return 1.0; + } + + /** {@inheritDoc} */ + @Override + protected boolean requireSelectionForMoveGesture() { + return false; + } + + /** {@inheritDoc} */ + @Override + protected boolean requireSelectionForResizeGesture() { + return false; + } + + /** Return the {@link ILayoutedModelElement}. */ + // TODO(#3877): Move type checks to a common base class. + private ILayoutedModelElement getLayoutedModelElement() { + // Safe wild cast due to type check in constructor + return (ILayoutedModelElement)getModel(); + } +} diff --git a/org.fortiss.tooling.common.ui/.classpath b/org.fortiss.tooling.common.ui/.classpath index bcb5e0f03a41ae289fd0381df83ec7357ced92d2..58729d820ca7fbc879e1a6737fa930dff1cdd2be 100644 --- a/org.fortiss.tooling.common.ui/.classpath +++ b/org.fortiss.tooling.common.ui/.classpath @@ -3,8 +3,8 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="external-src"/> <classpathentry kind="src" path="res"/> - <classpathentry exported="true" kind="lib" path="lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar"/> - <classpathentry exported="true" kind="lib" path="lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar"/> + <classpathentry exported="true" kind="lib" path="lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar"/> + <classpathentry exported="true" kind="lib" path="lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> <attributes> <attribute name="module" value="true"/> diff --git a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF index bbe3b7bdb5fa3732a0d6a16fcdacd11a2bd0044e..b3789de6598a340aca225077277c432abca2a56c 100644 --- a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF @@ -25,8 +25,8 @@ Bundle-ClassPath: ., lib/org.conqat.ide.commons.gef.jar, lib/org.conqat.ide.commons.ui.jar, lib/swt-grouplayout.jar, - lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar, - lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar + lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar, + lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar Export-Package: aerofx, aquafx, jfxtras, diff --git a/org.fortiss.tooling.common.ui/build.properties b/org.fortiss.tooling.common.ui/build.properties index 809b922c3605b1753b73f7f3906f7a9bd53d1aa2..9047dcbc4a556cdf98555184d764e06f30757767 100644 --- a/org.fortiss.tooling.common.ui/build.properties +++ b/org.fortiss.tooling.common.ui/build.properties @@ -6,8 +6,8 @@ bin.includes = .,\ lib/org.conqat.ide.commons.ui.jar,\ lib/swt-grouplayout.jar,\ res/,\ - lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar,\ - lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar + lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar,\ + lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar jars.compile.order = . source.. = src/,\ res/,\ diff --git a/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar b/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar similarity index 84% rename from org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar rename to org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar index f3931238bae4d485625ffda3a204fef1d1b64ece..f657fb4f02b9b01d153b27ac9354b60e4aa82648 100644 Binary files a/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.4.20191111.jar and b/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common.ui_0.0.5.20191126.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar b/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar similarity index 95% rename from org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar rename to org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar index 2d172810cb6ebac59ebfaef25c3283e6729cc099..919bfd21e5e7be75c346982183cdf51085ae7b33 100644 Binary files a/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.4.20191111.jar and b/org.fortiss.tooling.common.ui/lib/org.eclipse.systemfocus.kernel.common_0.0.5.20191126.jar differ