use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method onMove.
@Override
public boolean onMove(final double dx, final double dy) {
if (isOutOfBounds(dx, dy)) {
return true;
}
delta = new Point2D(dx, dy);
// Delegate location deltas to shape controls and obtain current locations for each one.
final Collection<WiresShape> shapes = selectedShapes;
if (!shapes.isEmpty()) {
final WiresManager wiresManager = shapes.iterator().next().getWiresManager();
final Point2D[] locs = new Point2D[shapes.size()];
int i = 0;
for (final WiresShape shape : shapes) {
shape.getControl().onMove(dx, dy);
locs[i++] = getCandidateShapeLocationRelativeToInitialParent(shape);
}
// Check if new locations are allowed.
final WiresShape[] shapesArray = toArray(shapes);
final boolean locationAllowed = wiresManager.getLocationAcceptor().allow(shapesArray, locs);
// Do the updates.
if (locationAllowed) {
i = 0;
for (final WiresShape shape : shapes) {
shape.getControl().getParentPickerControl().setShapeLocation(locs[i++]);
postUpdateShape(shape);
}
}
}
final Collection<WiresConnector> connectors = selectedConnectors;
if (!connectors.isEmpty()) {
// Update connectors and connections.
for (final WiresConnector connector : connectors) {
final WiresConnector.WiresConnectorHandler handler = connector.getWiresConnectorHandler();
handler.getControl().move(dx, dy, true, true);
WiresConnector.updateHeadTailForRefreshedConnector(connector);
}
}
ShapeControlUtils.updateSpecialConnections(m_connectorsWithSpecialConnections, false);
return false;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method reset.
@Override
public void reset() {
for (final WiresShape shape : selectedShapes) {
shape.getControl().reset();
enableDocking(shape.getControl());
}
for (final WiresConnector connector : selectedConnectors) {
final WiresConnector.WiresConnectorHandler handler = connector.getWiresConnectorHandler();
handler.getControl().reset();
WiresConnector.updateHeadTailForRefreshedConnector(connector);
}
clearState();
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method execute.
@Override
public void execute() {
for (final WiresShape shape : selectedShapes) {
shape.getControl().getContainmentControl().execute();
postUpdateShape(shape);
}
for (final WiresConnector connector : selectedConnectors) {
connector.getWiresConnectorHandler();
WiresConnector.updateHeadTailForRefreshedConnector(connector);
}
ShapeControlUtils.updateSpecialConnections(m_connectorsWithSpecialConnections, true);
clear();
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method clear.
@Override
public void clear() {
for (final WiresShape shape : selectedShapes) {
shape.getControl().clear();
enableDocking(shape.getControl());
}
clearState();
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeShapeHandler method doAdjust.
@Override
protected boolean doAdjust(final Point2D dxy) {
final boolean adjusted = shapeControl.onMove(dxy.getX(), dxy.getY());
if (adjusted) {
dxy.set(shapeControl.getAdjust());
return true;
}
boolean shouldRestore = true;
if (shapeControl.isAllowed()) {
final WiresContainer parent = shapeControl.getSharedParent();
if ((null != parent) && (parent instanceof WiresShape)) {
highlight.highlight((WiresShape) parent, PickerPart.ShapePart.BODY);
shouldRestore = false;
}
}
if (shouldRestore) {
highlight.restore();
}
return false;
}
Aggregations