Commit b62e3ff3 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Components: JavaFX editor. Using base classes for channel controller.

Issue-Ref: 3815
Issue-Url: https://af3-developer.fortiss.org/issues/3815

Signed-off-by: Florian Hölzl's avatarFlorian Hoelzl <hoelzl@fortiss.org>
parent 0acd6bfc
ChannelController.java 0ea8eb3cad6817dfe3347e84b88ac5e60476f96f RED
ChannelController.java 99c2b3b99b4fe37642605a33a3f6fd7c12a2f6bf RED
DiagramComponentPortController.java 98f2b9c069c48d98fbf3a51fd086a3f5cffce911 RED
DiagramController.java 4d184103feefcaf9a74ed63538d227b975f9c4f8 RED
SubComponentController.java 4ab19d9f7fc2b0cb837ac1c3a5c3bb4e9010d156 RED
......
......@@ -16,27 +16,20 @@
package org.fortiss.af3.component.ui.editor.fx.controller;
import static java.util.Arrays.asList;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.changeConnectionPoint;
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.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.IController;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.controller.base.LinkControllerBase;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.ui.editor.fx.LayoutedModelElementBasedLinkBendPointController;
/**
* {@link IController} for {@link Channel}s.
*
* @author hoelzl
*/
public final class ChannelController extends LinkControllerBase {
public final class ChannelController extends LayoutedModelElementBasedLinkBendPointController {
/** Constructor. */
public ChannelController(ILinkMVCBundle mvcb) {
super(mvcb);
......@@ -53,22 +46,6 @@ public final class ChannelController extends LinkControllerBase {
return (Channel)getModel();
}
/** {@inheritDoc} */
@Override
protected void createBendPointAt(int bpIndex, DiagramCoordinate location) {
addConnectionPoint(getChannel(), bpIndex, (int)location.getX(), (int)location.getY());
}
/** {@inheritDoc} */
@Override
protected void updateModelAfterBendPointMove(int bpIndex, double dx, double dy) {
Channel channel = getChannel();
Point bp = getConnectionPoints(channel).getPoints().get(bpIndex);
int nx = bp.getX() + (int)dx;
int ny = bp.getY() + (int)dy;
changeConnectionPoint(channel, bpIndex, nx, ny);
}
/** {@inheritDoc} */
@Override
protected boolean clampAndSnapBendPointToGridCenter() {
......@@ -83,35 +60,10 @@ public final class ChannelController extends LinkControllerBase {
return true;
}
/** {@inheritDoc} */
@Override
protected void deleteBendPoint(int bpIndex) {
removeConnectionPoint(getChannel(), bpIndex);
}
/** {@inheritDoc} */
@Override
protected void updateModelAfterLinkMove(ILinkMVCBundle linkBundle, IMVCBundle startBundle,
IMVCBundle endBundle) {
// TODO: implement reconnect
}
/** {@inheritDoc} */
@Override
protected void deleteLink() {
List<Channel> cl = asList(getChannel());
// TODO: introduce delete service
}
/** {@inheritDoc} */
@Override
public void delete() {
deleteLink();
}
/** {@inheritDoc} */
@Override
protected int getNumerOfBendPoints() {
return getConnectionPoints(getChannel()).getPoints().size();
}
}
ChannelVisual.java 1d2f0f0b5be74ed9225dc4cadc5d0d6b542d3299 YELLOW
ChannelVisual.java 1f2e539d25326fa1bbcedf32362f5d643582dff1 RED
DiagramComponentPortVisual.java 4a2e4f089bf55d8642d0f334a6978cc2bf8bf954 YELLOW
SubComponentPortVisual.java 90fb107e57fe107b56b38fcf66a273f286b50760 RED
SubComponentVisual.java 84f6549016ae4a0e8b430918bc00c682645c7724 YELLOW
......@@ -15,15 +15,19 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.editor.fx.visual;
import static java.util.Collections.emptyList;
import static org.fortiss.af3.component.ui.editor.fx.FXComponentEditorUtils.computeLinkToAnchorLocation;
import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.getConnectionPoints;
import java.util.List;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.ILinkVisual;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.visual.rectangular.LineLinkVisualBase;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.model.layout.Points;
import javafx.geometry.Rectangle2D;
......@@ -52,7 +56,7 @@ public final class ChannelVisual extends LineLinkVisualBase {
/** {@inheritDoc} */
@Override
public DiagramCoordinate getBendPointLocation(int bpIndex) {
Point point = getConnectionPoints(getChannel()).getPoints().get(bpIndex);
Point point = getBendPointList().get(bpIndex);
return new DiagramCoordinate(point.getX(), point.getY());
}
......@@ -73,13 +77,26 @@ public final class ChannelVisual extends LineLinkVisualBase {
/** {@inheritDoc} */
@Override
protected Object getBendPointModel(int i) {
return getConnectionPoints(getChannel()).getPoints().get(i);
return getBendPointList().get(i);
}
/** {@inheritDoc} */
@Override
protected int getNumberOfBendPoints() {
return getConnectionPoints(getChannel()).getPoints().size();
return getBendPointList().size();
}
/** Returns the list of bend-points. */
private List<Point> getBendPointList() {
Points connectionPoints = getConnectionPoints(getChannel());
if(connectionPoints == null) {
return emptyList();
}
List<Point> l = connectionPoints.getPoints();
if(l == null) {
return emptyList();
}
return l;
}
/** {@inheritDoc} */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment