private void drawEdge() { if (inEdge.getContent() instanceof ViewConnector) { final ViewConnector viewConnector = (ViewConnector) inEdge.getContent(); final MagnetConnection[] connections = createShapeConnections(); viewConnector.setSourceConnection(connections[0]); viewConnector.setTargetConnection(connections[1]); } NodeDragProxyImpl.this.transientEdgeShape.applyConnections(inEdge, edgeSourceNodeShape.getShapeView(), nodeShape.getShapeView(), MutationContext.STATIC); }
@SuppressWarnings("unchecked") public static void applyConnections(final Edge<?, ?> edge, final CanvasHandler canvasHandler, final MutationContext mutationContext) { final Canvas<?> canvas = canvasHandler.getCanvas(); final Node sourceNode = edge.getSourceNode(); final Node targetNode = edge.getTargetNode(); final Shape<?> source = sourceNode != null ? canvas.getShape(sourceNode.getUUID()) : null; final Shape<?> target = targetNode != null ? canvas.getShape(targetNode.getUUID()) : null; EdgeShape connector = (EdgeShape) canvas.getShape(edge.getUUID()); connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); }
@SuppressWarnings("unchecked") private void updateConnections(final AbstractCanvasHandler context, final Edge edge, final Node sourceNode, final Node targetNode) { if (null != edge && null != sourceNode && null != targetNode) { final EdgeShape edgeShape = (EdgeShape) context.getCanvas().getShape(edge.getUUID()); final Shape sourceNodeShape = context.getCanvas().getShape(sourceNode.getUUID()); final Shape targetNodeShape = context.getCanvas().getShape(targetNode.getUUID()); edgeShape.applyConnections(edge, sourceNodeShape.getShapeView(), targetNodeShape.getShapeView(), MutationContext.STATIC); } }
@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); } }