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