Search in sources :

Example 11 with WiresConnection

use of com.ait.lienzo.client.core.shape.wires.WiresConnection in project kie-wb-common by kiegroup.

the class LogMagnetsDevCommand method logMagnets.

private void logMagnets(Element<? extends View<?>> element) {
    if (null != element.asNode()) {
        final Shape shape = getCanvasHandler().getCanvas().getShape(element.getUUID());
        final WiresShape wiresShape = (WiresShape) shape.getShapeView();
        final MagnetManager.Magnets magnets = wiresShape.getMagnets();
        if (null != magnets) {
            log("---- Magnets [" + element.getUUID() + "] ------");
            for (int i = 0; i < magnets.size(); i++) {
                WiresMagnet magnet = magnets.getMagnet(i);
                NFastArrayList<WiresConnection> connections = magnet.getConnections();
                WiresConnector connector = null;
                if (null != connections && !connections.isEmpty()) {
                    WiresConnection connection = connections.iterator().next();
                    connector = connection.getConnector();
                }
                log("[" + i + "] - " + connector);
            }
            log("-------------------------------------------------------");
        } else {
            log("No magnets are set.");
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector) Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnection(com.ait.lienzo.client.core.shape.wires.WiresConnection) MagnetManager(com.ait.lienzo.client.core.shape.wires.MagnetManager) WiresMagnet(com.ait.lienzo.client.core.shape.wires.WiresMagnet)

Aggregations

WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)11 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)8 Test (org.junit.Test)6 MagnetManager (com.ait.lienzo.client.core.shape.wires.MagnetManager)5 Point2D (com.ait.lienzo.client.core.types.Point2D)5 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)4 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)3 MagnetConnection (org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection)3 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)2 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)2 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)2 Group (com.ait.lienzo.client.core.shape.Group)1 IDrawable (com.ait.lienzo.client.core.shape.IDrawable)1 IPrimitive (com.ait.lienzo.client.core.shape.IPrimitive)1 OrthogonalPolyLine (com.ait.lienzo.client.core.shape.OrthogonalPolyLine)1 Shape (com.ait.lienzo.client.core.shape.Shape)1 ControlHandleList (com.ait.lienzo.client.core.shape.wires.ControlHandleList)1 IControlHandleList (com.ait.lienzo.client.core.shape.wires.IControlHandleList)1 ScratchPad (com.ait.lienzo.client.core.util.ScratchPad)1 NFastArrayList (com.ait.tooling.nativetools.client.collection.NFastArrayList)1