Search in sources :

Example 56 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.

the class WiresParentPickerControlImpl method onMoveStart.

@Override
public void onMoveStart(final double x, final double y) {
    shapeLocationControl.onMoveStart(x, y);
    initialParent = getShape().getParent();
    m_parent = getShape().getParent();
    rebuildPicker();
    if ((m_parent != null) && (m_parent instanceof WiresShape)) {
        if (getShape().getDockedTo() == null) {
            m_parentPart = new PickerPart((WiresShape) m_parent, PickerPart.ShapePart.BODY);
        } else {
            m_parentPart = findShapeAt((int) shapeLocationControl.getShapeStartCenterX(), (int) shapeLocationControl.getShapeStartCenterY());
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

Example 57 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.

the class WiresShapeControlImpl method accept.

@Override
public boolean accept() {
    Point2D location = null;
    d_accept = (null != getDockingControl()) && getDockingControl().accept();
    c_accept = !d_accept && (null != getContainmentControl()) && getContainmentControl().accept();
    if (c_accept) {
        location = getContainmentControl().getCandidateLocation();
    } else if (d_accept) {
        location = getDockingControl().getCandidateLocation();
    }
    boolean accept = false;
    if (null != location) {
        accept = getShape().getWiresManager().getLocationAcceptor().accept(new WiresShape[] { getShape() }, new Point2D[] { location });
    }
    return accept;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 58 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.

the class WiresShapeHandler method doAdjust.

@Override
protected boolean doAdjust(final Point2D dxy) {
    // Keep parent shape and part instances before moving to another location.
    final WiresShape parent = getParentShape();
    final PickerPart.ShapePart parentPart = getParentShapePart();
    boolean adjusted = false;
    if (control.onMove(dxy.getX(), dxy.getY())) {
        dxy.set(control.getAdjust());
        adjusted = true;
    }
    // Check acceptors' allow methods.
    final boolean isDockAllowed = (null != getControl().getDockingControl()) && getControl().getDockingControl().isAllow();
    final boolean isContAllow = (null != getControl().getContainmentControl()) && getControl().getContainmentControl().isAllow();
    // Highlights.
    final WiresShape newParent = getParentShape();
    final PickerPart.ShapePart newParentPart = getParentShapePart();
    if ((parent != newParent) || (parentPart != newParentPart)) {
        highlight.restore();
    }
    if (null != newParent) {
        if (isDockAllowed) {
            highlight.highlight(newParent, PickerPart.ShapePart.BORDER);
        } else if (isContAllow) {
            highlight.highlight(newParent, PickerPart.ShapePart.BODY);
        }
    }
    batch();
    return adjusted;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

Aggregations

WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)58 Test (org.junit.Test)14 Point2D (com.ait.lienzo.client.core.types.Point2D)11 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)9 WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)7 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)6 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)4 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)3 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)2 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)2 AbstractCaseManagementShape (org.kie.workbench.common.stunner.cm.client.wires.AbstractCaseManagementShape)2 MockCaseManagementShape (org.kie.workbench.common.stunner.cm.client.wires.MockCaseManagementShape)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 Group (com.ait.lienzo.client.core.shape.Group)1 Layer (com.ait.lienzo.client.core.shape.Layer)1 Shape (com.ait.lienzo.client.core.shape.Shape)1 IDockingAcceptor (com.ait.lienzo.client.core.shape.wires.IDockingAcceptor)1 ILayoutHandler (com.ait.lienzo.client.core.shape.wires.ILayoutHandler)1