diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings index ef8aadc0677a7162ed8e0097cccf227e2fbd2fc4..33125106f4c061e50d0941a6ae8195d2d1a98822 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings @@ -1,10 +1,15 @@ ContextMenuUtil.java 405387151d45b09dffb3b6ba44f980313c8edcaf GREEN -EObjectDiagramController.java 9af59e8e586c8251d174108a2ce2fcdee5e75782 YELLOW -EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 YELLOW -EObjectRectangularResizableContentControllerBase.java f4a967591a60fadb20550ec3eaabccf240c9ec0d YELLOW -KernelServiceBasedModelChangeProviderBase.java 8d1f8ef79ecd383ff74e5a2bbcf24345aabe70af YELLOW -LayoutModelChangeProvider.java b5449d02eaf39086909720c43e21bd061005fc9e YELLOW -LayoutedContentAnchorageController.java 73b103c06edcbf1762654e71a3e524f43c0c50c0 YELLOW -LayoutedDiagramAnchorageController.java 32d7d77daf252d021458c39ebcfe502f26f29a98 YELLOW -LayoutedLinkBendPointController.java 6d5de856f513ca82eab805a0ad9cda8194be011d YELLOW -LayoutedRectangularResizableContentController.java 3232d423572924363702898cf8ba240ce7042b65 YELLOW +CurvedLinkLayoutedContentAnchorangeController.java 67c20e31ddb82fe2fd499117193353b0545839a0 GREEN +EObjectDiagramController.java 9af59e8e586c8251d174108a2ce2fcdee5e75782 GREEN +EObjectEllipticResizableContentControllerBase.java 3494d4f0dcdff5eb35f22f0e21d04df81b32e494 GREEN +EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN +EObjectRectangularResizableContentControllerBase.java f4a967591a60fadb20550ec3eaabccf240c9ec0d GREEN +KernelServiceBasedModelChangeProviderBase.java 8d1f8ef79ecd383ff74e5a2bbcf24345aabe70af GREEN +LayoutModelChangeProvider.java b5449d02eaf39086909720c43e21bd061005fc9e GREEN +LayoutedContentAnchorageController.java 9fc513a7404277514c730f7702d45588f2d81878 GREEN +LayoutedCurveLinkBendPointController.java 54d7c294c4afaeadb6787408fbfe2ca1958c2de0 GREEN +LayoutedDiagramAnchorageController.java 32d7d77daf252d021458c39ebcfe502f26f29a98 GREEN +LayoutedEllipticResizableContentController.java 93bdeb7ecd5f7386724a9d7df5fff3174ab8ce10 GREEN +LayoutedLineLinkBendPointController.java f5fac4fe8e4b4c0259407acb6bfc80dbe9c3a1fb GREEN +LayoutedLinkBendPointController.java 3203d946de233274934dca1bcd47bbdc1d0a3b13 GREEN +LayoutedRectangularResizableContentController.java 3232d423572924363702898cf8ba240ce7042b65 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java new file mode 100644 index 0000000000000000000000000000000000000000..67c20e31ddb82fe2fd499117193353b0545839a0 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java @@ -0,0 +1,76 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.controller; + +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint; + +import org.fortiss.tooling.base.model.base.EntryConnectorBase; +import org.fortiss.tooling.base.model.base.ExitConnectorBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.DelegatingContentAnchorageController; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle; + +/** + * {@link DelegatingContentAnchorageController} for diagrams with curved links. + * + * @author munaro + */ +public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector & ILayoutedModelElement> + extends LayoutedContentAnchorageController<T> { + + /** Constructor. */ + public CurvedLinkLayoutedContentAnchorangeController(IContentAnchorageMVCBundle mvcb, + Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + protected void link(IMVCBundle startBundle, DiagramCoordinate startLocation, + IMVCBundle endBundle, DiagramCoordinate endLocation) { + super.link(startBundle, startLocation, endBundle, endLocation); + + // Fetch newly created connection by comparing incoming and outgoing connections of the + // given connectors. As only one connection is allowed between a pair of connectors, this + // 'findFirst' is safe. + T startConnector = (T)(startBundle.getModel() instanceof ExitConnectorBase + ? startBundle.getModel() : endBundle.getModel()); + T endConnector = (T)(endBundle.getModel() instanceof EntryConnectorBase + ? endBundle.getModel() : startBundle.getModel()); + IConnection connection = startConnector.getOutgoing().stream() + .filter(segment -> endConnector.getIncoming().contains(segment)).findFirst().get(); + + // Create handles + DiagramCoordinate startPosition = + new DiagramCoordinate(startBundle.getVisual().getCurrentBounds().getMaxX(), + startBundle.getVisual().getCurrentBounds().getMaxY()); + DiagramCoordinate endPosition = + new DiagramCoordinate(endBundle.getVisual().getCurrentBounds().getMaxX(), + endBundle.getVisual().getCurrentBounds().getMaxY()); + DiagramCoordinate middle = + new DiagramCoordinate((startPosition.getX() + endPosition.getX()) / 2, + (startPosition.getY() + endPosition.getY()) / 2); + addConnectionPoint((ILayoutedModelElement)connection, 0, (int)middle.getX(), + (int)middle.getY()); + addConnectionPoint((ILayoutedModelElement)connection, 1, (int)middle.getX(), + (int)middle.getY()); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java new file mode 100644 index 0000000000000000000000000000000000000000..3494d4f0dcdff5eb35f22f0e21d04df81b32e494 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java @@ -0,0 +1,151 @@ +/******************************************************************************* + * Copyright (c) 2017, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * + *******************************************************************************/ +package org.fortiss.tooling.base.ui.editor.fx.controller; + +import static java.lang.Math.max; +import static java.util.Objects.requireNonNull; +import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createElementCompositionContext; +import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu; + +import java.util.List; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.base.model.element.ElementPackage; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures; +import org.fortiss.tooling.common.ui.javafx.lwfxef.change.Change; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IClickController; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.ClickControllerBase; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.elliptic.EllipticResizableContentControllerBase; +import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; +import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; +import org.fortiss.tooling.kernel.service.IElementCompositorService; +import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; +import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; +import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; + +import javafx.scene.Node; +import javafx.scene.control.MenuItem; +import javafx.scene.input.MouseEvent; + +/** + * {@link EllipticResizableContentControllerBase} with a listener mechanism for the layout of the + * connected {@link EObject model element}. + * + * @author hoelzl + */ +public abstract class EObjectEllipticResizableContentControllerBase<T extends EObject> + extends EllipticResizableContentControllerBase { + /** {@link IModelChangeProvider} for this controller */ + private final LayoutModelChangeProvider layoutModelChangeProvider; + /** The click controller handling double-click to open editor. */ + private final IClickController openEditorDoubleClickController = new ClickControllerBase() { + @Override + public Change singleClick(MouseEvent event, Node node, DiagramCoordinate diagramLocation) { + return EObjectEllipticResizableContentControllerBase.super.getClickController(node, + diagramLocation).singleClick(event, node, diagramLocation); + } + + @Override + public Change secondaryClick(MouseEvent event, Node node, + DiagramCoordinate diagramLocation) { + return EObjectEllipticResizableContentControllerBase.super.getClickController(node, + diagramLocation).secondaryClick(event, node, diagramLocation); + } + + @Override + public Change doubleClick(MouseEvent event, Node node, DiagramCoordinate diagramLocation) { + EObject eo = getModelElement(); + IModelElementHandler<EObject> handler = + IModelElementHandlerService.getInstance().getModelElementHandler(eo); + if(handler != null) { + eo = handler.handleOpenModelElementRequest(eo); + } + IModelEditorBindingService.getInstance().openInEditor(eo); + return null; // no changes to model + } + }; + + /** Constructor. */ + public EObjectEllipticResizableContentControllerBase(IContentMVCBundle mvcb, + Class<T> modelType) { + super(mvcb); + + Object model = requireNonNull(mvcb.getModel(), "The given model is null!"); + if(!modelType.isAssignableFrom(model.getClass())) { + throw new IllegalArgumentException("Expected model of type " + + modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); + } + + ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); + this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme) { + /** {@inheritDoc} */ + @Override + protected boolean acceptNotification(Notification notification) { + if(notification.getNotifier() != getModelElement()) { + return false; + } + return isAnchorageFeature(notification.getFeature()); + } + }; + } + + /** Returns the correctly casted model element. */ + @SuppressWarnings("unchecked") + protected T getModelElement() { + // wild cast works: see constructor check with exception + return (T)getModel(); + } + + /** {@inheritDoc} */ + @Override + public IModelChangeProvider getModelChangeProvider() { + return layoutModelChangeProvider; + } + + /** {@inheritDoc} */ + @Override + public List<MenuItem> contextMenuContributions(Node node, DiagramCoordinate diagramLocation) { + // outer-most grid areas of the diagram are inaccessible + DiagramViewerFeatures features = getViewer().getFeatures(); + double x = max(features.getHorizontalSpacing(), diagramLocation.getX()); + double y = max(features.getVerticalSpacing(), diagramLocation.getY()); + + // wild cast works: see constructor exception + EObject modelParent = (EObject)getModel(); + IElementCompositionContext edc = createElementCompositionContext(modelParent, x, y, false, + getViewer().getFeatures().getCurrentZoomFactor()); + return createPrototypeMenu(modelParent, edc); + } + + /** {@inheritDoc} */ + @Override + public void delete() { + IElementCompositorService.getInstance().decompose(getModelElement()); + } + + /** Checks whether the given feature corresponds to an anchorage model element. */ + protected boolean isAnchorageFeature(Object feature) { + return feature == ElementPackage.Literals.IHIERARCHIC_ELEMENT__CONNECTORS; + } + + /** {@inheritDoc} */ + @Override + public IClickController getClickController(Node node, DiagramCoordinate diagramLocation) { + return openEditorDoubleClickController; + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java index 73b103c06edcbf1762654e71a3e524f43c0c50c0..9fc513a7404277514c730f7702d45588f2d81878 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java @@ -30,8 +30,7 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IElementCompositorService; /** - * {@link DelegatingContentAnchorageController} for - * {@link org.fortiss.tooling.base.model.layout.ILayoutedModelElement}s. + * {@link DelegatingContentAnchorageController} for {@link ILayoutedModelElement}s. * * @author hoelzl */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java new file mode 100644 index 0000000000000000000000000000000000000000..54d7c294c4afaeadb6787408fbfe2ca1958c2de0 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java @@ -0,0 +1,111 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.controller; + +import static java.util.Arrays.asList; +import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createPoint; +import static org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange.locationFeedbackChange; + +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Point; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures; +import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.ILinkVisual; + +import javafx.geometry.Point2D; + +/** + * {@link IController} for {@link ILayoutedModelElement}s representing curved links and connections + * in a {@link DiagramViewer}. + * + * @author munaro + */ +public class LayoutedCurveLinkBendPointController<T extends ILayoutedModelElement> + extends LayoutedLinkBendPointController<T> { + + /** Constructor. */ + public LayoutedCurveLinkBendPointController(ILinkMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + @Override + protected final void createBendPointAt(int bpIndex, DiagramCoordinate location) { + DiagramViewerFeatures features = getViewer().getFeatures(); + Point c2 = createPoint((int)(location.getX() - 2 * features.getHorizontalSpacing()), + (int)location.getY(), null); + Point c1 = createPoint((int)(location.getX() + 2 * features.getHorizontalSpacing()), + (int)location.getY(), null); + Point bp = createPoint((int)location.getX(), (int)location.getY(), null); + getBendPointList(getModelElement()).addAll(bpIndex - 1, asList(c2, bp, c1)); + } + + /** {@inheritDoc} */ + @Override + protected final void moveBendPointVisually(int bpIndex, Point2D delta) { + super.moveBendPointVisually(bpIndex, delta); + if(bpIndex <= 0 || bpIndex >= getNumerOfBendPoints() - 1) { + // first and last bend-point move unconnected + return; + } + ILinkVisual linkVisual = getLinkVisual(); + FeedbackChange centerPointChange = getMoveDeltaFeedback(bpIndex, delta); + int indexMod3 = bpIndex % 3; + if(indexMod3 == 2) { + // bend-points between curve segments also drag the previous and next point + linkVisual.setFeedbackChangeForBendPoint(bpIndex - 1, centerPointChange); + linkVisual.setFeedbackChangeForBendPoint(bpIndex + 1, centerPointChange); + } else { + // otherwise the connected bend-point is moved in the opposite direction + FeedbackChange inv = locationFeedbackChange(-centerPointChange.getDeltaX(), + -centerPointChange.getDeltaY()); + int otherIndex = (indexMod3 == 1) ? bpIndex + 2 : bpIndex - 2; + linkVisual.setFeedbackChangeForBendPoint(otherIndex, inv); + } + // linkVisual.update(); + return; + } + + /** {@inheritDoc} */ + @Override + protected final void moveBendPointInModel(int bpIndex, Point2D delta) { + FeedbackChange chg = getMoveDeltaFeedback(bpIndex, delta); + getLinkVisual().setFeedbackChangeForBendPoint(bpIndex, null); + updateModelAfterBendPointMove(bpIndex, chg.getDeltaX(), chg.getDeltaY()); + if(bpIndex <= 0 || bpIndex >= getNumerOfBendPoints() - 1) { + // first and last bend-point move unconnected + return; + } + ILinkVisual linkVisual = getLinkVisual(); + int indexMod3 = bpIndex % 3; + if(indexMod3 == 2) { + // bend-points between curve segments also drag the previous and next point + linkVisual.setFeedbackChangeForBendPoint(bpIndex - 1, null); + updateModelAfterBendPointMove(bpIndex - 1, chg.getDeltaX(), chg.getDeltaY()); + linkVisual.setFeedbackChangeForBendPoint(bpIndex + 1, null); + updateModelAfterBendPointMove(bpIndex + 1, chg.getDeltaX(), chg.getDeltaY()); + } else { + // otherwise the connected bend-point is moved in the opposite direction + int otherIndex = (indexMod3 == 1) ? bpIndex + 2 : bpIndex - 2; + linkVisual.setFeedbackChangeForBendPoint(otherIndex, null); + updateModelAfterBendPointMove(otherIndex, -chg.getDeltaX(), -chg.getDeltaY()); + } + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java new file mode 100644 index 0000000000000000000000000000000000000000..93bdeb7ecd5f7386724a9d7df5fff3174ab8ce10 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java @@ -0,0 +1,84 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.controller; + +import static java.lang.Math.toRadians; +import static java.util.Objects.requireNonNull; +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.setConnectorAngle; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.getNodeSize; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodeSize; + +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.base.model.layout.Dimension; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; + +/** + * {@link IController} for {@link ILayoutedModelElement}s that have a elliptical shape. + * + * @author munaro + */ +public class LayoutedEllipticResizableContentController<T extends ILayoutedModelElement> + extends EObjectEllipticResizableContentControllerBase<T> { + + /** Constructor */ + public LayoutedEllipticResizableContentController(IContentMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + + Object model = requireNonNull(mvcb.getModel(), "The given model is null!"); + if(!modelType.isAssignableFrom(model.getClass())) { + throw new IllegalArgumentException("Expected model of type " + + modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); + } + } + + /** {@inheritDoc} */ + @Override + protected void moveAnchorageToAngle(IContentAnchorageMVCBundle anchorage, + double angleInDegree) { + Object connObj = anchorage.getModel(); + if(connObj instanceof IConnector && connObj instanceof ILayoutedModelElement) { + ILayoutedModelElement conn = (ILayoutedModelElement)connObj; + setConnectorAngle(conn, toRadians(angleInDegree)); + } + } + + /** {@inheritDoc} */ + @Override + protected void move(FeedbackChange deltaChange) { + moveNode(getModelElement(), (int)deltaChange.getDeltaX(), (int)deltaChange.getDeltaY()); + } + + /** {@inheritDoc} */ + @Override + protected boolean allowLink() { + return false; + } + + /** {@inheritDoc} */ + @Override + protected void resize(FeedbackChange delta) { + T element = getModelElement(); + Dimension d = getNodeSize(element); + int w = d.getWidth() + (int)delta.getDeltaW(); + int h = d.getHeight() + (int)delta.getDeltaH(); + setNodeSize(element, w, h); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java new file mode 100644 index 0000000000000000000000000000000000000000..f5fac4fe8e4b4c0259407acb6bfc80dbe9c3a1fb --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2017, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * + *******************************************************************************/ +package org.fortiss.tooling.base.ui.editor.fx.controller; + +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint; + +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer; +import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; + +/** + * {@link IController} for {@link ILayoutedModelElement}s representing straight links and + * connections in a {@link DiagramViewer}. + * + * @author hoelzl + */ +public class LayoutedLineLinkBendPointController<T extends ILayoutedModelElement> + extends LayoutedLinkBendPointController<T> { + + /** Constructor. */ + public LayoutedLineLinkBendPointController(ILinkMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + @Override + protected void createBendPointAt(int bpIndex, DiagramCoordinate location) { + int x = (int)location.getX(); + int y = (int)location.getY(); + addConnectionPoint(getModelElement(), bpIndex, x, y); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java index 6d5de856f513ca82eab805a0ad9cda8194be011d..3203d946de233274934dca1bcd47bbdc1d0a3b13 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java @@ -1,47 +1,59 @@ -/******************************************************************************* - * Copyright (c) 2017, 2018 fortiss GmbH. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v2.0 which is available at - * http://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Florian Hoelzl (fortiss GmbH) - initial implementation - * - *******************************************************************************/ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.controller; import static java.util.Objects.requireNonNull; -import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint; import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectionPoints; import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.removeConnectionPoint; import java.util.List; import org.eclipse.emf.common.util.EList; -import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Point; import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.LinkControllerBase; import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle; -import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; -import org.fortiss.tooling.base.model.layout.Point; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; /** - * {@link IController} for {@link ILayoutedModelElement}s representing links and connections in a - * {@link DiagramViewer}. + * Base class for {@link IController}s for {@link ILayoutedModelElement}s representing links and + * connections in a {@link DiagramViewer}. * - * @author hoelzl + * @author munaro */ -public class LayoutedLinkBendPointController<T extends ILayoutedModelElement> +public abstract class LayoutedLinkBendPointController<T extends ILayoutedModelElement> extends LinkControllerBase { /** {@link IModelChangeProvider} for this controller */ - private final LayoutModelChangeProvider layoutModelChangeProvider; + protected final LayoutModelChangeProvider layoutModelChangeProvider; + + /** Returns the model element. */ + @SuppressWarnings("unchecked") + public T getModelElement() { + return (T)getModel(); + } + + /** {@inheritDoc} */ + @Override + public IModelChangeProvider getModelChangeProvider() { + return layoutModelChangeProvider; + } /** Constructor. */ public LayoutedLinkBendPointController(ILinkMVCBundle mvcb, Class<T> modelType) { @@ -57,10 +69,10 @@ public class LayoutedLinkBendPointController<T extends ILayoutedModelElement> this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme); } - /** Returns the model element. */ - @SuppressWarnings("unchecked") - public T getModelElement() { - return (T)getModel(); + /** {@inheritDoc} */ + @Override + public void delete() { + deleteLink(); } /** {@inheritDoc} */ @@ -79,27 +91,8 @@ public class LayoutedLinkBendPointController<T extends ILayoutedModelElement> /** {@inheritDoc} */ @Override - public IModelChangeProvider getModelChangeProvider() { - return layoutModelChangeProvider; - } - - /** {@inheritDoc} */ - @Override - protected int getNumerOfBendPoints() { - return getBendPointList(getModelElement()).size(); - } - - /** Returns the list of bend-points. */ - private EList<Point> getBendPointList(ILayoutedModelElement modelElement) { - return getConnectionPoints(modelElement).getPoints(); - } - - /** {@inheritDoc} */ - @Override - protected void createBendPointAt(int bpIndex, DiagramCoordinate location) { - int x = (int)location.getX(); - int y = (int)location.getY(); - addConnectionPoint(getModelElement(), bpIndex, x, y); + protected void deleteBendPoint(int bpIndex) { + removeConnectionPoint(getModelElement(), bpIndex); } /** {@inheritDoc} */ @@ -117,8 +110,8 @@ public class LayoutedLinkBendPointController<T extends ILayoutedModelElement> /** {@inheritDoc} */ @Override - protected void deleteBendPoint(int bpIndex) { - removeConnectionPoint(getModelElement(), bpIndex); + protected void deleteLink() { + IConnectionCompositorService.getInstance().disconnect(getModelElement()); } /** {@inheritDoc} */ @@ -128,15 +121,14 @@ public class LayoutedLinkBendPointController<T extends ILayoutedModelElement> // ignored } - /** {@inheritDoc} */ - @Override - protected void deleteLink() { - IConnectionCompositorService.getInstance().disconnect(getModelElement()); + /** Returns the list of bend-points. */ + protected EList<Point> getBendPointList(ILayoutedModelElement modelElement) { + return getConnectionPoints(modelElement).getPoints(); } /** {@inheritDoc} */ @Override - public void delete() { - deleteLink(); + protected int getNumerOfBendPoints() { + return getBendPointList(getModelElement()).size(); } } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/model/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/model/.ratings index e486bea097082450923a8577024abfdd76030929..c383bdc481a671fd2afae32b91f7634ba932a2a2 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/model/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/model/.ratings @@ -1 +1 @@ -HierarchicElementModelFactoryBase.java 10741fec431df8c05038e73b6b40ba9c7c35fa57 YELLOW +HierarchicElementModelFactoryBase.java 10741fec431df8c05038e73b6b40ba9c7c35fa57 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings index a7dd2ab254be3d36a5e8d5b555f759f9f3f9568e..ae3ce00b4dfec253e3adc2a33e0b985e930fce56 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings @@ -1,9 +1,13 @@ -CoordinateCorrections.java 018bf229e5686afcb8540b61dd9d05b6e4a23e93 YELLOW -LayoutedCircularAnchorageContentVisualBase.java dba8ae04ecd5813aae9b29eaccea520caa3cf237 YELLOW -LayoutedCircularAnchorageDiagramVisualBase.java 7634416bcb88a014d985143bf00a8d29ff1e3ff5 YELLOW -LayoutedLineLinkVisual.java ff1291c57d4ce111d5543d7381a616cd2e096290 YELLOW -LayoutedRectangularContentVisualBase.java 61698ffd771ee2ad798025df8195d1bc09c2c765 YELLOW -NamedLayoutedCircularAnchorageContentVisual.java bf06ac6e93d78e98b0359e0f879dccaefc920aa0 YELLOW -NamedLayoutedCircularAnchorageDiagramVisual.java 53b9d739587d658f65dc03517257d6e29f4ba1fa YELLOW -NamedLayoutedLineLinkVisual.java 60f5d21f0723dc5d08b2ad43bc6361fca83a16aa YELLOW -NamedLayoutedRectangularContentVisual.java 8cdc55b306c1db60074fa8c5c240f95d892e1e32 YELLOW +CoordinateCorrections.java 018bf229e5686afcb8540b61dd9d05b6e4a23e93 GREEN +LayoutedCircularAnchorageContentVisualBase.java cd85ff478e9b8e6b6d6f6c75cc5bf61522a63f3e GREEN +LayoutedCircularAnchorageDiagramVisualBase.java 7634416bcb88a014d985143bf00a8d29ff1e3ff5 GREEN +LayoutedCurveLinkVisual.java 5b06cd7e80eaf7cf6af37a4769eaafe2a1e591f3 GREEN +LayoutedEllipticContentVisualBase.java 6f3daf386d5120793b90ce4569dd9bea33dd2a0f GREEN +LayoutedLineLinkVisual.java 5fc26086e2f63afee403379ba8f09f5113d4c025 GREEN +LayoutedRectangularContentVisualBase.java 61698ffd771ee2ad798025df8195d1bc09c2c765 GREEN +NamedLayoutedCircularAnchorageContentVisual.java bf06ac6e93d78e98b0359e0f879dccaefc920aa0 GREEN +NamedLayoutedCircularAnchorageDiagramVisual.java 53b9d739587d658f65dc03517257d6e29f4ba1fa GREEN +NamedLayoutedCurveLinkVisual.java 7945b2f550d5e4804f44891294ee60cc8ffcbf1e GREEN +NamedLayoutedEllipticContentVisual.java f96a956c2f71b675eee56cfc613684397545da68 GREEN +NamedLayoutedLineLinkVisual.java 4fc48616000516dc90ba22b7069ffdabadc9c377 GREEN +NamedLayoutedRectangularContentVisual.java 8cdc55b306c1db60074fa8c5c240f95d892e1e32 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java index dba8ae04ecd5813aae9b29eaccea520caa3cf237..cd85ff478e9b8e6b6d6f6c75cc5bf61522a63f3e 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java @@ -15,23 +15,26 @@ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.base.ui.editor.fx.visual; +import static java.lang.Math.toDegrees; import static javafx.scene.paint.Color.BLACK; import static javafx.scene.paint.Color.rgb; -import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_ALLOWED_TAG; -import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG; import static org.fortiss.tooling.base.ui.editor.fx.visual.CoordinateCorrections.ANCHOR_DIMENSION; import static org.fortiss.tooling.base.ui.editor.fx.visual.CoordinateCorrections.ANCHOR_INSET; import static org.fortiss.tooling.base.ui.utils.LWFXEditorUtils.convertEOrientationToSide; +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectorAngleAsDouble; import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectorOffsetOrientation; +import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_ALLOWED_TAG; +import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG; +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 org.fortiss.tooling.common.ui.javafx.lwfxef.model.layout.IAngleLayout; import org.fortiss.tooling.common.ui.javafx.lwfxef.model.layout.ILayout; import org.fortiss.tooling.common.ui.javafx.lwfxef.model.layout.IOffsetLayout; import org.fortiss.tooling.common.ui.javafx.lwfxef.model.layout.ISideLayout; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.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; @@ -47,7 +50,8 @@ import javafx.scene.paint.Paint; * @author munaro */ public abstract class LayoutedCircularAnchorageContentVisualBase<T extends ILayoutedModelElement> - extends CircularContentAnchorageVisualBase implements ISideLayout, IOffsetLayout { + extends CircularContentAnchorageVisualBase + implements ISideLayout, IOffsetLayout, IAngleLayout { /** Constructor. */ public LayoutedCircularAnchorageContentVisualBase(IContentAnchorageMVCBundle mvcb, @@ -149,4 +153,10 @@ public abstract class LayoutedCircularAnchorageContentVisualBase<T extends ILayo } return super.getInteractionColor(); } + + /** {@inheritDoc} */ + @Override + public double getAngleInDegree() { + return toDegrees(getConnectorAngleAsDouble(getModelElement())); + } } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCurveLinkVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCurveLinkVisual.java new file mode 100644 index 0000000000000000000000000000000000000000..5b06cd7e80eaf7cf6af37a4769eaafe2a1e591f3 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCurveLinkVisual.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * + *******************************************************************************/ +package org.fortiss.tooling.base.ui.editor.fx.visual; + +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.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Point; +import org.fortiss.tooling.base.model.layout.Points; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.elliptic.CurveLinkVisualBase; + +import javafx.geometry.Point2D; +import javafx.geometry.Rectangle2D; + +/** + * {@link CurveLinkVisualBase} providing a default visual for wires in ellipses-and-wires diagrams + * based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public class LayoutedCurveLinkVisual<T extends ILayoutedModelElement> extends CurveLinkVisualBase { + /** Constructor. */ + public LayoutedCurveLinkVisual(ILinkMVCBundle mvcb, Class<T> modelType) { + super(mvcb); + + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(model == null) { + throw new IllegalArgumentException("The given model is null!"); + } + if(!modelType.isAssignableFrom(model.getClass())) { + throw new IllegalArgumentException("Expected model of type " + + modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); + } + } + + /** Returns the model element with the expected type. */ + @SuppressWarnings("unchecked") + protected T getModelElement() { + return (T)getModel(); + } + + /** {@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, Point2D target) { + return computeLinkToCircleLocation(anchorBounds, target); + } + + /** {@inheritDoc} */ + @Override + protected DiagramCoordinate getEndAnchorLocation(Rectangle2D anchorBounds, Point2D 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(getModelElement()); + if(connectionPoints == null) { + return emptyList(); + } + List<Point> pointList = connectionPoints.getPoints(); + if(pointList == null) { + return emptyList(); + } + return pointList; + } + + /** {@inheritDoc} */ + @Override + protected double getFeedbackMarkerSize() { + return 10; + } + + /** {@inheritDoc} */ + @Override + protected boolean showArrowOnLastSegment() { + return true; + } + + /** {@inheritDoc} */ + @Override + protected double getInvisibleSelectionLineWidth() { + return 7; + } + + /** {@inheritDoc} */ + @Override + protected double getArrowLength() { + return 7; + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedEllipticContentVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedEllipticContentVisualBase.java new file mode 100644 index 0000000000000000000000000000000000000000..6f3daf386d5120793b90ce4569dd9bea33dd2a0f --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedEllipticContentVisualBase.java @@ -0,0 +1,101 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.visual; + +import static javafx.scene.paint.Color.BLACK; +import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_CONNECTOR_SIZE; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.getNodeBounds; + +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.base.model.layout.Rectangle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.elliptic.EllipticContentVisualBase; + +import javafx.geometry.Rectangle2D; +import javafx.scene.paint.Paint; + +/** + * {@link EllipticContentVisualBase} providing a default visual for ellipses in ellipses-and-wires + * diagrams based on {@link ILayoutedModelElement}s. + * + * @author munaro + */ +public abstract class LayoutedEllipticContentVisualBase<T extends ILayoutedModelElement> + extends EllipticContentVisualBase { + + /** Constructor. */ + public LayoutedEllipticContentVisualBase(IContentMVCBundle mvcb, Class<T> modelType) { + super(mvcb); + + // TODO(#3877): Move type checks to a common base class. + Object model = mvcb.getModel(); + if(model == null) { + throw new IllegalArgumentException("The given model is null!"); + } + if(!modelType.isAssignableFrom(model.getClass())) { + throw new IllegalArgumentException("Expected model of type " + + modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); + } + } + + /** Returns the model element with the specified type. */ + // TODO(#3877): Move type checks to a common base class. + @SuppressWarnings("unchecked") + protected T getModelElement() { + // Safe wild cast due to type check in constructor + return (T)getModel(); + } + + /** {@inheritDoc} */ + @Override + public Rectangle2D getModelBounds() { + Rectangle r = getNodeBounds(getModelElement()); + double dc = DEFAULT_CONNECTOR_SIZE / 2 - 2; + double dc2 = 2 * dc; + return new Rectangle2D(r.getX() + dc, r.getY() + dc, r.getWidth() - dc2, + r.getHeight() - dc2); + } + + /** {@inheritDoc} */ + @Override + protected Paint getBorderColor() { + return BLACK; + } + + /** {@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; + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedLineLinkVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedLineLinkVisual.java index ff1291c57d4ce111d5543d7381a616cd2e096290..5fc26086e2f63afee403379ba8f09f5113d4c025 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedLineLinkVisual.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedLineLinkVisual.java @@ -36,11 +36,7 @@ import javafx.geometry.Rectangle2D; * * @author munaro */ -// TODO (TM): As this class already requires the generic type to implement INamedElement -// NamedLayoutedLineLinkVisual becomes useless. Remove INamedElement here and make class -// abstract (consistent with the other Layouted*VisualBase classes) -public abstract class LayoutedLineLinkVisual<T extends ILayoutedModelElement> - extends LineLinkVisualBase { +public class LayoutedLineLinkVisual<T extends ILayoutedModelElement> extends LineLinkVisualBase { /** Constructor. */ public LayoutedLineLinkVisual(ILinkMVCBundle mvcb, Class<T> modelType) { diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCurveLinkVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCurveLinkVisual.java new file mode 100644 index 0000000000000000000000000000000000000000..7945b2f550d5e4804f44891294ee60cc8ffcbf1e --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCurveLinkVisual.java @@ -0,0 +1,43 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.visual; + +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; +import org.fortiss.tooling.kernel.model.INamedElement; + +/** + * {@link IVisual} for layouted and named curved links within a diagram. Typically, those are + * {@link IConnection}s. + * + * @author munaro + */ +public class NamedLayoutedCurveLinkVisual<T extends INamedElement & ILayoutedModelElement> + extends LayoutedCurveLinkVisual<T> { + + /** Constructor. */ + public NamedLayoutedCurveLinkVisual(ILinkMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + @Override + protected String getLabelText(int currentSegment, int lastSegment) { + return getModelElement().getName(); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedEllipticContentVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedEllipticContentVisual.java new file mode 100644 index 0000000000000000000000000000000000000000..f96a956c2f71b675eee56cfc613684397545da68 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedEllipticContentVisual.java @@ -0,0 +1,40 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.visual; + +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; +import org.fortiss.tooling.kernel.model.INamedElement; + +/** + * {@link LayoutedEllipticContentVisualBase} that defines its name. + * + * @author munaro + */ +public class NamedLayoutedEllipticContentVisual<T extends INamedElement & ILayoutedModelElement> + extends LayoutedEllipticContentVisualBase<T> { + + /** Constructor. */ + public NamedLayoutedEllipticContentVisual(IContentMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + @Override + protected String getName() { + return getModelElement().getName(); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedLineLinkVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedLineLinkVisual.java index 60f5d21f0723dc5d08b2ad43bc6361fca83a16aa..4fc48616000516dc90ba22b7069ffdabadc9c377 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedLineLinkVisual.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedLineLinkVisual.java @@ -15,19 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.base.ui.editor.fx.visual; -import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; -import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; import org.fortiss.tooling.base.model.element.IConnection; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; import org.fortiss.tooling.kernel.model.INamedElement; /** - * {@link IVisual} for layouted and named links within a diagram. Typically, those are + * {@link IVisual} for layouted and named straight links within a diagram. Typically, those are * {@link IConnection}s. * * @author diewald */ -// TODO (TM): See comment in LayoutedLineLinkVisual public class NamedLayoutedLineLinkVisual<T extends INamedElement & ILayoutedModelElement> extends LayoutedLineLinkVisual<T> { diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings index d2fc13e9d443fbc1e3005b3723a68a1c72519d3a..673e0fc6505e31b30d19bf9937d831e8cbecb282 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings @@ -4,7 +4,7 @@ DragAndDropBaseUtils.java d375377f9124f6113b2a295e6b0e09ac8966e564 GREEN EllipseLayoutUIUtils.java 4dd9dbd96a45e8c455c019caa19e4a50f18336af GREEN FontUtils.java a167a05bdaa8da9853705cc5134f30f6d81bc9f2 GREEN GCStateManager.java 983973a92376b5c757c1253b32e33d0666ccdf7b GREEN -LWFXEditorUtils.java c624d3f0f6487b6d426b168dad048b2c39e71114 YELLOW +LWFXEditorUtils.java c624d3f0f6487b6d426b168dad048b2c39e71114 GREEN LayoutDataUIUtils.java c85886ac313a6efb122532218eb134047ffd6631 GREEN PropertiesViewUtils.java d345b4501c4092228edf1c98e0189317d53aaf22 GREEN RectangleLayoutUIUtils.java ef4b872bb5b4a51174e9a29d9ef05e7cb3bff3a1 GREEN diff --git a/org.fortiss.tooling.base/model/.ratings b/org.fortiss.tooling.base/model/.ratings index a14484332c6f194fa6e1e2dc001bc8a240b3aa5b..176d4ad2d4b8aeb0a19dadedde7fe5ffdafe724e 100644 --- a/org.fortiss.tooling.base/model/.ratings +++ b/org.fortiss.tooling.base/model/.ratings @@ -1 +1 @@ -base.ecore 6ba521f3458eaf64fc3ee0359e236c9a1201d259 YELLOW +base.ecore 6ba521f3458eaf64fc3ee0359e236c9a1201d259 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings index daf51f54143284826e353c054984aacc6c4ed77a..c412a38af52a0cbcdfa85489641d51605592d9d2 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings @@ -1,12 +1,12 @@ -DiagramCoordinate.java 6b00aec99054d4cd19003a72bd4e5e774ac6a641 YELLOW -DiagramLayers.java 155cbb47a5f0aaa0025320ae607e6777f3a2d2e8 YELLOW -DiagramViewer.java d5ba3f45ddc619132434f9cbefd36f65cce18b65 YELLOW -DiagramViewerDefaultTags.java 6230763252409c60009ab8887b4ef582cf883229 YELLOW -DiagramViewerFeatures.java 31e3fb61f915b0d8695005b083c47ce1c5be0b05 YELLOW -DiagramViewerSelection.java e833f592543bc97077907d980a39b123fc4044e6 YELLOW -EDragGesture.java 5cfa098d3877db11981c2750e5e103156d62fc5e YELLOW -FeedbackChange.java b088fa89af648f1674f2f9c1f7f99d585ce801ca YELLOW -GridCanvasVisual.java 734027d56af342cd01ff445ba9347b8dbb6c83c2 YELLOW -MVCBundleManager.java 2b4ab114c55b30a3d98d7135458f8f3ddd244d58 YELLOW -MouseState.java ff90af6d1cca427ef6f3fded76367b535120a5df YELLOW -SVGExporter.java 2211f06d81c7b0523ae52dc832410a76875a9e07 YELLOW +DiagramCoordinate.java 6b00aec99054d4cd19003a72bd4e5e774ac6a641 GREEN +DiagramLayers.java 155cbb47a5f0aaa0025320ae607e6777f3a2d2e8 GREEN +DiagramViewer.java e7c550be6443f798ba9399a35ab3059033a33e59 RED +DiagramViewerDefaultTags.java 6230763252409c60009ab8887b4ef582cf883229 GREEN +DiagramViewerFeatures.java 31e3fb61f915b0d8695005b083c47ce1c5be0b05 GREEN +DiagramViewerSelection.java e833f592543bc97077907d980a39b123fc4044e6 GREEN +EDragGesture.java 5cfa098d3877db11981c2750e5e103156d62fc5e GREEN +FeedbackChange.java b088fa89af648f1674f2f9c1f7f99d585ce801ca GREEN +GridCanvasVisual.java 734027d56af342cd01ff445ba9347b8dbb6c83c2 GREEN +MVCBundleManager.java 2b4ab114c55b30a3d98d7135458f8f3ddd244d58 GREEN +MouseState.java ff90af6d1cca427ef6f3fded76367b535120a5df GREEN +SVGExporter.java 2211f06d81c7b0523ae52dc832410a76875a9e07 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewer.java index d5ba3f45ddc619132434f9cbefd36f65cce18b65..e7c550be6443f798ba9399a35ab3059033a33e59 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewer.java @@ -9,6 +9,7 @@ *******************************************************************************/ package org.fortiss.tooling.common.ui.javafx.lwfxef; +import static java.lang.Math.abs; import static java.lang.Math.ceil; import static java.lang.Math.max; import static java.lang.Math.min; @@ -117,6 +118,7 @@ public class DiagramViewer { // selection feedback rectangle mouseDragRectangle.setFill(Color.TRANSPARENT); mouseDragRectangle.setStroke(Color.ORANGERED); + // TODO (SB): Magic constant mouseDragRectangle.getStrokeDashArray().addAll(15.0, 5.0); mouseDragRectangle.setMouseTransparent(true); // viewer pane @@ -556,13 +558,13 @@ public class DiagramViewer { return; } Point2D location = locationInDiagram; - double x = Math.min(mouseDragRectangleStartLocation.getX(), location.getX()); + double x = min(mouseDragRectangleStartLocation.getX(), location.getX()); mouseDragRectangle.setX(x); - double w = Math.abs(mouseDragRectangleStartLocation.getX() - location.getX()); + double w = abs(mouseDragRectangleStartLocation.getX() - location.getX()); mouseDragRectangle.setWidth(w); - double y = Math.min(mouseDragRectangleStartLocation.getY(), location.getY()); + double y = min(mouseDragRectangleStartLocation.getY(), location.getY()); mouseDragRectangle.setY(y); - double h = Math.abs(mouseDragRectangleStartLocation.getY() - location.getY()); + double h = abs(mouseDragRectangleStartLocation.getY() - location.getY()); mouseDragRectangle.setHeight(h); } @@ -572,10 +574,10 @@ public class DiagramViewer { return; } Point2D location = locationInDiagram; - double x = Math.min(mouseDragRectangleStartLocation.getX(), location.getX()); - double w = Math.abs(mouseDragRectangleStartLocation.getX() - location.getX()); - double y = Math.min(mouseDragRectangleStartLocation.getY(), location.getY()); - double h = Math.abs(mouseDragRectangleStartLocation.getY() - location.getY()); + double x = min(mouseDragRectangleStartLocation.getX(), location.getX()); + double w = abs(mouseDragRectangleStartLocation.getX() - location.getX()); + double y = min(mouseDragRectangleStartLocation.getY(), location.getY()); + double h = abs(mouseDragRectangleStartLocation.getY() - location.getY()); layers.getVisualFeedbackLayer().remove(mouseDragRectangle); Rectangle2D selectionRect = new Rectangle2D(x, y, w, h); // remove old selection diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/change/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/change/.ratings index 1758ea0a359923dd644757977226edcf4ad6064a..4dd6266d7ad3b29bc193f6055fe20be8435d5334 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/change/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/change/.ratings @@ -1,3 +1,3 @@ -Change.java e907a516f1369013cbb3d5d002b1ddb69cd5cc25 YELLOW -ChangeSet.java 363c4fcdad1709e6f7ccad4205a53b22c976b50d YELLOW -DefaultModelModifier.java bfa32a76ce226ec84a173201553b87d6317b84b1 YELLOW +Change.java e907a516f1369013cbb3d5d002b1ddb69cd5cc25 GREEN +ChangeSet.java 363c4fcdad1709e6f7ccad4205a53b22c976b50d GREEN +DefaultModelModifier.java bfa32a76ce226ec84a173201553b87d6317b84b1 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/.ratings index b36ac7444c8875c8a6f059a120545746e2acdf95..cfa9cb5656d6c4b10625c7f4b9a179d3c7efe731 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/.ratings @@ -1,5 +1,5 @@ -IClickController.java c0270e99d918aef14612d46f3e84905d3a6bdd8c YELLOW -IController.java 6ba069977e7588f97187916c23a0e37f7cb91059 YELLOW -IControllerFactory.java 85b86eda643489f2a03454eae5383915ecf27f83 YELLOW -IDragController.java c1f311d2ae9ed684c8a7cd85e9ed1f85e79658d1 YELLOW -IKeyPressController.java dc8fe2a7c441866122e8c7b3114fd12d17f0b051 YELLOW +IClickController.java c0270e99d918aef14612d46f3e84905d3a6bdd8c GREEN +IController.java 6ba069977e7588f97187916c23a0e37f7cb91059 GREEN +IControllerFactory.java 85b86eda643489f2a03454eae5383915ecf27f83 GREEN +IDragController.java c1f311d2ae9ed684c8a7cd85e9ed1f85e79658d1 GREEN +IKeyPressController.java dc8fe2a7c441866122e8c7b3114fd12d17f0b051 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings index 2fb55495d45c3c21a244d8e23cb04ab51a9f5314..6ffed36a00066011648fa84b53763f2b15a33159 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings @@ -1,11 +1,11 @@ -AnchorageContentControllerBase.java da56b10cbf2711b5da69f0b59f43eacbe54f4eea YELLOW -ClickControllerBase.java 8e5861ed5f9318008ad0fdd5497ed320cd5bd647 YELLOW -ContentAnchorageMoveControllerBase.java c18e7915ce23e124757f5b736086ecc46694800a YELLOW -ControllerBase.java 309e9ee3f3a255b5a06fed8f1b4d4ec8bf88f101 YELLOW -DefaultDiagramController.java 0e083b89a08f63967102a384d66ebc1d64d203af YELLOW -DelegatingContentAnchorageController.java 2e3b1b4e14402a3503233f816b21ef3e4aa09edc YELLOW -DragControllerBase.java b15ff874304f679fe494d85f57cc8cbe4d0d1d15 YELLOW -DraggingUtils.java 95117e2ea4c36b6c6a31f8088bb95b484e0e6612 YELLOW -LinkControllerBase.java 392cb79cb42e9f878c665d47053b0795c3768603 YELLOW -MoveControllerBase.java 38d632e31f5e27d112ecdd4933e3a331378180d0 YELLOW -ResizableContentControllerBase.java 898500d389b035f8138308d496d2d24be501c719 YELLOW +AnchorageContentControllerBase.java da56b10cbf2711b5da69f0b59f43eacbe54f4eea GREEN +ClickControllerBase.java 8e5861ed5f9318008ad0fdd5497ed320cd5bd647 GREEN +ContentAnchorageMoveControllerBase.java c18e7915ce23e124757f5b736086ecc46694800a GREEN +ControllerBase.java 309e9ee3f3a255b5a06fed8f1b4d4ec8bf88f101 GREEN +DefaultDiagramController.java 0e083b89a08f63967102a384d66ebc1d64d203af GREEN +DelegatingContentAnchorageController.java 2e3b1b4e14402a3503233f816b21ef3e4aa09edc GREEN +DragControllerBase.java b15ff874304f679fe494d85f57cc8cbe4d0d1d15 GREEN +DraggingUtils.java 95117e2ea4c36b6c6a31f8088bb95b484e0e6612 GREEN +LinkControllerBase.java 392cb79cb42e9f878c665d47053b0795c3768603 GREEN +MoveControllerBase.java 38d632e31f5e27d112ecdd4933e3a331378180d0 GREEN +ResizableContentControllerBase.java 898500d389b035f8138308d496d2d24be501c719 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings index ca7cd95560997655fec8af345c644cec0bccbc37..28d2587c373396106aed0e3864a7707ac1fb97f5 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings @@ -1,3 +1,3 @@ -CircularResizableContentControllerBase.java daf05a58eac298462a5f092503e506575b31dff1 YELLOW -CurveLinkBendPointControllerBase.java 4d119cd640b864f2193ea5c1a7f816310b7a57a4 YELLOW -EllipticResizableContentControllerBase.java 42bcbdbf29c1cf2b71177e55f74358d1517d623f YELLOW +CircularResizableContentControllerBase.java daf05a58eac298462a5f092503e506575b31dff1 GREEN +CurveLinkBendPointControllerBase.java 4d119cd640b864f2193ea5c1a7f816310b7a57a4 GREEN +EllipticResizableContentControllerBase.java 42bcbdbf29c1cf2b71177e55f74358d1517d623f GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/rectangular/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/rectangular/.ratings index 47f0dc98d33d9c0b1565094a64e13befc63d6696..399ca58251f13125ae9b9f18d5f57304b2fc19e9 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/rectangular/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/rectangular/.ratings @@ -1,5 +1,5 @@ -DiamondResizableContentControllerBase.java 31f227e88205bd2e131326bdddd8421991b47d79 YELLOW -RectangularContentAnchorageMoveController.java c119b011f5a38933cee07b8082fcd44c6c3b0037 YELLOW -RectangularResizableContentControllerBase.java 262b083e4e0ce842b0bb8fbb594585e9f0d2f678 YELLOW -RhomboidContentAnchorageMoveController.java fbd40ce483f99c18cfa94076374f572bb72c2646 YELLOW -RhomboidResizableContentControllerBase.java 863b9eae49bad18f71b20c8cde4b0f350348aa27 YELLOW +DiamondResizableContentControllerBase.java 31f227e88205bd2e131326bdddd8421991b47d79 GREEN +RectangularContentAnchorageMoveController.java c119b011f5a38933cee07b8082fcd44c6c3b0037 GREEN +RectangularResizableContentControllerBase.java 262b083e4e0ce842b0bb8fbb594585e9f0d2f678 GREEN +RhomboidContentAnchorageMoveController.java fbd40ce483f99c18cfa94076374f572bb72c2646 GREEN +RhomboidResizableContentControllerBase.java 863b9eae49bad18f71b20c8cde4b0f350348aa27 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/.ratings index 64f28f835bfdcd13cc22512f260cf8d9d693a7ca..b3e49918b7fb9c33983501e717629f830a3e9146 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/.ratings @@ -1,5 +1,5 @@ -IModelChangeListener.java 241a583a3517ad504ad0a2d5a8f4d98afee8fd8b YELLOW -IModelChangeProvider.java bc7622c4af211e3ee470d12b80d04a92880f0d38 YELLOW -IModelFactory.java 3b6a1cb2779af0215a2637c40428b42600ef4ffb YELLOW -ModelChangeProviderBase.java eb5ad0363e30f727a70c42edb3d781acb6e6add6 YELLOW -ModelFactoryBase.java 6d0e1e5658c592f3f98d3bcf68bdbb54a506c489 YELLOW +IModelChangeListener.java 241a583a3517ad504ad0a2d5a8f4d98afee8fd8b GREEN +IModelChangeProvider.java bc7622c4af211e3ee470d12b80d04a92880f0d38 GREEN +IModelFactory.java 3b6a1cb2779af0215a2637c40428b42600ef4ffb GREEN +ModelChangeProviderBase.java eb5ad0363e30f727a70c42edb3d781acb6e6add6 GREEN +ModelFactoryBase.java 6d0e1e5658c592f3f98d3bcf68bdbb54a506c489 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/layout/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/layout/.ratings index e16ac9b565554bdc3997e7fda8cf824f4f77e9aa..579b227ef74dde76b632ceadb6ef103bd4cc45dc 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/layout/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/model/layout/.ratings @@ -1,6 +1,6 @@ -IAngleLayout.java 4993d53870c2a71dc63e8a99ceb47df6cfec3801 YELLOW -ILayout.java e6fd2a1ac953a18c8ea8951e594e44a1c0fc8d92 YELLOW -IOffsetLayout.java 440551f07a2af2ceb000b14177cc2351cb1b7f52 YELLOW -IPointsLayout.java be1c706ae6e782d6ac960e02e6855f8d2118914b YELLOW -ISideLayout.java 20b14640a7424a013338e6683b9f4cf6e62f01e1 YELLOW -IXYLayout.java e3e007db33846621bf6844621360b5881f7f6023 YELLOW +IAngleLayout.java 4993d53870c2a71dc63e8a99ceb47df6cfec3801 GREEN +ILayout.java e6fd2a1ac953a18c8ea8951e594e44a1c0fc8d92 GREEN +IOffsetLayout.java 440551f07a2af2ceb000b14177cc2351cb1b7f52 GREEN +IPointsLayout.java be1c706ae6e782d6ac960e02e6855f8d2118914b GREEN +ISideLayout.java 20b14640a7424a013338e6683b9f4cf6e62f01e1 GREEN +IXYLayout.java e3e007db33846621bf6844621360b5881f7f6023 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/.ratings index 2cbebcd4f0eb0c2a87624fda33091a00b464d1d6..0caf473507c9a43784b1e21e70aa1dcf8a9f66fb 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/.ratings @@ -1,10 +1,10 @@ -IAnchorageMVCBundle.java 17671d1ef6ecc4d1b4b98cf9d83016b31455346d YELLOW -IContentAnchorageMVCBundle.java c3bd9eb5266d0f87b16cdd16aeaadbfa6eeb49de YELLOW -IContentMVCBundle.java f84f8e59af85d022c2019d271d957821c5c55d3f YELLOW -IContentMVCBundleWithParent.java 890ffcacb493fda5ead5b7f74dc7ae1637077526 YELLOW -IDiagramAnchorageMVCBundle.java c49ef7ca7457ea9d4557251263779b403f79e69c YELLOW -IDiagramMVCBundle.java 354facfc00887726a6d7553d40824b7171865330 YELLOW -ILinkMVCBundle.java a2b1527f98ed642def2346190f6a71016ca674af YELLOW -IMVCBundle.java 19a6cc6bc96c42dd98dca24288a050ff0ba04734 YELLOW -IMVCBundlePart.java 6ddc90167a6ee7410876150e1785840f6ad32912 YELLOW -MVCBundleTag.java cf428833f24caccd74945119cf906b19daa3d63b YELLOW +IAnchorageMVCBundle.java 17671d1ef6ecc4d1b4b98cf9d83016b31455346d GREEN +IContentAnchorageMVCBundle.java c3bd9eb5266d0f87b16cdd16aeaadbfa6eeb49de GREEN +IContentMVCBundle.java f84f8e59af85d022c2019d271d957821c5c55d3f GREEN +IContentMVCBundleWithParent.java 890ffcacb493fda5ead5b7f74dc7ae1637077526 GREEN +IDiagramAnchorageMVCBundle.java c49ef7ca7457ea9d4557251263779b403f79e69c GREEN +IDiagramMVCBundle.java 354facfc00887726a6d7553d40824b7171865330 GREEN +ILinkMVCBundle.java a2b1527f98ed642def2346190f6a71016ca674af GREEN +IMVCBundle.java 19a6cc6bc96c42dd98dca24288a050ff0ba04734 GREEN +IMVCBundlePart.java 6ddc90167a6ee7410876150e1785840f6ad32912 GREEN +MVCBundleTag.java cf428833f24caccd74945119cf906b19daa3d63b GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/impl/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/impl/.ratings index 75dd39150629f014e42f0ffb5515d36228037152..f2a2a198165e2e3d12be6739bf9f96f07b6169d6 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/impl/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/mvc/impl/.ratings @@ -1,8 +1,8 @@ -AnchorageMVCBundleBase.java 63dc967da3342d402603adcc005344ce89386ea8 YELLOW -ContentAnchorageMVCBundle.java 1a517903c6400203cb7850502671e01d715f2453 YELLOW -ContentMVCBundle.java ee8a2c7780b64d61cf3e196437ce5ab07ad29e7c YELLOW -DiagramAnchorageMVCBundle.java b0f12259bbb8ccbf68b0774eb76c060188f4fea2 YELLOW -DiagramMVCBundle.java 46860e820c67f985cd75704b9084948df1939ee8 YELLOW -LinkMVCBundle.java b8246cd0e6f6ff53b377a9a0c4d1c8e4aa6371c4 YELLOW -MVCBundleBase.java 0a1b561e6ed5a5b4a3d2fdf52e2e5839c770193b YELLOW -MVCBundlePartBase.java 9e56b3799f14fe63649a09130edbdef083b87fdc YELLOW +AnchorageMVCBundleBase.java 63dc967da3342d402603adcc005344ce89386ea8 GREEN +ContentAnchorageMVCBundle.java 1a517903c6400203cb7850502671e01d715f2453 GREEN +ContentMVCBundle.java ee8a2c7780b64d61cf3e196437ce5ab07ad29e7c GREEN +DiagramAnchorageMVCBundle.java b0f12259bbb8ccbf68b0774eb76c060188f4fea2 GREEN +DiagramMVCBundle.java 46860e820c67f985cd75704b9084948df1939ee8 GREEN +LinkMVCBundle.java b8246cd0e6f6ff53b377a9a0c4d1c8e4aa6371c4 GREEN +MVCBundleBase.java 0a1b561e6ed5a5b4a3d2fdf52e2e5839c770193b GREEN +MVCBundlePartBase.java 9e56b3799f14fe63649a09130edbdef083b87fdc GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/.ratings index eac3ce8aa6f5915c3c45dd6ddaee84beae2392df..a84ae75a78cdc614ba48b39de4ba43f38993a892 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/.ratings @@ -1,7 +1,7 @@ -IAnchorageVisual.java e742212c132db1e2309650f5d6e40bc79c2ff85a YELLOW -IContentAnchorageVisual.java 3a3ceb675820f151aa678b6caa0f1ae833da1b7f YELLOW -IContentVisual.java 1052ece1f6172799204b1d7524398766c3b7a12e YELLOW -IDiagramAnchorageVisual.java ae0895912fe735147ccd11b7f466a7a5b61c3ca5 YELLOW -ILinkVisual.java 8f9bd6cf7c423a78d67fab0a20ba2dad2dfbd55e YELLOW -IVisual.java 400569502788bf2efff3de84f2c53b65256b3fc4 YELLOW -IVisualFactory.java 39253dc705f7f73ddbb83d050232a19219d54e71 YELLOW +IAnchorageVisual.java e742212c132db1e2309650f5d6e40bc79c2ff85a GREEN +IContentAnchorageVisual.java 3a3ceb675820f151aa678b6caa0f1ae833da1b7f GREEN +IContentVisual.java 1052ece1f6172799204b1d7524398766c3b7a12e GREEN +IDiagramAnchorageVisual.java ae0895912fe735147ccd11b7f466a7a5b61c3ca5 GREEN +ILinkVisual.java 8f9bd6cf7c423a78d67fab0a20ba2dad2dfbd55e GREEN +IVisual.java 400569502788bf2efff3de84f2c53b65256b3fc4 GREEN +IVisualFactory.java 39253dc705f7f73ddbb83d050232a19219d54e71 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/.ratings index 46f793ff95f84ccfb94b335d55d982ac19faa129..f25afc4fc869edb72d824531a0f042e3a2f447e7 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/.ratings @@ -1,6 +1,6 @@ -ContentAnchorageVisualBase.java 6722629a940e9f8d973d2176bc3855932d7fa35a YELLOW -ContentVisualBase.java b061d42fc27e980023980d070961d0814702237d YELLOW -DiagramAnchorageVisualBase.java 05c235152bc79187f0fc9b041435da7968654a78 YELLOW -LinkVisualBase.java 909b933b38b7651cac901d767115e173983bef26 YELLOW -MVCBundlePartWithEffectsBase.java 6f6fbbb065950ad3acd4dc1fbfdd1348874e51d2 YELLOW -VisualBase.java a2daf2d8f8450559450ddf5bbc93d3f948c189dd YELLOW +ContentAnchorageVisualBase.java 6722629a940e9f8d973d2176bc3855932d7fa35a GREEN +ContentVisualBase.java d232c6cb7bc54b2430379379eb2985f5a2e12cd3 RED +DiagramAnchorageVisualBase.java 05c235152bc79187f0fc9b041435da7968654a78 GREEN +LinkVisualBase.java 909b933b38b7651cac901d767115e173983bef26 GREEN +MVCBundlePartWithEffectsBase.java 6f6fbbb065950ad3acd4dc1fbfdd1348874e51d2 GREEN +VisualBase.java 8d6e74d5c74703dad12847cd5c913fa72707a84a RED diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/ContentVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/ContentVisualBase.java index b061d42fc27e980023980d070961d0814702237d..d232c6cb7bc54b2430379379eb2985f5a2e12cd3 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/ContentVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/ContentVisualBase.java @@ -41,6 +41,7 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi protected final Text text = new Text(); /** The icon of this visual. */ protected final ImageView icon = new ImageView(); + // TODO (SB): Magic constant /** The expanded / collapsed indicator widget. */ protected final ExpandCollapseWidget expandCollapseWidget = new ExpandCollapseWidget(0, 0, 20, 20, 3); @@ -79,6 +80,7 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi /** Returns the insets of the text label. */ protected Insets getTextInsets() { + // TODO (SB): Magic constant return new Insets(10, 10, 10, 10); } @@ -250,12 +252,14 @@ public abstract class ContentVisualBase extends VisualBase implements IContentVi /** Returns the inset for the plus/minus sign of the expand/collapse widget. */ protected double getExpandCollapseWidgetInset() { + // TODO (SB): Magic constant return 3; } /** Returns the location for the expand/collapse widget. */ protected Rectangle2D getExpandCollapseWidgetRectangle() { Rectangle2D b = getCurrentBounds(); + // TODO (SB): Magic constant return new Rectangle2D(b.getWidth() - 20, 6, 14, 14); } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/VisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/VisualBase.java index a2daf2d8f8450559450ddf5bbc93d3f948c189dd..8d6e74d5c74703dad12847cd5c913fa72707a84a 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/VisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/base/VisualBase.java @@ -85,6 +85,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements protected void createHoverEffect(DiagramLayers layers) { Color shadow = getHoverShadowColor(); if(shadow != null && visualShape != null) { + // TODO (SB): Magic constant visualShape.setEffect(new DropShadow(10, 3, 3, shadow)); } // handle hover text @@ -280,6 +281,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements /** Returns the opacity of the content visual. */ protected double getOpacity() { + // TODO (SB): Magic constant return 0.8; } @@ -290,6 +292,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements /** Returns the width of the border. */ protected double getBorderWidth() { + // TODO (SB): Magic constant return 2; } @@ -320,6 +323,7 @@ public abstract class VisualBase extends MVCBundlePartWithEffectsBase implements /** Returns the size of the hit area as an outset of the visible rectangle. */ protected double getHitAreaOutset() { + // TODO (SB): Magic constant return 10; } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/.ratings index c2c5235bd3b9deb31fdbf82757057360aa46d36b..1b4320c713efe1645fba333acaa27c6fb6bf4629 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/.ratings @@ -1,7 +1,7 @@ -CircularContentAnchorageVisualBase.java de227ce8a2a14eb4df7bdcf43b82d98f6ff17045 YELLOW -CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 YELLOW +CircularContentAnchorageVisualBase.java e1d3f982239beb38120c7eda6ecf319ab2779f9c RED +CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 GREEN CircularDiagramAnchorageVisualBase.java 7a3b92fb1b135c218b9a5e16506acfc74a6b5468 YELLOW -CurveLinkVisualBase.java 0b8706214320d715966c86a5242ad21c8bf5a315 YELLOW -CurveSegment.java 445bc2607cb70ae1c788c27ba9fc637dd7df4956 YELLOW -EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 YELLOW -EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 YELLOW +CurveLinkVisualBase.java 5ce3086769004a9eb6800d7eb58379d831ff74b1 GREEN +CurveSegment.java 0e7f70e9526a74aaec2bec4f4fc16295521cf5f2 GREEN +EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 GREEN +EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CircularContentAnchorageVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CircularContentAnchorageVisualBase.java index de227ce8a2a14eb4df7bdcf43b82d98f6ff17045..e1d3f982239beb38120c7eda6ecf319ab2779f9c 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CircularContentAnchorageVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CircularContentAnchorageVisualBase.java @@ -84,6 +84,7 @@ public abstract class CircularContentAnchorageVisualBase extends ContentAnchorag /** Returns the insets of the filled circle subtracted from {@link #getDimensions()}. */ protected double getInset() { + // TODO (SB): Magic constant return 2; } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveLinkVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveLinkVisualBase.java index 0b8706214320d715966c86a5242ad21c8bf5a315..5ce3086769004a9eb6800d7eb58379d831ff74b1 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveLinkVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveLinkVisualBase.java @@ -65,7 +65,7 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { for(int i = 2; i < pts; i += 3) { Point2D ep = getBendPointLocation(i); makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), markerSize, markerSize, - false, true, 0); + false, true, 0, getLabelText(i, pts + 1)); sp = ep; cp1 = getBendPointLocation(i + 1); cp2 = getBendPointLocation(i + 2); @@ -76,14 +76,16 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { .applyToPoint(getEndAnchorPoint()); // Last bend point is not selectable => set its feedback rectangle size to 0 makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), 0, markerSize, - showArrowOnLastSegment(), useLineArrow(), getArrowLength()); + showArrowOnLastSegment(), useLineArrow(), getArrowLength(), + getLabelText(pts, pts + 1)); endFeedbackHandle.setX(ep.getX() - ms2); endFeedbackHandle.setY(ep.getY() - ms2); endFeedbackHandle.setWidth(markerSize); endFeedbackHandle.setHeight(markerSize); for(CurveSegment cs : segments) { - cs.addLinkNodes(layers, linkBundle); + cs.addLinkNodes(layers, linkBundle, + getLabelText(segments.indexOf(cs), segments.size())); } curvesAddedToSceneGraph = true; } @@ -133,7 +135,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { // handle bend points for(int i = 2; i < pts; i += 3) { Point2D ep = getFeedbackChangeForBendPoint(i).applyToPoint(getBendPointLocation(i)); - segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0); + segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0, + getLabelText(i, pts)); sp = ep; cp1 = getFeedbackChangeForBendPoint(i + 1).applyToPoint(getBendPointLocation(i + 1)); cp2 = getFeedbackChangeForBendPoint(i + 2).applyToPoint(getBendPointLocation(i + 2)); @@ -142,7 +145,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { // end point Point2D ep = getFeedbackChangeForBendPoint(END_OF_LINK_BEND_POINT_INDEX) .applyToPoint(getEndAnchorPoint()); - segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength()); + segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength(), + getLabelText(pts, pts)); endFeedbackHandle.setX(ep.getX() - ms2); endFeedbackHandle.setY(ep.getY() - ms2); endFeedbackHandle.setWidth(markerSize); @@ -338,10 +342,10 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { /** Creates the curve segment. */ private void makeCurve(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep, double selWidth, double bpMarkerSize, double cpMarkerSize, boolean showArrow, boolean useLineArrow, - double arrowLength) { + double arrowLength, String labelText) { CurveSegment segVis = new CurveSegment(sp.getX(), sp.getY(), cp1.getX(), cp1.getY(), cp2.getX(), cp2.getY(), ep.getX(), ep.getY(), selWidth, bpMarkerSize, cpMarkerSize, - showArrow, useLineArrow, arrowLength); + showArrow, useLineArrow, arrowLength, labelText); segments.add(segVis); } @@ -448,4 +452,17 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase { cs.setMouseTransparent(true); } } + + /** + * Returns the label text. + * + * @param currentSegment + * the current segment + * @param lastSegment + * the last index of a segment + * @return the label text for the current segment or null for no label + */ + protected String getLabelText(int currentSegment, int lastSegment) { + return null; + } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveSegment.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveSegment.java index 445bc2607cb70ae1c788c27ba9fc637dd7df4956..0e7f70e9526a74aaec2bec4f4fc16295521cf5f2 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveSegment.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/elliptic/CurveSegment.java @@ -13,6 +13,7 @@ import static javafx.scene.paint.Color.BLACK; import static javafx.scene.paint.Color.GRAY; import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.TRANSPARENT; +import static javafx.scene.paint.Color.WHITE; import static javafx.scene.shape.StrokeLineCap.BUTT; import static javafx.scene.shape.StrokeLineJoin.ROUND; @@ -21,11 +22,17 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramLayers.ILayer; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.widgets.LinkArrowWidget; +import javafx.geometry.Insets; import javafx.geometry.Point2D; +import javafx.scene.control.Label; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundFill; +import javafx.scene.layout.CornerRadii; import javafx.scene.paint.Paint; import javafx.scene.shape.CubicCurve; import javafx.scene.shape.Line; import javafx.scene.shape.Rectangle; +import javafx.scene.text.TextAlignment; /** * This class encapsulates {@link CubicCurve}s usually needed for every segment: a visible one, a @@ -48,12 +55,14 @@ final class CurveSegment { private final Line helperEnd; /** The arrow widget for curved links. */ private final LinkArrowWidget arrowWidget; + /** Stores the label. */ + private Label label; /** Constructor. */ public CurveSegment(double sx, double sy, double c1x, double c1y, double c2x, double c2y, double ex, double ey, double selectionStrokeWidth, double bendPointFeedbackSize, double controlPointFeedbackSize, boolean showArrow, boolean useLineArrow, - double arrowLength) { + double arrowLength, String labelText) { visibleCurve = new CubicCurve(sx, sy, c1x, c1y, c2x, c2y, ex, ey); visibleCurve.setStroke(BLACK); visibleCurve.setFill(null); @@ -93,6 +102,12 @@ final class CurveSegment { } else { arrowWidget = null; } + if(labelText != null) { + label = new Label(labelText); + label.setTextAlignment(TextAlignment.CENTER); + } else { + label = null; + } } /** Returns the visible curve. */ @@ -145,7 +160,8 @@ final class CurveSegment { /** Updates the segment coordinates. */ public void update(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep, - double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength) { + double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength, + String labelText) { double sx = sp.getX(); double sy = sp.getY(); visibleCurve.setStartX(sx); @@ -196,16 +212,29 @@ final class CurveSegment { if(arrowWidget != null) { arrowWidget.update(ex, ey, c2x, c2y, arrowLength); } + if(label != null) { + label.setText(labelText); + double lx = (sx + ex - label.getBoundsInLocal().getWidth()) / 2; + double ly = (sy + ey) / 2; + label.setLayoutX(lx); + label.setLayoutY(ly); + } } /** Adds the link nodes of this segment to the link layer node. */ - public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle) { + public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle, String labelText) { ILayer linkLayer = layers.getLinkLayer(); linkLayer.add(visibleCurve, bundle); linkLayer.add(clickableCurve, bundle); if(arrowWidget != null) { linkLayer.add(arrowWidget, bundle); } + if(label != null) { + label.setText(labelText); + label.setBackground( + new Background(new BackgroundFill(WHITE, new CornerRadii(0), new Insets(0)))); + layers.getTextLayer().add(label, bundle); + } } /** Removes the link nodes of this segment from the link layer node. */ @@ -216,6 +245,9 @@ final class CurveSegment { if(arrowWidget != null) { linkLayer.remove(arrowWidget); } + if(label != null) { + layers.getTextLayer().remove(label); + } } /** Adds the feedback nodes of this segment to the feedback layer node. */ @@ -246,5 +278,8 @@ final class CurveSegment { if(arrowWidget != null) { arrowWidget.setMouseTransparent(transparent); } + if(label != null) { + label.setMouseTransparent(transparent); + } } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/.ratings index 1f339261e0cee18516e6bb05f07035ad012a2ef4..3c07cda2d566de786499df2e878426974facd923 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/.ratings @@ -1,9 +1,9 @@ -DiamondContentVisualBase.java 214dc886dba3f26a6404db5c521715466ce85522 YELLOW -LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc YELLOW -LineLinkVisualBase.java 41cee7c8258cb65080bfce2a5d785772305a8119 YELLOW -LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d YELLOW -RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 YELLOW -RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 YELLOW -RectangularContentVisualBase.java ccd23400a7ac47573127a39bc68c55c82baa44ad YELLOW -RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 YELLOW -RhomboidContentVisualBase.java 7a91e401034acc629179fb1a45416cd519f617d7 YELLOW +DiamondContentVisualBase.java de349d41b84b2063f74c03ff5ad7290855e997f7 RED +LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc GREEN +LineLinkVisualBase.java 5529031f89a96ad0322f011e89dad1ece785bc03 RED +LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d GREEN +RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 GREEN +RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 GREEN +RectangularContentVisualBase.java aee9ac3dbd53ce89539252d9984ed103d955be2f RED +RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 GREEN +RhomboidContentVisualBase.java 0c3820cbfd3763c3cb6b1a0cba5cc71d8eecea73 RED diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/DiamondContentVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/DiamondContentVisualBase.java index 214dc886dba3f26a6404db5c521715466ce85522..de349d41b84b2063f74c03ff5ad7290855e997f7 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/DiamondContentVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/DiamondContentVisualBase.java @@ -190,6 +190,7 @@ public abstract class DiamondContentVisualBase extends ContentVisualBase { @Override protected DiagramCoordinate getTextAnchorLocation() { DiagramCoordinate textAnchorLocation = super.getTextAnchorLocation(); + // TODO (SB): Magic constant return textAnchorLocation.add(getCurrentBounds().getWidth() / 5, 0); } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/LineLinkVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/LineLinkVisualBase.java index 41cee7c8258cb65080bfce2a5d785772305a8119..5529031f89a96ad0322f011e89dad1ece785bc03 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/LineLinkVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/LineLinkVisualBase.java @@ -339,6 +339,7 @@ public abstract class LineLinkVisualBase extends LinkVisualBase { /** Returns the length of the arrow. */ protected double getArrowLength() { + // TODO (SB): Magic constant return 10; } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RectangularContentVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RectangularContentVisualBase.java index ccd23400a7ac47573127a39bc68c55c82baa44ad..aee9ac3dbd53ce89539252d9984ed103d955be2f 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RectangularContentVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RectangularContentVisualBase.java @@ -28,6 +28,7 @@ import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; +// TODO (SB): Check potential code duplication with RectangularContentVisualBase (dragGestureHitTest) /** Base class for {@link ContentVisualBase content visuals} depicted by rectangles. */ public abstract class RectangularContentVisualBase extends ContentVisualBase { /** Constructor. */ @@ -98,6 +99,7 @@ public abstract class RectangularContentVisualBase extends ContentVisualBase { /** Returns the dimensions of the corner arcs. */ protected Dimension2D getCornerArcDimensions() { + // TODO (SB): Magic constant return new Dimension2D(15, 15); } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RhomboidContentVisualBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RhomboidContentVisualBase.java index 7a91e401034acc629179fb1a45416cd519f617d7..0c3820cbfd3763c3cb6b1a0cba5cc71d8eecea73 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RhomboidContentVisualBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/rectangular/RhomboidContentVisualBase.java @@ -86,6 +86,7 @@ public abstract class RhomboidContentVisualBase extends ContentVisualBase { /** Returns the offset of the upper and lower rhomboid line (0 = rectangle). */ public double getOffset() { + // TODO (SB): Magic constant return 3.0 * getViewer().getFeatures().getHorizontalSpacing(); } @@ -123,6 +124,7 @@ public abstract class RhomboidContentVisualBase extends ContentVisualBase { /** Returns the dimensions of the corner arcs. */ protected Dimension2D getCornerArcDimensions() { + // TODO (SB): Magic constant return new Dimension2D(15, 15); } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/widgets/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/widgets/.ratings index 23567ab4141161407f8d322123ed4eb8e732c7f4..66a576d2aea5fd43293c3c98d47c80eca5f43f3b 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/widgets/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/visual/widgets/.ratings @@ -1,2 +1,2 @@ -ExpandCollapseWidget.java f431b6a86f3ce1794c55b90f39a15cda4f92ea06 YELLOW -LinkArrowWidget.java 5354f14ca9d53cc3df88afb1867a266dfde65199 YELLOW +ExpandCollapseWidget.java f431b6a86f3ce1794c55b90f39a15cda4f92ea06 GREEN +LinkArrowWidget.java 5354f14ca9d53cc3df88afb1867a266dfde65199 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/.ratings index 1839610604b2b2454a1733315ab3e0df276d8df4..913a709138d79300d853f3471bc404d1aaea3571 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/.ratings @@ -1,4 +1,4 @@ DelegatingControllerFactory.java 50b2a5057794d6df22649e267d282ca3aa16797c GREEN DelegatingFactoryBase.java f421742267610f41bb6196346026d2f239d90ed0 GREEN -DelegatingModelFactory.java 09919cf0cdd95ce500ffc1083899d29b89efb5b2 GREEN +DelegatingModelFactory.java 2b5b22137d875ff7676990fb148034ab42e912da GREEN DelegatingVisualFactory.java 17bd4a6bbd3b9f9f8f9104d8cd9b239ef4bac759 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/DelegatingModelFactory.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/DelegatingModelFactory.java index 09919cf0cdd95ce500ffc1083899d29b89efb5b2..2b5b22137d875ff7676990fb148034ab42e912da 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/DelegatingModelFactory.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/factory/DelegatingModelFactory.java @@ -110,7 +110,8 @@ public class DelegatingModelFactory extends DelegatingFactoryBase<IModelFactory> /** {@inheritDoc} */ @Override public Object getRootModel() { - return editedObject; + return getDelegateFactories().stream().map(f -> f.getRootModel()).filter(cc -> cc != null) + .findFirst().orElse(null); } /** {@inheritDoc} */