コード例 #1
0
ファイル: FigComment.java プロジェクト: kopl/misc
  /*
   * @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
   */
  @Override
  protected void setStandardBounds(int px, int py, int w, int h) {
    if (bodyTextFig == null) {
      return;
    }

    Dimension stereoMin = getStereotypeFig().getMinimumSize();

    int stereotypeHeight = 0;
    if (getStereotypeFig().isVisible()) {
      stereotypeHeight = stereoMin.height;
    }

    Rectangle oldBounds = getBounds();

    // Resize the text figure
    bodyTextFig.setBounds(
        px + 2, py + 2 + stereotypeHeight, w - 4 - dogear, h - 4 - stereotypeHeight);

    getStereotypeFig().setBounds(px + 2, py + 2, w - 4 - dogear, stereoMin.height);

    // Resize the big port around the figure
    getBigPort().setBounds(px, py, w, h);

    // Since this is a complex polygon, there's no easy way to resize it.
    Polygon newPoly = new Polygon();
    newPoly.addPoint(px, py);
    newPoly.addPoint(px + w - 1 - dogear, py);
    newPoly.addPoint(px + w - 1, py + dogear);
    newPoly.addPoint(px + w - 1, py + h - 1);
    newPoly.addPoint(px, py + h - 1);
    newPoly.addPoint(px, py);
    outlineFig.setPolygon(newPoly);

    // Just move the corner to it's new position.
    urCorner.setBounds(px + w - 1 - dogear, py, dogear, dogear);

    calcBounds(); // _x = x; _y = y; _w = w; _h = h;
    firePropChange("bounds", oldBounds, getBounds());
  }