예제 #1
0
 public void setLineWidth(int w) {
   _head.setLineWidth(w);
   _body.setLineWidth(w);
   _arms.setLineWidth(w);
   _leftLeg.setLineWidth(w);
   _rightLeg.setLineWidth(w);
 }
예제 #2
0
 public void setLineColor(Color col) {
   _head.setLineColor(col);
   _body.setLineColor(col);
   _arms.setLineColor(col);
   _leftLeg.setLineColor(col);
   _rightLeg.setLineColor(col);
 }
  /** Override setBounds to keep shapes looking right. {@inheritDoc} */
  @Override
  protected void setStandardBounds(int x, int y, int w, int h) {
    if (getNameFig() == null) {
      return;
    }
    Rectangle oldBounds = getBounds();
    Dimension nameDim = getNameFig().getMinimumSize();

    getNameFig().setBounds(x + MARGIN, y + SPACE_TOP, w - 2 * MARGIN, nameDim.height);
    divider.setShape(x, y + DIVIDER_Y + nameDim.height, x + w - 1, y + DIVIDER_Y + nameDim.height);

    getInternal()
        .setBounds(
            x + MARGIN,
            y + SPACE_TOP + nameDim.height + SPACE_MIDDLE,
            w - 2 * MARGIN,
            h - SPACE_TOP - nameDim.height - SPACE_MIDDLE - SPACE_BOTTOM);

    getBigPort().setBounds(x, y, w, h);
    cover.setBounds(x, y, w, h);

    calcBounds(); // _x = x; _y = y; _w = w; _h = h;
    updateEdges();
    firePropChange("bounds", oldBounds, getBounds());
  }
예제 #4
0
  public void setBounds(int x, int y, int w, int h) {
    int middle = w / 2;
    h = _h;
    Rectangle oldBounds = getBounds();
    _bigPort.setLocation(x + middle - _bigPort.getWidth() / 2, y + h - 65);
    _head.setLocation(x + middle - _head.getWidth() / 2, y + h - 65);
    _body.setLocation(x + middle, y + h - 50);
    _arms.setLocation(x + middle - _arms.getWidth() / 2, y + h - 45);
    _leftLeg.setLocation(x + middle - _leftLeg.getWidth(), y + h - 35);
    _rightLeg.setLocation(x + middle, y + h - 35);

    Dimension minTextSize = _name.getMinimumSize();
    _name.setBounds(
        x + middle - minTextSize.width / 2,
        y + h - minTextSize.height,
        minTextSize.width,
        minTextSize.height);

    updateEdges();
    _x = x;
    _y = y;
    _w = w;
    // do not set height
    firePropChange("bounds", oldBounds, getBounds());
  }
예제 #5
0
  private void constructFigs() {
    Color fg = getLineColor();
    Color fill = getFillColor();

    // Put this rectangle behind the rest, so it goes first
    FigRect bigPort = new ActorPortFigRect(X0, Y0, 0, 0, this);
    FigCircle head = new FigCircle(X0 + 2, Y0, 16, 15, fg, fill);
    FigLine body = new FigLine(X0 + 10, Y0 + 15, 20, 40, fg);
    FigLine arms = new FigLine(X0, Y0 + 20, 30, 30, fg);
    FigLine leftLeg = new FigLine(X0 + 10, Y0 + 30, 15, 55, fg);
    FigLine rightLeg = new FigLine(X0 + 10, Y0 + 30, 25, 55, fg);
    body.setLineWidth(LINE_WIDTH);
    arms.setLineWidth(LINE_WIDTH);
    leftLeg.setLineWidth(LINE_WIDTH);
    rightLeg.setLineWidth(LINE_WIDTH);

    getNameFig().setBounds(X0, Y0 + 45, 20, 20);

    getNameFig().setTextFilled(false);
    getNameFig().setFilled(false);
    getNameFig().setLineWidth(0);
    // initialize any other Figs here
    getStereotypeFig().setBounds(getBigPort().getCenter().x, getBigPort().getCenter().y, 0, 0);
    setSuppressCalcBounds(true);
    // add Figs to the FigNode in back-to-front order
    addFig(bigPort);
    addFig(getNameFig());
    addFig(head);
    addFig(body);
    addFig(arms);
    addFig(leftLeg);
    addFig(rightLeg);
    addFig(getStereotypeFig());
    setBigPort(bigPort);
    setSuppressCalcBounds(false);
  }
 /*
  * @see org.tigris.gef.presentation.Fig#setLineWidth(int)
  */
 @Override
 public void setLineWidth(int w) {
   cover.setLineWidth(w);
   divider.setLineWidth(w);
 }
 /*
  * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)
  */
 @Override
 public void setLineColor(Color col) {
   cover.setLineColor(col);
   divider.setLineColor(col);
 }
예제 #8
0
 /*
  * @see org.tigris.gef.presentation.Fig#deleteFromModel()
  */
 @Override
 public void deleteFromModel() {
   super.deleteFromModel();
   firePropChange("remove", null, null);
   notifier.sendNotification(new Notification("remove", this, 0));
 }