use of com.ait.lienzo.client.core.shape.wires.WiresContainer in project kie-wb-common by kiegroup.
the class CaseManagementContainmentControl method restore.
private void restore(final AbstractCaseManagementShape ghost) {
final WiresContainer originalParent = state.getOriginalParent().get();
final int originalIndex = state.getOriginalIndex().get();
restore(ghost, originalParent, originalIndex);
}
use of com.ait.lienzo.client.core.shape.wires.WiresContainer 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.WiresContainer in project lienzo-core by ahome-it.
the class WiresShapeLocationControlImpl method onMoveStart.
@Override
public void onMoveStart(final double x, final double y) {
m_delta = new Point2D(0, 0);
shapeResetLocation = getShape().getLocation();
shapeInitialLocation = getShape().getComputedLocation();
m_mouseStartX = x;
m_mouseStartY = y;
final Point2D absShapeLoc = m_shape.getPath().getComputedLocation();
final BoundingBox box = m_shape.getPath().getBoundingBox();
m_shapeStartCenterX = absShapeLoc.getX() + (box.getWidth() / 2);
m_shapeStartCenterY = absShapeLoc.getY() + (box.getHeight() / 2);
m_startDocked = false;
final WiresContainer parent = m_shape.getParent();
if ((parent != null) && (parent instanceof WiresShape)) {
if (m_shape.getDockedTo() != null) {
m_startDocked = true;
}
}
}
use of com.ait.lienzo.client.core.shape.wires.WiresContainer 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.WiresContainer 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;
}
Aggregations