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);
}
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;
}
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())));
}
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;
}
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;
}
Aggregations