use of com.ait.lienzo.client.core.shape.wires.WiresShape 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.WiresShape 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.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasView method addShape.
@Override
public WiresCanvas.View addShape(final ShapeView<?> shapeView) {
if (WiresUtils.isWiresShape(shapeView)) {
WiresShape wiresShape = (WiresShape) shapeView;
wiresManager.register(wiresShape, false);
WiresUtils.assertShapeGroup(wiresShape.getGroup(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
} else if (WiresUtils.isWiresConnector(shapeView)) {
// Don't render connectors
} else {
super.addShape(shapeView);
}
return this;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class ActivityView method createGhost.
@Override
protected AbstractCaseManagementShape createGhost() {
final ActivityView ghost = new ActivityView(getWidth(), getHeight());
for (WiresShape ws : getChildShapes()) {
final AbstractCaseManagementShape wsg = ((AbstractCaseManagementShape) ws).getGhost();
ghost.add(wsg);
}
return ghost;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class HorizontalStackLayoutManager method orderChildren.
@Override
protected void orderChildren(final WiresShape shape, final WiresContainer container, final Point2D mouseRelativeLoc) {
if (container == null) {
return;
}
final double shapeX = mouseRelativeLoc.getX();
final NFastArrayList<WiresShape> nChildren = container.getChildShapes().copy();
final List<WiresShape> children = nChildren.remove(shape).toList();
int targetIndex = children.size();
for (int idx = 0; idx < children.size(); idx++) {
final WiresShape child = children.get(idx);
if (shapeX < child.getX()) {
targetIndex = idx;
break;
}
}
if (container instanceof AbstractCaseManagementShape) {
final int currentIndex = ((AbstractCaseManagementShape) container).getIndex(shape);
if (currentIndex != targetIndex) {
((AbstractCaseManagementShape) container).addShape(shape, targetIndex);
}
}
}
Aggregations