Search in sources :

Example 1 with WiresShape

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

the class WiresConnectorView method connect.

@SuppressWarnings("unchecked")
public T connect(final ShapeView headShapeView, final Connection headConnection, final ShapeView tailShapeView, final Connection tailConnection) {
    final WiresShape headWiresShape = (WiresShape) headShapeView;
    final WiresShape tailWiresShape = (WiresShape) tailShapeView;
    return connect(headWiresShape.getMagnets(), headWiresShape.getGroup().getComputedLocation(), headConnection, tailWiresShape.getMagnets(), tailWiresShape.getGroup().getComputedLocation(), tailConnection);
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 2 with WiresShape

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

the class WiresShapeView method consumeChildrenAndConnectors.

void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) {
    // Move this shape.
    primConsumer.accept(getContainer());
    // Move child shapes.
    final NFastArrayList<WiresShape> childShapes = getChildShapes();
    if (null != childShapes) {
        for (int i = 0; i < childShapes.size(); i++) {
            final WiresShape shape = childShapes.get(i);
            if (shape instanceof WiresShapeView) {
                ((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer);
            } else {
                primConsumer.accept(shape.getContainer());
            }
        }
    }
    // Move connectors.
    if (null != getMagnets()) {
        for (int i = 0; i < getMagnets().size(); i++) {
            final WiresMagnet magnet = getMagnets().getMagnet(i);
            final NFastArrayList<WiresConnection> connections = magnet.getConnections();
            if (null != connections) {
                for (int j = 0; j < connections.size(); j++) {
                    final WiresConnection connection = connections.get(j);
                    if (null != connection.getConnector()) {
                        primConsumer.accept(connection.getConnector().getGroup());
                    }
                }
            }
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnection(com.ait.lienzo.client.core.shape.wires.WiresConnection) WiresMagnet(com.ait.lienzo.client.core.shape.wires.WiresMagnet)

Example 3 with WiresShape

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

the class CanvasViewTest method testRemoveChild.

@Test
@SuppressWarnings("unchecked")
public void testRemoveChild() {
    final WiresShape wiresShape = mock(WiresShape.class);
    final WiresShape parentWiresShape = mock(WiresShape.class);
    tested.removeChildShape(parentWiresShape, wiresShape);
    verify(parentWiresShape, times(1)).remove(eq(wiresShape));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Test(org.junit.Test)

Example 4 with WiresShape

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

the class CanvasViewTest method testAddChild.

@Test
@SuppressWarnings("unchecked")
public void testAddChild() {
    final WiresShape wiresShape = mock(WiresShape.class);
    final WiresShape parentWiresShape = mock(WiresShape.class);
    tested.addChildShape(parentWiresShape, wiresShape);
    verify(parentWiresShape, times(1)).add(eq(wiresShape));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Test(org.junit.Test)

Example 5 with WiresShape

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

the class WiresUtilsTest method isWiresShapeWhenRegisteredWiresShape.

@Test
public void isWiresShapeWhenRegisteredWiresShape() {
    final WiresShape ws = new WiresShape(new MultiPath());
    WiresUtils.assertShapeGroup(ws.getContainer(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
    assertTrue(WiresUtils.isWiresShape(ws));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) Test(org.junit.Test)

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