use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class WiresConnectorView method connect.
@SuppressWarnings("unchecked")
public T connect(final ShapeView headShapeView, final Connection headConnection, final ShapeView tailShapeView, final Connection tailConnection) {
final WiresShape headWiresShape = (WiresShape) headShapeView;
final WiresShape tailWiresShape = (WiresShape) tailShapeView;
return connect(headWiresShape.getMagnets(), headWiresShape.getGroup().getComputedLocation(), headConnection, tailWiresShape.getMagnets(), tailWiresShape.getGroup().getComputedLocation(), tailConnection);
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class WiresShapeView method consumeChildrenAndConnectors.
void consumeChildrenAndConnectors(final Consumer<IDrawable> primConsumer) {
// Move this shape.
primConsumer.accept(getContainer());
// Move child shapes.
final NFastArrayList<WiresShape> childShapes = getChildShapes();
if (null != childShapes) {
for (int i = 0; i < childShapes.size(); i++) {
final WiresShape shape = childShapes.get(i);
if (shape instanceof WiresShapeView) {
((WiresShapeView) shape).consumeChildrenAndConnectors(primConsumer);
} else {
primConsumer.accept(shape.getContainer());
}
}
}
// Move connectors.
if (null != getMagnets()) {
for (int i = 0; i < getMagnets().size(); i++) {
final WiresMagnet magnet = getMagnets().getMagnet(i);
final NFastArrayList<WiresConnection> connections = magnet.getConnections();
if (null != connections) {
for (int j = 0; j < connections.size(); j++) {
final WiresConnection connection = connections.get(j);
if (null != connection.getConnector()) {
primConsumer.accept(connection.getConnector().getGroup());
}
}
}
}
}
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CanvasViewTest method testRemoveChild.
@Test
@SuppressWarnings("unchecked")
public void testRemoveChild() {
final WiresShape wiresShape = mock(WiresShape.class);
final WiresShape parentWiresShape = mock(WiresShape.class);
tested.removeChildShape(parentWiresShape, wiresShape);
verify(parentWiresShape, times(1)).remove(eq(wiresShape));
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CanvasViewTest method testAddChild.
@Test
@SuppressWarnings("unchecked")
public void testAddChild() {
final WiresShape wiresShape = mock(WiresShape.class);
final WiresShape parentWiresShape = mock(WiresShape.class);
tested.addChildShape(parentWiresShape, wiresShape);
verify(parentWiresShape, times(1)).add(eq(wiresShape));
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class WiresUtilsTest method isWiresShapeWhenRegisteredWiresShape.
@Test
public void isWiresShapeWhenRegisteredWiresShape() {
final WiresShape ws = new WiresShape(new MultiPath());
WiresUtils.assertShapeGroup(ws.getContainer(), WiresCanvas.WIRES_CANVAS_GROUP_ID);
assertTrue(WiresUtils.isWiresShape(ws));
}
Aggregations