示例#1
0
文件: FigComment.java 项目: kopl/misc
  private void initialize() {
    Color fg = super.getLineColor(); // Use super because not fully init'd
    Color fill = super.getFillColor();

    outlineFig = new FigPoly(fg, fill);
    outlineFig.addPoint(0, 0);
    outlineFig.addPoint(width - 1 - dogear, 0);
    outlineFig.addPoint(width - 1, dogear);
    outlineFig.addPoint(width - 1, height - 1);
    outlineFig.addPoint(0, height - 1);
    outlineFig.addPoint(0, 0);
    outlineFig.setFilled(true);
    outlineFig.setLineWidth(LINE_WIDTH);

    urCorner = new FigPoly(fg, fill);
    urCorner.addPoint(width - 1 - dogear, 0);
    urCorner.addPoint(width - 1, dogear);
    urCorner.addPoint(width - 1 - dogear, dogear);
    urCorner.addPoint(width - 1 - dogear, 0);
    urCorner.setFilled(true);
    Color col = outlineFig.getFillColor();
    urCorner.setFillColor(col.darker());
    urCorner.setLineWidth(LINE_WIDTH);

    setBigPort(new FigRect(0, 0, width, height, null, null));
    getBigPort().setFilled(false);
    getBigPort().setLineWidth(0);

    // add Figs to the FigNode in back-to-front order
    addFig(getBigPort());
    addFig(outlineFig);
    addFig(urCorner);
    addFig(getStereotypeFig());
    addFig(bodyTextFig);

    col = outlineFig.getFillColor();
    urCorner.setFillColor(col.darker());

    setBlinkPorts(false); // make port invisible unless mouse enters
    Rectangle r = getBounds();
    setBounds(r.x, r.y, r.width, r.height);
    updateEdges();

    readyToEdit = false;
    // Mark this as newly created. This is to get round the problem with
    // creating figs for loaded comments that had stereotypes. They are
    // saved with their dimensions INCLUDING the stereotype, but since we
    // pretend the stereotype is not visible, we add height the first time
    // we render such a comment. This is a complete fudge, and really we
    // ought to address how comment objects with stereotypes are saved. But
    // that will be hard work.
    newlyCreated = true;
  }
示例#2
0
文件: FigComment.java 项目: kopl/misc
 /*
  * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)
  */
 @Override
 public void setFillColor(Color col) {
   outlineFig.setFillColor(col);
   urCorner.setFillColor(col);
 }