Search in sources :

Example 26 with WiresShape

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

the class WiresCompositeControlImpl method onMoveComplete.

@Override
public boolean onMoveComplete() {
    boolean completeResult = true;
    final Collection<WiresShape> shapes = selectedShapes;
    if (!shapes.isEmpty()) {
        shapes.iterator().next().getWiresManager();
        for (final WiresShape shape : shapes) {
            if (!shape.getControl().onMoveComplete()) {
                completeResult = false;
            }
        }
    }
    final Collection<WiresConnector> connectors = selectedConnectors;
    if (!connectors.isEmpty()) {
        // Update connectors and connections.
        for (final WiresConnector connector : connectors) {
            if (!connector.getWiresConnectorHandler().getControl().onMoveComplete()) {
                completeResult = false;
            }
        }
    }
    delta = new Point2D(0, 0);
    return completeResult;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 27 with WiresShape

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

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

Example 29 with WiresShape

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

the class WiresConnectionControlImpl method checkAllowAndShowMagnets.

private boolean checkAllowAndShowMagnets(final String colorKey) {
    final WiresShape prim = null != colorKey ? m_shape_color_map.get(colorKey) : null;
    m_colorKey = colorKey;
    if (isConnectionAllowed(prim)) {
        showMagnets(prim);
        return true;
    }
    return false;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 30 with WiresShape

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

the class ColorMapBackedPicker method addShapes.

protected void addShapes(final NFastArrayList<WiresShape> shapes) {
    for (int j = 0; j < shapes.size(); j++) {
        final WiresShape prim = shapes.get(j);
        if (m_options.shapesToSkip.contains(prim)) {
            continue;
        }
        final MultiPath multiPath = prim.getPath();
        drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BODY), true);
        addSupplementaryPaths(prim);
        if (m_options.hotspotsEnabled) {
            drawShape(m_colorKeyRotor.next(), m_options.hotspotWidth, new PickerPart(prim, PickerPart.ShapePart.BORDER_HOTSPOT), false);
            // need to be able to detect the difference between the actual border selection and the border hotspot
            drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BORDER), false);
        }
        if ((prim.getChildShapes() != null) && !prim.getChildShapes().isEmpty()) {
            addShapes(prim.getChildShapes());
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

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