Search in sources :

Example 16 with WiresShape

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

the class CaseManagementCanvasViewTest method addWiresConnector.

@Test
public void addWiresConnector() {
    final AbstractConnectorView connector = new PolylineConnectorView(0.0, 0.0);
    final String uuid = connector.uuid();
    connector.setUUID(uuid);
    view.addShape(connector);
    final WiresShape registeredConnector = view.getWiresManager().getShape(uuid);
    assertNull(registeredConnector);
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) AbstractConnectorView(org.kie.workbench.common.stunner.shapes.client.view.AbstractConnectorView) PolylineConnectorView(org.kie.workbench.common.stunner.shapes.client.view.PolylineConnectorView) Test(org.junit.Test)

Example 17 with WiresShape

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

the class CaseManagementContainmentAcceptorControlImplTest method testAcceptContainment.

@Test
public void testAcceptContainment() {
    control.enable(canvasHandler);
    final WiresShape parentShape = makeWiresShape(PARENT_UUID);
    final WiresShape childShape = makeWiresShape(CANDIDATE_UUID);
    final MockCaseManagementShape ghost = makeWiresShape(CANDIDATE_UUID);
    state.setGhost(Optional.of(ghost));
    final boolean isAccept = control.CONTAINMENT_ACCEPTOR.acceptContainment(parentShape, new WiresShape[] { childShape });
    assertTrue(isAccept);
    verify(canvasCommandFactory, times(1)).setChildNode(any(Node.class), any(Node.class), eq(Optional.of(0)), eq(Optional.empty()), eq(Optional.empty()));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Node(org.kie.workbench.common.stunner.core.graph.Node) MockCaseManagementShape(org.kie.workbench.common.stunner.cm.client.wires.MockCaseManagementShape) Test(org.junit.Test)

Example 18 with WiresShape

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

the class BaseLayoutManagerTest method setup.

public void setup() {
    this.shapes = new ArrayList<>();
    this.handler = getLayoutHandler();
    this.container = spy(new MockCaseManagementShape());
    this.container.setLayoutHandler(handler);
    // Shapes are at (0,15), (0,30) and (0,45) by default. Set by LayoutManager.
    for (int i = 0; i < 3; i++) {
        final int index = i;
        final WiresShape shape = new WiresShape(new MultiPath()) {

            @Override
            public String toString() {
                return "WiresShape:" + index;
            }
        };
        container.add(shape);
        shapes.add(shape);
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) MultiPath(com.ait.lienzo.client.core.shape.MultiPath)

Example 19 with WiresShape

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

the class CaseManagementColorMapBackedPickerTest method checkDropZonesAreNotAddedForWiresShapes.

@Test
public void checkDropZonesAreNotAddedForWiresShapes() {
    final WiresShape shape = mock(WiresShape.class);
    picker.addSupplementaryPaths(shape);
    verify(picker, never()).addDropZone(any(AbstractCaseManagementShape.class));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Test(org.junit.Test)

Example 20 with WiresShape

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

the class WiresContainmentControlImpl method runAcceptor.

private boolean runAcceptor(final boolean allowNotAccept) {
    if (!isEnabled()) {
        return false;
    }
    final WiresShape shape = getShape();
    final WiresContainer parent = getParent();
    final WiresLayer layer = getWiresLayer();
    final WiresManager wiresManager = layer.getWiresManager();
    final IContainmentAcceptor containmentAcceptor = wiresManager.getContainmentAcceptor();
    final WiresShape[] shapes = { shape };
    final boolean isParentLayer = (null == parent) || (parent instanceof WiresLayer);
    final WiresContainer candidateParent = isParentLayer ? layer : parent;
    final boolean isAllowed = containmentAcceptor.containmentAllowed(candidateParent, shapes);
    if (!allowNotAccept && isAllowed) {
        return containmentAcceptor.acceptContainment(candidateParent, shapes);
    }
    return isAllowed;
}
Also used : IContainmentAcceptor(com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

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