Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Commits on Source (87)
Showing
with 222 additions and 79 deletions
......@@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tooling Base UI
Bundle-SymbolicName: org.fortiss.tooling.base.ui;singleton:=true
Bundle-Version: 2.16.0.qualifier
Bundle-Version: 2.17.0.qualifier
Bundle-Activator: org.fortiss.tooling.base.ui.ToolingBaseUIActivator
Require-Bundle: org.fortiss.tooling.base;bundle-version="2.16.0";visibility:=reexport,
org.fortiss.tooling.kernel.ui;bundle-version="2.16.0";visibility:=reexport,
Require-Bundle: org.fortiss.tooling.base;bundle-version="2.17.0";visibility:=reexport,
org.fortiss.tooling.kernel.ui;bundle-version="2.17.0";visibility:=reexport,
org.eclipse.swt
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
......
ToolingBaseUIActivator.java 42fa7691bceec500b4e08cb28ef7fc69b9f8f658 GREEN
ToolingBaseUIActivator.java dbb6f64b87a553ffbcfeb92160d84b63073dfd89 GREEN
......@@ -15,6 +15,8 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui;
import static org.eclipse.jface.resource.ResourceLocator.imageDescriptorFromBundle;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
......@@ -53,6 +55,6 @@ public class ToolingBaseUIActivator extends AbstractUIPlugin {
/** Returns image descriptor of the image in the kernel plugin. */
public static ImageDescriptor getImageDescriptor(String iconPath) {
return imageDescriptorFromPlugin(PLUGIN_ID, iconPath);
return imageDescriptorFromBundle(PLUGIN_ID, iconPath).orElse(null);
}
}
ContextMenuUtil.java 405387151d45b09dffb3b6ba44f980313c8edcaf GREEN
CurvedLinkLayoutedContentAnchorangeController.java 67c20e31ddb82fe2fd499117193353b0545839a0 GREEN
EObjectDiagramController.java 2b253941592ee25ead95223470f983f23ef9776f GREEN
EObjectEllipticResizableContentControllerBase.java 7c862a03b97d2f2cfdcc2fcee7434de2e1e257d2 GREEN
ContextMenuUtil.java 6d270ba4c239c35ee487192427d02797e73ee109 GREEN
CurvedLinkLayoutedContentAnchorangeController.java e22faedbe98c3dab660b5d2df8ebd004e116c5ba GREEN
CurvedLinkLayoutedDiagramAnchorangeController.java f2e5e2a7cc9b6a070871e200e57371286bb15222 GREEN
EObjectDiagramController.java 18cbb2f092409adeb728233dae6e084faf357d6d GREEN
EObjectEllipticResizableContentControllerBase.java 958d3856daf5337cd75d0a6f163a27dcc8717160 GREEN
EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN
EObjectRectangularResizableContentControllerBase.java 28a17bf87f6a7222d927bc1c6b80967cb14b5f03 GREEN
EObjectRectangularResizableContentControllerBase.java 7cbc3e89b7b74106d56b8b4f845087e96e13d109 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
LayoutedContentAnchorageController.java 83f066a151dd2984c4bef64daf8165a0cd53b00f GREEN
LayoutedCurveLinkBendPointController.java d963a5e227de7bd8ba910c733df2ac7acf4fa1fa GREEN
LayoutedDiagramAnchorageController.java 89ee56e8e71a5fa635cfac81e84bbfe1d50e5776 GREEN
LayoutedEllipticResizableContentController.java 1c50e80121512de7ae1f2ba09e0e1f4d0e3f3104 GREEN
LayoutedLineLinkBendPointController.java f49c994a0c90612c44ec83d42cf858e476662e1f GREEN
LayoutedLinkBendPointController.java d06736b49b6ac9a073237b989895469891500e7f GREEN
LayoutedRectangularResizableContentController.java 341f4a7da0d69360d7026af6d9b3d44dfd7d9bb1 GREEN
ModelElementFXEditorUIProviderBase.java b81bf7fc945d40f1f842876f07ba70799ab65f6d GREEN
NamedCommentedLayoutModelChangeProvider.java 223e82c1b1cba842f6fae115182f5d0c6acb44b0 GREEN
......@@ -21,10 +21,13 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.ui.layout.auto.IAutoLayouter;
import org.fortiss.tooling.base.ui.layout.auto.KielerAutoLayouter;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.ICommandStackService;
......@@ -67,6 +70,20 @@ public final class ContextMenuUtil {
return result;
}
/** Creates an auto-layout menu entry for {@link IHierarchicElement}s. */
public static MenuItem createAutoLayoutMenu(IHierarchicElement target) {
final String MENU_NAME = "Automatic layout";
MenuItem mi = new MenuItem(MENU_NAME);
ICommandStackService css = ICommandStackService.getInstance();
mi.setOnAction(evt -> {
css.runAsCommand(target, () -> {
IAutoLayouter layouter = new KielerAutoLayouter();
layouter.performAutoLayout(target);
});
});
return mi;
}
/** Creates the element composition context. */
public static IElementCompositionContext createElementCompositionContext(EObject target,
double x, double y, boolean isRoot, double zoom) {
......
......@@ -17,8 +17,10 @@ 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.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.base.HierarchicElementBase;
import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
......@@ -26,13 +28,14 @@ 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;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
* {@link DelegatingContentAnchorageController} for diagrams with curved links.
*
* @author munaro
*/
public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector & ILayoutedModelElement>
public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector & INamedCommentedElement & ILayoutedModelElement>
extends LayoutedContentAnchorageController<T> {
/** Constructor. */
......@@ -42,21 +45,32 @@ public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
// TODO(3978): Resolve code duplication in the link-method of link visuals
@Override
protected void link(IMVCBundle startBundle, DiagramCoordinate startLocation,
IMVCBundle endBundle, DiagramCoordinate endLocation) {
super.link(startBundle, startLocation, endBundle, endLocation);
// Disable direct links between hierarchic element bases
if(startBundle.getModel() instanceof HierarchicElementBase ||
endBundle.getModel() instanceof HierarchicElementBase) {
return;
}
// 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();
// The call to `super.link` (see next lines) does not return a reference to the
// newly created connection. However, as it is needed in order to add the handles
// we get it by comparing the root element's connections before and after the
// creation of the new link:
// 1) Here we get the list of existing connections
EList<IConnection> connectionsBefore = new BasicEList<IConnection>(
((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections());
// 2) Here we create the new connection
super.link(startBundle, startLocation, endBundle, endLocation);
// 3) Here we get the updated list of connections
EList<IConnection> connectionsAfter = new BasicEList<IConnection>(
((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections());
// 4) We remove all existing ones
connectionsAfter.removeAll(connectionsBefore);
// 5) And we are left with the newly added one.
IConnection connection = connectionsAfter.stream().findFirst().get();
// Create handles
DiagramCoordinate startPosition =
......
/*-------------------------------------------------------------------------+
| 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.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.base.HierarchicElementBase;
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.mvc.IMVCBundle;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
* {@link LayoutedDiagramAnchorageController} for diagrams with curved links.
*
* @author munaro
*/
public class CurvedLinkLayoutedDiagramAnchorangeController<T extends IConnector & INamedCommentedElement & ILayoutedModelElement>
extends LayoutedDiagramAnchorageController<T> {
/** Constructor. */
public CurvedLinkLayoutedDiagramAnchorangeController(IMVCBundle mvcb, Class<T> modelType) {
super(mvcb, modelType);
}
/** {@inheritDoc} */
// TODO(3978): Resolve code duplication in the link-method of link visuals
@Override
protected void link(IMVCBundle startBundle, DiagramCoordinate startLocation,
IMVCBundle endBundle, DiagramCoordinate endLocation) {
// Disable direct links between hierarchic element bases
if(startBundle.getModel() instanceof HierarchicElementBase ||
endBundle.getModel() instanceof HierarchicElementBase) {
return;
}
// The call to `super.link` (see next lines) does not return a reference to the
// newly created connection. However, as it is needed in order to add the handles
// we get it by comparing the root element's connections before and after the
// creation of the new link:
// 1) Here we get the list of existing connections
EList<IConnection> connectionsBefore = new BasicEList<IConnection>(
((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections());
// 2) Here we create the new connection
super.link(startBundle, startLocation, endBundle, endLocation);
// 3) Here we get the updated list of connections
EList<IConnection> connectionsAfter = new BasicEList<IConnection>(
((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections());
// 4) We remove all existing ones
connectionsAfter.removeAll(connectionsBefore);
// 5) And we are left with the newly added one.
IConnection connection = connectionsAfter.stream().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());
}
}
......@@ -15,6 +15,7 @@ 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.createAutoLayoutMenu;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createDisplayMenu;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
......@@ -24,9 +25,10 @@ import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.compose;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
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.controller.base.ControllerBase;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.DefaultDiagramController;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
......@@ -43,7 +45,7 @@ import javafx.scene.input.Dragboard;
*
* @author hoelzl
*/
public class EObjectDiagramController<T extends EObject> extends ControllerBase {
public class EObjectDiagramController<T extends EObject> extends DefaultDiagramController {
/** The model change provider. */
private final EObjectModelChangeProvider modelChangeProvider;
......@@ -85,6 +87,9 @@ public class EObjectDiagramController<T extends EObject> extends ControllerBase
getViewer().getFeatures().getCurrentZoomFactor());
List<MenuItem> result = createPrototypeMenu(modelParent, edc);
result.add(createDisplayMenu(getViewer()));
if(modelParent instanceof IHierarchicElement) {
result.add(createAutoLayoutMenu((IHierarchicElement)modelParent));
}
return result;
}
......
......@@ -35,6 +35,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.elliptic.EllipticR
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.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
......@@ -51,10 +52,10 @@ import javafx.scene.input.MouseEvent;
*
* @author hoelzl
*/
public abstract class EObjectEllipticResizableContentControllerBase<T extends EObject>
public abstract class EObjectEllipticResizableContentControllerBase<T extends INamedCommentedElement & ILayoutedModelElement>
extends EllipticResizableContentControllerBase {
/** {@link IModelChangeProvider} for this controller */
private final LayoutModelChangeProvider layoutModelChangeProvider;
private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider;
/** The click controller handling double-click to open editor. */
private final IClickController openEditorDoubleClickController = new ClickControllerBase() {
@Override
......@@ -94,8 +95,8 @@ public abstract class EObjectEllipticResizableContentControllerBase<T extends EO
modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName());
}
ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel();
this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme) {
@SuppressWarnings("unchecked") T lme = (T)mvcb.getModel();
this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme) {
/** {@inheritDoc} */
@Override
protected boolean acceptNotification(Notification notification) {
......
......@@ -19,6 +19,7 @@ import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHA
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_MINIMUM_WIDTH;
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 static org.fortiss.tooling.base.ui.editor.fx.visual.CoordinateCorrections.RECTANGLE_INSETS;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.canCompose;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.compose;
......@@ -40,6 +41,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
......@@ -57,11 +59,11 @@ import javafx.scene.input.MouseEvent;
*
* @author hoelzl
*/
public abstract class EObjectRectangularResizableContentControllerBase<T extends EObject>
public abstract class EObjectRectangularResizableContentControllerBase<T extends INamedCommentedElement & ILayoutedModelElement>
extends RectangularResizableContentControllerBase {
/** {@link IModelChangeProvider} for this controller */
private final LayoutModelChangeProvider layoutModelChangeProvider;
private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider;
/** The click controller handling double-click to open editor. */
private final IClickController openEditorDoubleClickController = new ClickControllerBase() {
@Override
......@@ -101,8 +103,8 @@ public abstract class EObjectRectangularResizableContentControllerBase<T extends
modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName());
}
ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel();
this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme) {
@SuppressWarnings("unchecked") T lme = (T)mvcb.getModel();
this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme) {
/** {@inheritDoc} */
@Override
protected boolean acceptNotification(Notification notification) {
......@@ -146,7 +148,8 @@ public abstract class EObjectRectangularResizableContentControllerBase<T extends
/** {@inheritDoc} */
@Override
protected Dimension2D getMinimumSize() {
return new Dimension2D(DEFAULT_SHAPE_MINIMUM_WIDTH, DEFAULT_SHAPE_MINIMUM_HEIGHT);
return new Dimension2D(DEFAULT_SHAPE_MINIMUM_WIDTH - 2 * RECTANGLE_INSETS.getWidth(),
DEFAULT_SHAPE_MINIMUM_HEIGHT - 2 * RECTANGLE_INSETS.getHeight());
}
/** {@inheritDoc} */
......
......@@ -18,14 +18,15 @@ import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTa
import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG;
import org.eclipse.emf.ecore.EObject;
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.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
......@@ -34,10 +35,10 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
*
* @author hoelzl
*/
public class LayoutedContentAnchorageController<T extends ILayoutedModelElement>
public class LayoutedContentAnchorageController<T extends INamedCommentedElement & ILayoutedModelElement>
extends DelegatingContentAnchorageController {
/** {@link IModelChangeProvider} for this controller */
private final LayoutModelChangeProvider layoutModelChangeProvider;
private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider;
/** Constructor. */
public LayoutedContentAnchorageController(IContentAnchorageMVCBundle mvcb, Class<T> modelType) {
......@@ -49,8 +50,8 @@ public class LayoutedContentAnchorageController<T extends ILayoutedModelElement>
modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName());
}
ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel();
this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme);
@SuppressWarnings("unchecked") T lme = (T)mvcb.getModel();
this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme);
}
/** Returns the model element. */
......
......@@ -28,6 +28,7 @@ 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 org.fortiss.tooling.kernel.model.INamedCommentedElement;
import javafx.geometry.Point2D;
......@@ -37,7 +38,7 @@ import javafx.geometry.Point2D;
*
* @author munaro
*/
public class LayoutedCurveLinkBendPointController<T extends ILayoutedModelElement>
public class LayoutedCurveLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement>
extends LayoutedLinkBendPointController<T> {
/** Constructor. */
......
......@@ -14,19 +14,20 @@
package org.fortiss.tooling.base.ui.editor.fx.controller;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode;
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.utils.LayoutDataUtils.moveNode;
import org.eclipse.emf.ecore.EObject;
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.FeedbackChange;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.MoveControllerBase;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
......@@ -35,10 +36,10 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
*
* @author hoelzl
*/
public class LayoutedDiagramAnchorageController<T extends ILayoutedModelElement>
public class LayoutedDiagramAnchorageController<T extends INamedCommentedElement & ILayoutedModelElement>
extends MoveControllerBase {
/** {@link IModelChangeProvider} for this controller */
private final LayoutModelChangeProvider layoutModelChangeProvider;
private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider;
/** Constructor. */
public LayoutedDiagramAnchorageController(IMVCBundle mvcb, Class<T> modelType) {
......@@ -50,8 +51,8 @@ public class LayoutedDiagramAnchorageController<T extends ILayoutedModelElement>
modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName());
}
ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel();
this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme);
@SuppressWarnings("unchecked") T lme = (T)mvcb.getModel();
this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme);
}
/** Returns the model element. */
......
......@@ -29,13 +29,14 @@ 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;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
* {@link IController} for {@link ILayoutedModelElement}s that have a elliptical shape.
*
* @author munaro
*/
public class LayoutedEllipticResizableContentController<T extends ILayoutedModelElement>
public class LayoutedEllipticResizableContentController<T extends ILayoutedModelElement & INamedCommentedElement>
extends EObjectEllipticResizableContentControllerBase<T> {
/** Constructor */
......
......@@ -20,6 +20,7 @@ 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;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
* {@link IController} for {@link ILayoutedModelElement}s representing straight links and
......@@ -27,7 +28,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
*
* @author hoelzl
*/
public class LayoutedLineLinkBendPointController<T extends ILayoutedModelElement>
public class LayoutedLineLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement>
extends LayoutedLinkBendPointController<T> {
/** Constructor. */
......
......@@ -30,6 +30,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.LinkControlle
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.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
/**
......@@ -38,10 +39,10 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
*
* @author munaro
*/
public abstract class LayoutedLinkBendPointController<T extends ILayoutedModelElement>
public abstract class LayoutedLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement>
extends LinkControllerBase {
/** {@link IModelChangeProvider} for this controller */
protected final LayoutModelChangeProvider layoutModelChangeProvider;
protected final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider;
/** Returns the model element. */
@SuppressWarnings("unchecked")
......@@ -65,8 +66,8 @@ public abstract class LayoutedLinkBendPointController<T extends ILayoutedModelEl
modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName());
}
ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel();
this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme);
@SuppressWarnings("unchecked") T lme = (T)mvcb.getModel();
this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme);
}
/** {@inheritDoc} */
......
......@@ -22,13 +22,14 @@ import static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodeSize;
import static org.fortiss.tooling.base.utils.LayoutDataUtils.setStickyConnectorLayoutData;
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;
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.kernel.model.INamedCommentedElement;
import javafx.geometry.Dimension2D;
import javafx.geometry.Side;
......@@ -38,7 +39,7 @@ import javafx.geometry.Side;
*
* @author diewald
*/
public class LayoutedRectangularResizableContentController<T extends ILayoutedModelElement>
public class LayoutedRectangularResizableContentController<T extends INamedCommentedElement & ILayoutedModelElement>
extends EObjectRectangularResizableContentControllerBase<T> {
/** Constructor. */
public LayoutedRectangularResizableContentController(IContentMVCBundle mvcb,
......
......@@ -24,28 +24,30 @@ import org.eclipse.emf.ecore.util.EContentAdapter;
import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutPackage;
import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
/**
* A {@link KernelServiceBasedModelChangeProviderBase} for {@link ILayoutedModelElement}s.
*
* @author hoelzl
*/
class LayoutModelChangeProvider
extends KernelServiceBasedModelChangeProviderBase<ILayoutedModelElement> {
class NamedCommentedLayoutModelChangeProvider<T extends INamedCommentedElement & ILayoutedModelElement>
extends KernelServiceBasedModelChangeProviderBase<T> {
/** The layouted model element. */
private final ILayoutedModelElement modelElement;
private final T modelElement;
/** The layout EMF notification listener. */
private final LayoutModelElementAdapter notificationListener;
/** Constructor. */
public LayoutModelChangeProvider(ILayoutedModelElement modelElement) {
public NamedCommentedLayoutModelChangeProvider(T modelElement) {
this.modelElement = modelElement;
this.notificationListener = new LayoutModelElementAdapter();
}
/** {@inheritDoc} */
@Override
protected ILayoutedModelElement getModelElement() {
protected T getModelElement() {
return modelElement;
}
......@@ -78,7 +80,11 @@ class LayoutModelChangeProvider
Object notifier = notification.getNotifier();
if(notifier == modelElement) {
Object feature = notification.getFeature();
if(feature == LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) {
if(feature == FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME ||
feature == FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT) {
addNotification(notification);
return;
} else if(feature == LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) {
// self adapt to layout data
super.notifyChanged(notification);
addNotification(notification);
......
CoordinateCorrections.java 018bf229e5686afcb8540b61dd9d05b6e4a23e93 GREEN
LayoutedCircularAnchorageContentVisualBase.java cd85ff478e9b8e6b6d6f6c75cc5bf61522a63f3e GREEN
LayoutedCircularAnchorageContentVisualBase.java bf71e5e84ede0c26bd0632e4218aae55ab915ade 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
NamedLayoutedCircularAnchorageContentVisual.java 5ba0b5d133998eac47425696ef0a02b575418c2d GREEN
NamedLayoutedCircularAnchorageDiagramVisual.java 94eccb7bb03c5518ae875e9972f062ddd0e1f62d GREEN
NamedLayoutedCurveLinkVisual.java 7945b2f550d5e4804f44891294ee60cc8ffcbf1e GREEN
NamedLayoutedEllipticContentVisual.java f96a956c2f71b675eee56cfc613684397545da68 GREEN
NamedLayoutedLineLinkVisual.java 4fc48616000516dc90ba22b7069ffdabadc9c377 GREEN
......
......@@ -157,6 +157,6 @@ public abstract class LayoutedCircularAnchorageContentVisualBase<T extends ILayo
/** {@inheritDoc} */
@Override
public double getAngleInDegree() {
return toDegrees(getConnectorAngleAsDouble(getModelElement()));
return 360 - toDegrees(getConnectorAngleAsDouble(getModelElement()));
}
}