Package com.positive.charts.util

Examples of com.positive.charts.util.Size2D


   * @return The size following the arrangement.
   */
  protected Size2D arrangeFR(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    final Size2D s = this.arrangeFN(container, g2, constraint);
    if (constraint.getHeightRange().contains(s.height)) {
      return s;
    } else {
      final RectangleConstraint c = constraint.toFixedHeight(constraint
          .getHeightRange().constrain(s.getHeight()));
      return this.arrangeFF(container, g2, c);
    }
  }
View Full Code Here


   * @return The size after the arrangement.
   */
  protected Size2D arrangeNN(final BlockContainer container, final GC g2) {
    final List blocks = container.getBlocks();
    final Block b = (Block) blocks.get(0);
    final Size2D s = b.arrange(g2, RectangleConstraint.NONE);
    b.setBounds(new Rectangle(0, 0, (int) s.width, (int) s.height));
    return new Size2D(s.width, s.height);
  }
View Full Code Here

   * @return The size following the arrangement.
   */
  protected Size2D arrangeRF(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    final Size2D s = this.arrangeNF(container, g2, constraint);
    if (constraint.getWidthRange().contains(s.width)) {
      return s;
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().constrain(s.getWidth()));
      return this.arrangeFF(container, g2, c);
    }
  }
View Full Code Here

   */
  protected Size2D arrangeRN(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {
    // first arrange without constraints, then see if the width fits
    // within the required range...if not, call arrangeFN() at max width
    final Size2D s1 = this.arrangeNN(container, g2);
    if (constraint.getWidthRange().contains(s1.width)) {
      return s1;
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().getUpperBound());
View Full Code Here

  protected Size2D arrangeRR(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    // first arrange without constraints, and see if this fits within
    // the required ranges...
    final Size2D s1 = this.arrangeNN(container, g2);
    if (constraint.getWidthRange().contains(s1.width)) {
      return s1; // TODO: we didn't check the height yet
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().getUpperBound());
View Full Code Here

   *            the constraint (<code>null</code> not permitted).
   *
   * @return The block size (in Java2D units, never <code>null</code>).
   */
  public Size2D arrange(final GC g2, final RectangleConstraint constraint) {
    final Size2D base = new Size2D(this
        .calculateTotalWidth(this.getWidth()), this
        .calculateTotalHeight(this.getHeight()));
    return constraint.calculateConstrainedSize(base);
  }
View Full Code Here

        return this.arrangeRF(container, g2, constraint);
      } else if (h == LengthConstraintType.RANGE) {
        return this.arrangeRR(container, g2, constraint);
      }
    }
    return new Size2D(); // TODO: complete this

  }
View Full Code Here

    double y = 0.0;
    double maxWidth = 0.0;
    final List itemsInColumn = new ArrayList();
    for (int i = 0; i < blocks.size(); i++) {
      final Block block = (Block) blocks.get(i);
      final Size2D size = block.arrange(g2, RectangleConstraint.NONE);
      if (y + size.height <= height) {
        itemsInColumn.add(block);
        block.setBounds(RectUtils.doubleRect(x, y, size.width,
            size.height));
        y = y + size.height + this.verticalGap;
        maxWidth = Math.max(maxWidth, size.width);
      } else {
        if (itemsInColumn.isEmpty()) {
          // place in this column (truncated) anyway
          block.setBounds(RectUtils.doubleRect(x, y, size.width, Math
              .min(size.height, height - y)));
          y = 0.0;
          x = x + size.width + this.horizontalGap;
        } else {
          // start new column
          itemsInColumn.clear();
          x = x + maxWidth + this.horizontalGap;
          y = 0.0;
          maxWidth = size.width;
          block.setBounds(RectUtils.doubleRect(x, y, size.width, Math
              .min(size.height, height)));
          y = size.height + this.verticalGap;
          itemsInColumn.add(block);
        }
      }
    }
    return new Size2D(x + maxWidth, constraint.getHeight());
  }
View Full Code Here

            // TODO: shift block over to right
          }
        }
      }
    }
    return new Size2D(maxWidth, height);
  }
View Full Code Here

   * @return The size of the container after arrangement.
   */
  protected Size2D arrangeRF(final BlockContainer container, final GC g2,
      final RectangleConstraint constraint) {

    final Size2D s = this.arrangeNF(container, g2, constraint);
    if (constraint.getWidthRange().contains(s.width)) {
      return s;
    } else {
      final RectangleConstraint c = constraint.toFixedWidth(constraint
          .getWidthRange().constrain(s.getWidth()));
      return this.arrangeFF(container, g2, c);
    }
  }
View Full Code Here

TOP

Related Classes of com.positive.charts.util.Size2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.