Search in sources :

Example 1 with WiresManager

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

the class WiresManagerFactoryImplTest method newWiresManager.

@Test
public void newWiresManager() {
    WiresManager wiresManager = wiresManagerFactory.newWiresManager(layer);
    assertEquals(wiresManager.getControlFactory(), wiresControlFactory);
    assertEquals(wiresManager.getWiresHandlerFactory(), wiresHandlerFactory);
}
Also used : WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager) Test(org.junit.Test)

Example 2 with WiresManager

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

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

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

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

the class WiresManagerFactoryImpl method newWiresManager.

@Override
public WiresManager newWiresManager(Layer layer) {
    WiresManager wiresManager = WiresManager.get(layer);
    wiresManager.setWiresHandlerFactory(wiresHandlerFactory);
    wiresManager.setWiresControlFactory(wiresControlFactory);
    return wiresManager;
}
Also used : WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager)

Aggregations

WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)7 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)4 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)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 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)1 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)1 Test (org.junit.Test)1