コード例 #1
0
ファイル: SegmentPath.java プロジェクト: skryzhny/cmf
  public void straightPath() {
    Segment s = ConnectionUtils.computeSegment(startShape, endShape);

    if (s == null) {
      throw new DiagramViewNotDisplayedException();
    }

    pointList = Arrays.asList(s.getStartPoint(), s.getEndPoint());
  }
コード例 #2
0
ファイル: SegmentPath.java プロジェクト: skryzhny/cmf
  public void update() throws DiagramViewNotDisplayedException {
    if (pointList.size() > 2) {
      Segment startSegment = ConnectionUtils.computeSegment(startShape, pointList.get(1));
      pointList.set(0, startSegment.getStartPoint());

      Segment endSegment =
          ConnectionUtils.computeSegment(pointList.get(pointList.size() - 2), endShape);
      pointList.set(pointList.size() - 1, endSegment.getEndPoint());
    } else {
      // There is only one segment
      Segment s = ConnectionUtils.computeSegment(startShape, endShape);
      if (s == null) {
        throw new DiagramViewNotDisplayedException();
      }

      pointList.set(0, s.getStartPoint());
      pointList.set(1, s.getEndPoint());
    }
  }