コード例 #1
0
  /**
   * helper method for updateClassifiers() in order to automatically layout an edge that is now from
   * and to the same node type.
   *
   * <p>adapted from SelectionWButtons from line 280
   */
  private void layoutThisToSelf() {

    FigPoly edgeShape = new FigPoly();
    // newFC = _content;
    Point fcCenter = new Point(getSourceFigNode().getX() / 2, getSourceFigNode().getY() / 2);
    Point centerRight =
        new Point((int) (fcCenter.x + getSourceFigNode().getSize().getWidth() / 2), fcCenter.y);

    int yoffset = (int) ((getSourceFigNode().getSize().getHeight() / 2));
    edgeShape.addPoint(fcCenter.x, fcCenter.y);
    edgeShape.addPoint(centerRight.x, centerRight.y);
    edgeShape.addPoint(centerRight.x + 30, centerRight.y);
    edgeShape.addPoint(centerRight.x + 30, centerRight.y + yoffset);
    edgeShape.addPoint(centerRight.x, centerRight.y + yoffset);

    // place the edge on the layer and update the diagram
    this.setBetweenNearestPoints(true);
    edgeShape.setLineColor(Color.black);
    edgeShape.setFilled(false);
    edgeShape.setComplete(true);
    this.setFig(edgeShape);
  }