Example #1
0
  /**
   * Constructor.
   *
   * @param edge the Edge to layout
   */
  public ClassdiagramEdge(FigEdge edge) {
    currentEdge = edge;
    underlyingFig = new FigPoly();
    underlyingFig.setLineColor(edge.getFig().getLineColor());

    destFigNode = edge.getDestFigNode();
    sourceFigNode = edge.getSourceFigNode();
  }
  /**
   * 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);
  }
Example #3
0
 /*
  * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)
  */
 @Override
 public void setLineColor(Color col) {
   // The text element has no border, so the line color doesn't matter.
   outlineFig.setLineColor(col);
   urCorner.setLineColor(col);
 }