@Test public void testCreateBPMNEdge() { BPMNShape sourceShape = mockShape(SOURCE_SHAPE_ID, 1, 1, 4, 4); BPMNShape targetShape = mockShape(TARGET_SHAPE_ID, 10, 10, 4, 4); when(sourceWriter.getShape()).thenReturn(sourceShape); when(targetWriter.getShape()).thenReturn(targetShape); Connection sourceConnection = mockConnection(1, 1); Connection targetConnection = mockConnection(10, 10); ControlPoint[] controlPoints = new ControlPoint[]{ new ControlPoint(Point2D.create(3, 3)), new ControlPoint(Point2D.create(4, 4)), new ControlPoint(Point2D.create(5, 5)) }; BPMNEdge edge = PropertyWriterUtils.createBPMNEdge(sourceWriter, targetWriter, sourceConnection, controlPoints, targetConnection); assertEquals("edge_SOURCE_SHAPE_ID_to_TARGET_SHAPE_ID", edge.getId()); assertWaypoint(2, 2, 0, edge.getWaypoint()); assertWaypoint(3, 3, 1, edge.getWaypoint()); assertWaypoint(4, 4, 2, edge.getWaypoint()); assertWaypoint(5, 5, 3, edge.getWaypoint()); assertWaypoint(20, 20, 4, edge.getWaypoint()); }
public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; }
PropertyWriterUtils { public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; } }
PropertyWriterUtils { public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; }  }
PropertyWriterUtils { public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; }  static BPMNEdge createBPMNEdge(BasePropertyWriter source,
                                          BasePropertyWriter target,
                                          Connection sourceConnection,
                                          ControlPoint[] mid,
                                          Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport); }
PropertyWriterUtils { public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; }  static BPMNEdge createBPMNEdge(BasePropertyWriter source,
                                          BasePropertyWriter target,
                                          Connection sourceConnection,
                                          ControlPoint[] mid,
                                          Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport);  }