Search in sources :

Example 11 with WiresShape

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

the class WiresCanvasView method addShape.

@Override
public WiresCanvas.View addShape(final ShapeView<?> shapeView) {
    if (WiresUtils.isWiresShape(shapeView)) {
        WiresShape wiresShape = (WiresShape) shapeView;
        wiresManager.register(wiresShape);
        wiresManager.getMagnetManager().createMagnets(wiresShape, getMagnetCardinals());
        WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
    } else if (WiresUtils.isWiresConnector(shapeView)) {
        WiresConnector wiresConnector = (WiresConnector) shapeView;
        final WiresConnectorControl connectorControl = wiresManager.register(wiresConnector);
        if (shapeView instanceof WiresConnectorView) {
            ((WiresConnectorView) shapeView).setControl(connectorControl);
        }
        WiresUtils.assertShapeGroup(wiresConnector.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
    } else {
        super.addShape(shapeView);
    }
    return this;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector) WiresConnectorView(org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresConnectorView) WiresConnectorControl(com.ait.lienzo.client.core.shape.wires.handlers.WiresConnectorControl)

Example 12 with WiresShape

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

the class WiresCanvasView method removeShape.

@Override
public WiresCanvas.View removeShape(final ShapeView<?> shapeView) {
    if (WiresUtils.isWiresShape(shapeView)) {
        WiresShape wiresShape = (WiresShape) shapeView;
        wiresManager.deregister(wiresShape);
    } else if (WiresUtils.isWiresConnector(shapeView)) {
        WiresConnector wiresConnector = (WiresConnector) shapeView;
        wiresManager.deregister(wiresConnector);
    } else {
        super.removeShape(shapeView);
    }
    return this;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector)

Example 13 with WiresShape

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

the class CaseManagementCanvasView method addShape.

@Override
public WiresCanvas.View addShape(final ShapeView<?> shapeView) {
    if (WiresUtils.isWiresShape(shapeView)) {
        WiresShape wiresShape = (WiresShape) shapeView;
        wiresManager.register(wiresShape, false);
        WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
    } else if (WiresUtils.isWiresConnector(shapeView)) {
    // Don't render connectors
    } else {
        super.addShape(shapeView);
    }
    return this;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 14 with WiresShape

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

the class ActivityView method createGhost.

@Override
protected AbstractCaseManagementShape createGhost() {
    final ActivityView ghost = new ActivityView(getWidth(), getHeight());
    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 15 with WiresShape

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

the class HorizontalStackLayoutManager method orderChildren.

@Override
protected void orderChildren(final WiresShape shape, final WiresContainer container, final Point2D mouseRelativeLoc) {
    if (container == null) {
        return;
    }
    final double shapeX = mouseRelativeLoc.getX();
    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 (shapeX < child.getX()) {
            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)

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