Search in sources :

Example 1 with WiresLayer

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

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

the class WiresDockingControlImpl method isAllow.

@Override
public boolean isAllow() {
    final WiresLayer layer = getParentPickerControl().getWiresLayer();
    final WiresManager wiresManager = layer.getWiresManager();
    final IDockingAcceptor dockingAcceptor = wiresManager.getDockingAcceptor();
    return !isEnabled() || ((null != getParent()) && (null != getParentShapePart()) && (getParent() instanceof WiresShape) && (getParentShapePart() == PickerPart.ShapePart.BORDER) && (dockingAcceptor.dockingAllowed(getParent(), getShape())));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) IDockingAcceptor(com.ait.lienzo.client.core.shape.wires.IDockingAcceptor) WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

Example 3 with WiresLayer

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

the class WiresUtilsTest method isWiresShapeWhenWiresLayer.

@Test
public void isWiresShapeWhenWiresLayer() {
    final Layer l = new Layer();
    final WiresLayer wl = new WiresLayer(l);
    assertTrue(WiresUtils.isWiresShape(wl));
}
Also used : WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer) Layer(com.ait.lienzo.client.core.shape.Layer) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer) Test(org.junit.Test)

Example 4 with WiresLayer

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

the class WiresContainmentControlImpl method addIntoParent.

private void addIntoParent(final WiresShape shape, final WiresContainer parent, final Point2D location) {
    final WiresLayer layer = getWiresLayer();
    if ((parent == null) || (parent == layer)) {
        layer.getLayoutHandler().add(shape, layer, location);
    } else {
        parent.getLayoutHandler().add(shape, parent, location);
    }
    shape.setDockedTo(null);
}
Also used : WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

Example 5 with WiresLayer

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

the class WiresContainmentControlImpl method calculateCandidateLocation.

public static Point2D calculateCandidateLocation(final WiresParentPickerControlImpl parentPickerControl) {
    final WiresLayer layer = parentPickerControl.getShape().getWiresManager().getLayer();
    final WiresContainer parent = parentPickerControl.getParent();
    final Point2D current = parentPickerControl.getShapeLocation();
    if ((parent == null) || (parent == layer)) {
        return current;
    } else {
        final Point2D trgAbsOffset = parent.getComputedLocation();
        return current.minus(trgAbsOffset);
    }
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

Aggregations

WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)8 Layer (com.ait.lienzo.client.core.shape.Layer)3 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)3 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)3 IDockingAcceptor (com.ait.lienzo.client.core.shape.wires.IDockingAcceptor)2 WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)2 Point2D (com.ait.lienzo.client.core.types.Point2D)2 Test (org.junit.Test)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)1 Before (org.junit.Before)1