Search in sources :

Example 6 with WiresContainer

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

the class CaseManagementContainmentControl method restore.

private void restore(final AbstractCaseManagementShape ghost) {
    final WiresContainer originalParent = state.getOriginalParent().get();
    final int originalIndex = state.getOriginalIndex().get();
    restore(ghost, originalParent, originalIndex);
}
Also used : WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Example 7 with WiresContainer

use of com.ait.lienzo.client.core.shape.wires.WiresContainer 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 8 with WiresContainer

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

the class WiresShapeLocationControlImpl method onMoveStart.

@Override
public void onMoveStart(final double x, final double y) {
    m_delta = new Point2D(0, 0);
    shapeResetLocation = getShape().getLocation();
    shapeInitialLocation = getShape().getComputedLocation();
    m_mouseStartX = x;
    m_mouseStartY = y;
    final Point2D absShapeLoc = m_shape.getPath().getComputedLocation();
    final BoundingBox box = m_shape.getPath().getBoundingBox();
    m_shapeStartCenterX = absShapeLoc.getX() + (box.getWidth() / 2);
    m_shapeStartCenterY = absShapeLoc.getY() + (box.getHeight() / 2);
    m_startDocked = false;
    final WiresContainer parent = m_shape.getParent();
    if ((parent != null) && (parent instanceof WiresShape)) {
        if (m_shape.getDockedTo() != null) {
            m_startDocked = true;
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Example 9 with WiresContainer

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

the class WiresCompositeControlImpl method accept.

@Override
public boolean accept() {
    final Collection<WiresShape> shapes = selectedShapes;
    if (!shapes.isEmpty()) {
        final WiresManager wiresManager = shapes.iterator().next().getWiresManager();
        final Point2D[] shapeCandidateLocations = new Point2D[shapes.size()];
        int i = 0;
        for (final WiresShape shape : shapes) {
            shapeCandidateLocations[i] = shape.getControl().getContainmentControl().getCandidateLocation();
            i++;
        }
        final WiresShape[] shapesArray = toArray(shapes);
        final WiresContainer parent = getSharedParent();
        boolean completeResult = (null != parent) && wiresManager.getContainmentAcceptor().acceptContainment(parent, shapesArray);
        if (completeResult) {
            completeResult = wiresManager.getLocationAcceptor().accept(shapesArray, shapeCandidateLocations);
        }
        return completeResult;
    }
    return false;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D) WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Example 10 with WiresContainer

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

the class WiresCompositeControlImpl method getSharedParent.

@Override
public WiresContainer getSharedParent() {
    final Collection<WiresShape> shapes = selectedShapes;
    if (shapes.isEmpty()) {
        return null;
    }
    final WiresContainer shared = shapes.iterator().next().getControl().getParentPickerControl().getParent();
    for (final WiresShape shape : shapes) {
        final WiresContainer parent = shape.getControl().getParentPickerControl().getParent();
        if (parent != shared) {
            return null;
        }
    }
    return shared;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Aggregations

WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)13 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)7 Point2D (com.ait.lienzo.client.core.types.Point2D)4 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)2 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)2 Group (com.ait.lienzo.client.core.shape.Group)1 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)1 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1 Test (org.junit.Test)1