Search in sources :

Example 36 with WiresShape

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

the class CaseManagementCanvasViewTest method addWiresShape.

@Test
public void addWiresShape() {
    final MockCaseManagementShape shape = new MockCaseManagementShape();
    final String uuid = shape.uuid();
    shape.setUUID(uuid);
    view.addShape(shape);
    final WiresShape registeredShape = view.getWiresManager().getShape(uuid);
    assertNotNull(registeredShape);
    assertEquals(shape, registeredShape);
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) MockCaseManagementShape(org.kie.workbench.common.stunner.cm.client.wires.MockCaseManagementShape) Test(org.junit.Test)

Example 37 with WiresShape

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

the class CaseManagementContainmentAcceptorControlImplTest method checkContainmentAllowed.

@Test
public void checkContainmentAllowed() {
    control.enable(canvasHandler);
    final IContainmentAcceptor containmentAcceptor = getContainmentAcceptor();
    final WiresShape parentShape = makeWiresShape(PARENT_UUID);
    final WiresShape childShape = makeWiresShape(CANDIDATE_UUID);
    assertTrue(containmentAcceptor.containmentAllowed(parentShape, new WiresShape[] { childShape }));
    verify(canvasCommandFactory, times(1)).removeChild(any(Node.class), any(Node.class));
    verify(canvasCommandFactory, times(1)).setChildNode(any(Node.class), any(Node.class));
}
Also used : IContainmentAcceptor(com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Node(org.kie.workbench.common.stunner.core.graph.Node) Test(org.junit.Test)

Example 38 with WiresShape

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

the class CaseManagementContainmentAcceptorControlImplTest method checkInterceptingLayoutHandlerRemove.

@Test
public void checkInterceptingLayoutHandlerRemove() {
    control.enable(canvasHandler);
    final WiresShape parentShape = makeWiresShape();
    final WiresShape childShape = makeWiresShape();
    final ILayoutHandler layoutHandler = getILayoutHandler(parentShape, childShape);
    layoutHandler.remove(childShape, parentShape);
    assertTrue(parentShape.getLayoutHandler() instanceof ILayoutHandler.DefaultLayoutHandler);
}
Also used : ILayoutHandler(com.ait.lienzo.client.core.shape.wires.ILayoutHandler) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Test(org.junit.Test)

Example 39 with WiresShape

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

the class CaseManagementContainmentControlTest method setup.

@Before
public void setup() {
    layer = spy(new Layer());
    shape = spy(new MockCaseManagementShape());
    final Group shapeGroup = mock(Group.class);
    when(shapeGroup.getLayer()).thenReturn(layer);
    when(shape.getGroup()).thenReturn(shapeGroup);
    when(shape.getWiresManager()).thenReturn(wiresManager);
    when(shape.getGhost()).thenReturn(ghost);
    when(wiresManager.getContainmentAcceptor()).thenReturn(containmentAcceptor);
    when(parentPickerControl.getPickerOptions()).thenReturn(PICKER_OPTIONS);
    when(parentPickerControl.getShapeLocationControl()).thenReturn(shapeLocationControl);
    when(containmentControl.getParentPickerControl()).thenReturn(parentPickerControl);
    when(containmentControl.getShape()).thenReturn(shape);
    when(containmentControl.getParent()).thenReturn(parent);
    final NFastArrayList<WiresShape> children = new NFastArrayList<>();
    children.add(shape);
    children.add(ghost);
    when(parent.getChildShapes()).thenReturn(children);
    when(parent.getLayoutHandler()).thenReturn(parentLayoutHandler);
    when(parent.getIndex(eq(shape))).thenReturn(0);
    when(parent.getGroup()).thenReturn(new Group());
    when(state.getGhost()).thenReturn(Optional.of(ghost));
    when(state.getOriginalParent()).thenReturn(Optional.of(parent));
    when(state.getOriginalIndex()).thenReturn(Optional.of(0));
    control = new CaseManagementContainmentControl(containmentControl, state);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) NFastArrayList(com.ait.tooling.nativetools.client.collection.NFastArrayList) Layer(com.ait.lienzo.client.core.shape.Layer) Before(org.junit.Before)

Example 40 with WiresShape

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

the class CaseManagementContainmentControlTest method testOnMoveStartButNoCMShape.

@Test
public void testOnMoveStartButNoCMShape() {
    final WiresShape aShape = mock(WiresShape.class);
    when(containmentControl.getShape()).thenReturn(aShape);
    final double x = 15.5d;
    final double y = 21.63d;
    control.onMoveStart(x, y);
    verify(containmentControl, times(1)).onMoveStart(eq(x), eq(y));
    verify(state, times(1)).setGhost(eq(Optional.empty()));
    verify(state, times(1)).setOriginalIndex(eq(Optional.empty()));
    verify(state, times(1)).setOriginalParent(eq(Optional.empty()));
    verify(parent, never()).logicallyReplace(any(WiresShape.class), any(WiresShape.class));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) 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