Search in sources :

Example 6 with EdgeShape

use of org.kie.workbench.common.stunner.core.client.shape.EdgeShape in project kie-wb-common by kiegroup.

the class NodeBuilderControlImpl method updateConnectorShape.

@SuppressWarnings("unchecked")
protected void updateConnectorShape(final Edge<? extends ViewConnector<?>, Node> inEdge, final Node targetNode, final Connection sourceConnection, final Connection targetConnection) {
    final ViewConnector connectorContent = (ViewConnector) inEdge.getContent();
    canvasHandler.applyElementMutation(inEdge, MutationContext.STATIC);
    final EdgeShape edgeShape = (EdgeShape) canvasHandler.getCanvas().getShape(inEdge.getUUID());
    final Node source = inEdge.getSourceNode();
    if (null != source && null != targetNode) {
        final Shape<?> sShape = canvasHandler.getCanvas().getShape(source.getUUID());
        final Shape<?> tShape = canvasHandler.getCanvas().getShape(targetNode.getUUID());
        connectorContent.setSourceConnection(sourceConnection);
        connectorContent.setTargetConnection(targetConnection);
        edgeShape.applyConnections(inEdge, sShape.getShapeView(), tShape.getShapeView(), MutationContext.STATIC);
    }
}
Also used : EdgeShape(org.kie.workbench.common.stunner.core.client.shape.EdgeShape) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Node(org.kie.workbench.common.stunner.core.graph.Node)

Aggregations

EdgeShape (org.kie.workbench.common.stunner.core.client.shape.EdgeShape)6 Node (org.kie.workbench.common.stunner.core.graph.Node)4 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)3 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 Test (org.junit.Test)1 WiresConnectorView (org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresConnectorView)1 WiresShapeView (org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresShapeView)1 AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)1 DragProxyCallback (org.kie.workbench.common.stunner.core.client.components.drag.DragProxyCallback)1 ElementShape (org.kie.workbench.common.stunner.core.client.shape.ElementShape)1 ShapeFactory (org.kie.workbench.common.stunner.core.client.shape.factory.ShapeFactory)1 ConnectorShape (org.kie.workbench.common.stunner.core.client.shape.impl.ConnectorShape)1 ShapeView (org.kie.workbench.common.stunner.core.client.shape.view.ShapeView)1 MagnetConnection (org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection)1