Search in sources :

Example 31 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.

the class StageView method createGhost.

@Override
protected AbstractCaseManagementShape createGhost() {
    final StageView ghost = new StageView(getWidth(), getHeight(), voffset);
    for (WiresShape ws : getChildShapes()) {
        final AbstractCaseManagementShape wsg = ((AbstractCaseManagementShape) ws).getGhost();
        ghost.add(wsg);
    }
    return ghost;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) AbstractCaseManagementShape(org.kie.workbench.common.stunner.cm.client.wires.AbstractCaseManagementShape)

Example 32 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.

the class AbstractCaseManagementShape method getIndex.

public int getIndex(final WiresShape shape) {
    final NFastArrayList<WiresShape> children = getChildShapes();
    int i = 0;
    for (WiresShape child : children) {
        if (child == shape || (child instanceof AbstractCaseManagementShape && shape instanceof AbstractCaseManagementShape && ((AbstractCaseManagementShape) child).getUUID().equals(((AbstractCaseManagementShape) shape).getUUID()))) {
            return i;
        }
        i++;
    }
    return i;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 33 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.

the class HorizontalStackLayoutManager method layout.

@Override
public void layout(final WiresContainer container) {
    double x = PADDING_X;
    for (WiresShape ws : container.getChildShapes()) {
        ws.setLocation(new Point2D(x, PADDING_Y));
        x = x + ws.getPath().getBoundingBox().getWidth() + PADDING_X;
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 34 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.

the class VerticalStackLayoutManager method orderChildren.

@Override
protected void orderChildren(final WiresShape shape, final WiresContainer container, final Point2D mouseRelativeLoc) {
    if (container == null) {
        return;
    }
    final double my = mouseRelativeLoc.getY();
    final NFastArrayList<WiresShape> nChildren = container.getChildShapes().copy();
    final List<WiresShape> children = nChildren.remove(shape).toList();
    int targetIndex = children.size();
    for (int idx = 0; idx < children.size(); idx++) {
        final WiresShape child = children.get(idx);
        if (my < child.getY()) {
            targetIndex = idx;
            break;
        }
    }
    if (container instanceof AbstractCaseManagementShape) {
        final int currentIndex = ((AbstractCaseManagementShape) container).getIndex(shape);
        if (currentIndex != targetIndex) {
            ((AbstractCaseManagementShape) container).addShape(shape, targetIndex);
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 35 with WiresShape

use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.

the class VerticalStackLayoutManager method layout.

@Override
public void layout(final WiresContainer container) {
    double y = PADDING_Y;
    if (container instanceof WiresShape) {
        y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight();
    }
    for (WiresShape ws : container.getChildShapes()) {
        ws.setLocation(new Point2D(PADDING_X, y));
        y = y + ws.getPath().getBoundingBox().getHeight() + PADDING_Y;
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D)

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