use of com.ait.lienzo.client.core.shape.wires.WiresConnector in project kie-wb-common by kiegroup.
the class WiresCanvasView method addShape.
@Override
public WiresCanvas.View addShape(final ShapeView<?> shapeView) {
if (WiresUtils.isWiresShape(shapeView)) {
WiresShape wiresShape = (WiresShape) shapeView;
wiresManager.register(wiresShape);
wiresManager.getMagnetManager().createMagnets(wiresShape, getMagnetCardinals());
WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
} else if (WiresUtils.isWiresConnector(shapeView)) {
WiresConnector wiresConnector = (WiresConnector) shapeView;
final WiresConnectorControl connectorControl = wiresManager.register(wiresConnector);
if (shapeView instanceof WiresConnectorView) {
((WiresConnectorView) shapeView).setControl(connectorControl);
}
WiresUtils.assertShapeGroup(wiresConnector.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
} else {
super.addShape(shapeView);
}
return this;
}
use of com.ait.lienzo.client.core.shape.wires.WiresConnector in project kie-wb-common by kiegroup.
the class WiresCanvasView method removeShape.
@Override
public WiresCanvas.View removeShape(final ShapeView<?> shapeView) {
if (WiresUtils.isWiresShape(shapeView)) {
WiresShape wiresShape = (WiresShape) shapeView;
wiresManager.deregister(wiresShape);
} else if (WiresUtils.isWiresConnector(shapeView)) {
WiresConnector wiresConnector = (WiresConnector) shapeView;
wiresManager.deregister(wiresConnector);
} else {
super.removeShape(shapeView);
}
return this;
}
use of com.ait.lienzo.client.core.shape.wires.WiresConnector in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method onMoveStart.
@Override
public void onMoveStart(final double x, final double y) {
delta = new Point2D(0, 0);
selectedShapes = new ArrayList<>(selectionContext.getShapes());
selectedConnectors = new ArrayList<>(selectionContext.getConnectors());
final Map<String, WiresConnector> connectors = new HashMap<>();
for (final WiresShape shape : selectedShapes) {
ShapeControlUtils.collectionSpecialConnectors(shape, connectors);
if (shape.getMagnets() != null) {
// Must do magnets first, to avoid attribute change updates being processed.
shape.getMagnets().onNodeDragStart(null);
// Don't need to do this for nested objects, as those just move with their containers, without attribute changes
}
disableDocking(shape.getControl());
final Point2D location = shape.getComputedLocation();
final double sx = location.getX();
final double sy = location.getY();
shape.getControl().onMoveStart(sx, sy);
}
m_connectorsWithSpecialConnections = connectors.values().toArray(new WiresConnector[connectors.size()]);
for (final WiresConnector connector : selectedConnectors) {
final WiresConnector.WiresConnectorHandler handler = connector.getWiresConnectorHandler();
// records the start position of all the points
handler.getControl().onMoveStart(x, y);
WiresConnector.updateHeadTailForRefreshedConnector(connector);
}
}
use of com.ait.lienzo.client.core.shape.wires.WiresConnector in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method onMoveComplete.
@Override
public boolean onMoveComplete() {
boolean completeResult = true;
final Collection<WiresShape> shapes = selectedShapes;
if (!shapes.isEmpty()) {
shapes.iterator().next().getWiresManager();
for (final WiresShape shape : shapes) {
if (!shape.getControl().onMoveComplete()) {
completeResult = false;
}
}
}
final Collection<WiresConnector> connectors = selectedConnectors;
if (!connectors.isEmpty()) {
// Update connectors and connections.
for (final WiresConnector connector : connectors) {
if (!connector.getWiresConnectorHandler().getControl().onMoveComplete()) {
completeResult = false;
}
}
}
delta = new Point2D(0, 0);
return completeResult;
}
use of com.ait.lienzo.client.core.shape.wires.WiresConnector in project kie-wb-common by kiegroup.
the class ShapeViewDragProxyImpl method show.
@Override
public DragProxy<AbstractCanvas, ShapeView<?>, DragProxyCallback> show(final ShapeView<?> item, final int x, final int y, final DragProxyCallback callback) {
final AbstractDragProxy.Callback c = new AbstractDragProxy.Callback() {
@Override
public void onStart(final int x, final int y) {
callback.onStart(x, y);
}
@Override
public void onMove(final int x, final int y) {
callback.onMove(x, y);
}
@Override
public void onComplete(final int x, final int y) {
callback.onComplete(x, y);
}
};
if (item instanceof WiresShape) {
final WiresShape wiresShape = (WiresShape) item;
this.proxy = new WiresShapeDragProxy(getLayer().getLienzoLayer(), wiresShape, x, y, 100, c);
} else if (item instanceof WiresConnector) {
final WiresConnector wiresConnector = (WiresConnector) item;
this.proxy = new WiresConnectorDragProxy(getLayer().getLienzoLayer(), wiresConnector, x, y, 100, c);
}
return this;
}
Aggregations