@Test @SuppressWarnings("unchecked") public void testApplyConnections() { final Shape startNodeShape = mock(Shape.class); final ShapeView startNodeShapeView = mock(ShapeView.class); final Shape intermNodeShape = mock(Shape.class); final ShapeView intermNodeShapeView = mock(ShapeView.class); final EdgeShape edge1EdgeShape = mock(EdgeShape.class); when(canvas.getShape(eq(instance2.startNode.getUUID()))).thenReturn(startNodeShape); when(canvas.getShape(eq(instance2.intermNode.getUUID()))).thenReturn(intermNodeShape); when(canvas.getShape(eq(instance2.edge1.getUUID()))).thenReturn(edge1EdgeShape); when(startNodeShape.getShapeView()).thenReturn(startNodeShapeView); when(intermNodeShape.getShapeView()).thenReturn(intermNodeShapeView); when(edge1EdgeShape.getShapeView()).thenReturn(edge1ShapeView); ShapeUtils.applyConnections(instance2.edge1, canvasHandler, MutationContext.STATIC); verify(edge1EdgeShape, times(1)).applyConnections(eq(instance2.edge1), eq(startNodeShapeView), eq(intermNodeShapeView), eq(MutationContext.STATIC)); }
@SuppressWarnings("unchecked") public static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge, final AbstractCanvasHandler 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()); if (connector != null) { connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); } updateEdgeConnections(edge, canvasHandler); }
ShapeUtils { @SuppressWarnings("unchecked") public static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge, final AbstractCanvasHandler 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()); if (connector != null) { connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); } updateEdgeConnections(edge, canvasHandler); } }
ShapeUtils { @SuppressWarnings("unchecked") public static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge, final AbstractCanvasHandler 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()); if (connector != null) { connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); } updateEdgeConnections(edge, canvasHandler); }  }
ShapeUtils { @SuppressWarnings("unchecked") public static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge, final AbstractCanvasHandler 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()); if (connector != null) { connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); } updateEdgeConnections(edge, canvasHandler); }  @SuppressWarnings("unchecked") static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge,
                                        final AbstractCanvasHandler canvasHandler,
                                        final MutationContext mutationContext); static ConnectorShape getConnectorShape(Edge edge, CanvasHandler canvasHandler); @SuppressWarnings("unchecked") static void updateEdgeConnections(final Edge<? extends ViewConnector<?>, Node> edge,
                                             final AbstractCanvasHandler context); @SuppressWarnings("unchecked") static void updateEdgeConnection(final AbstractCanvasHandler context,
                                            final Connection connection,
                                            final Node<? extends View<?>, Edge> node); static void enforceLocationConstraints(final ShapeView shape,
                                                  final Bounds bounds); @SuppressWarnings("unchecked") static void moveViewConnectorsToTop(final AbstractCanvasHandler canvasHandler,
                                               final Node<?, Edge> node); static double getRadiusForBoundingBox(final double width,
                                                 final double height); static void setSizeFromBoundingBox(final ShapeView view,
                                              final double boundingBoxWidth,
                                              final double boundingBoxHeight); static double dist(final double x0,
                              final double y0,
                              final double x1,
                              final double y1); }
ShapeUtils { @SuppressWarnings("unchecked") public static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge, final AbstractCanvasHandler 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()); if (connector != null) { connector.applyConnections(edge, source != null ? source.getShapeView() : null, target != null ? target.getShapeView() : null, mutationContext); } updateEdgeConnections(edge, canvasHandler); }  @SuppressWarnings("unchecked") static void applyConnections(final Edge<? extends ViewConnector<?>, Node> edge,
                                        final AbstractCanvasHandler canvasHandler,
                                        final MutationContext mutationContext); static ConnectorShape getConnectorShape(Edge edge, CanvasHandler canvasHandler); @SuppressWarnings("unchecked") static void updateEdgeConnections(final Edge<? extends ViewConnector<?>, Node> edge,
                                             final AbstractCanvasHandler context); @SuppressWarnings("unchecked") static void updateEdgeConnection(final AbstractCanvasHandler context,
                                            final Connection connection,
                                            final Node<? extends View<?>, Edge> node); static void enforceLocationConstraints(final ShapeView shape,
                                                  final Bounds bounds); @SuppressWarnings("unchecked") static void moveViewConnectorsToTop(final AbstractCanvasHandler canvasHandler,
                                               final Node<?, Edge> node); static double getRadiusForBoundingBox(final double width,
                                                 final double height); static void setSizeFromBoundingBox(final ShapeView view,
                                              final double boundingBoxWidth,
                                              final double boundingBoxHeight); static double dist(final double x0,
                              final double y0,
                              final double x1,
                              final double y1);  }