private Rectangle calcBounds() {
   Dimension size = columnHead.getPrefSize();
   int width = column.getWidth();
   int height = chart.getColumnHeadHeight() + chart.getMajorSpacing();
   int x = column.getLeft() + (width - size.width) / 2;
   int y =
       chart.getTitle().getTopicPart().getFigure().getBounds().bottom()
           + chart.getLineWidth()
           + (height - size.height) / 2;
   if (chart.getTitle().getInfoPart() != null) {
     y += chart.getTitle().getInfoPart().getFigure().getBounds().height;
   }
   return new Rectangle(x, y, size.width, size.height);
 }
Beispiel #2
0
  private void ensurePosition() {
    if (this.left != null && this.width != null) return;

    int lineWidth = getOwnedChart().getLineWidth();
    int index = getOwnedChart().getColumnIndex(this);
    IInsertion ins =
        (IInsertion)
            MindMapUtils.getCache(getOwnedChart().getTitle(), Spreadsheet.CACHE_COLUMN_INSERTION);
    int x;
    if (index == 0) {

      x =
          getOwnedChart().getTitle().getFigure().getBounds().x
              + lineWidth
              + getOwnedChart().getRowHeadWidth()
              + lineWidth
              + getOwnedChart().getMinorSpacing();
    } else {
      Column prev = getOwnedChart().getColumn(index - 1);
      x = prev.getRight() + lineWidth;
    }
    if (ins != null && ins.getIndex() == index) {
      x += ins.getSize().width + getOwnedChart().getMinorSpacing() + lineWidth;
    }
    this.left = Integer.valueOf(x);

    int w;
    int numCols = getOwnedChart().getNumColumns();
    if (index == numCols - 1) {
      int right = getOwnedChart().getTitle().getFigure().getBounds().right();
      //            System.out.println(head.toString() + ": (" + left.intValue() + ","
      //                    + right + ")");
      if (ins != null && ins.getIndex() == numCols) {
        right -= ins.getSize().width + getOwnedChart().getMinorSpacing() + lineWidth;
      }
      w = right - lineWidth - this.left.intValue();
    } else {
      int headWidth = head.getPrefSize().width;
      w = Math.max(headWidth, getPrefCellWidth()) + getOwnedChart().getMinorSpacing();
    }
    this.width = Integer.valueOf(w);
  }
Beispiel #3
0
 public int compareTo(Column o) {
   return getOwnedChart().getPrefColumnOrder().compareColumns(getHead(), o.getHead());
 }