Search in sources :

Example 1 with IContainmentAcceptor

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

the class CaseManagementContainmentAcceptorControlImplTest method getContainmentAcceptor.

private IContainmentAcceptor getContainmentAcceptor() {
    verify(canvasView, times(1)).setContainmentAcceptor(containmentAcceptorArgumentCaptor.capture());
    final IContainmentAcceptor containmentAcceptor = containmentAcceptorArgumentCaptor.getValue();
    return containmentAcceptor;
}
Also used : IContainmentAcceptor(com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)

Example 2 with IContainmentAcceptor

use of com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor 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)

Example 3 with IContainmentAcceptor

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

the class CaseManagementContainmentAcceptorControlImplTest method getILayoutHandler.

private ILayoutHandler getILayoutHandler(final WiresContainer parentShape, final WiresShape childShape) {
    final IContainmentAcceptor containmentAcceptor = getContainmentAcceptor();
    containmentAcceptor.acceptContainment(parentShape, new WiresShape[] { childShape });
    return parentShape.getLayoutHandler();
}
Also used : IContainmentAcceptor(com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)

Example 4 with IContainmentAcceptor

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

the class CaseManagementContainmentAcceptorControlImplTest method checkDoEnable.

@Test
public void checkDoEnable() {
    control.onEnable(canvasView);
    final IContainmentAcceptor containmentAcceptor = getContainmentAcceptor();
    assertNotNull(containmentAcceptor);
    assertTrue(containmentAcceptor instanceof CaseManagementContainmentAcceptorControlImpl.CanvasManagementContainmentAcceptor);
}
Also used : IContainmentAcceptor(com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor) Test(org.junit.Test)

Example 5 with IContainmentAcceptor

use of com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor 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)

Aggregations

IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)5 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)2 Test (org.junit.Test)2 WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)1 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)1 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1