Examples of RectangleConstraint


Examples of com.positive.charts.block.RectangleConstraint

   *            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 RectangleConstraint contentConstraint = this
        .toContentConstraint(constraint);
    final LengthConstraintType w = contentConstraint
        .getWidthConstraintType();
    final LengthConstraintType h = contentConstraint
        .getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
      if (h == LengthConstraintType.NONE) {
        contentSize = this.arrangeNN(g2);
      } else if (h == LengthConstraintType.RANGE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.FIXED) {
        throw new RuntimeException("Not yet implemented.");
      }
    } else if (w == LengthConstraintType.RANGE) {
      if (h == LengthConstraintType.NONE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.RANGE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.FIXED) {
        throw new RuntimeException("Not yet implemented.");
      }
    } else if (w == LengthConstraintType.FIXED) {
      if (h == LengthConstraintType.NONE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.RANGE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.FIXED) {
        contentSize = new Size2D(contentConstraint.getWidth(),
            contentConstraint.getHeight());
      }
    }
    return new Size2D(this.calculateTotalWidth(contentSize.getWidth()),
        this.calculateTotalHeight(contentSize.getHeight()));
  }
View Full Code Here

Examples of com.positive.charts.block.RectangleConstraint

    }
    BlockContainer container = this.wrapper;
    if (container == null) {
      container = this.items;
    }
    final RectangleConstraint c = this.toContentConstraint(constraint);
    final Size2D size = container.arrange(g2, c);
    result.height = this.calculateTotalHeight(size.height);
    result.width = this.calculateTotalWidth(size.width);
    return result;
  }
View Full Code Here

Examples of com.positive.charts.block.RectangleConstraint

    }
    final double hh = area.height;
    if (hh <= 0.0) {
      return null;
    }
    final RectangleConstraint constraint = new RectangleConstraint(ww,
        new Range(0.0, ww), LengthConstraintType.RANGE, hh, new Range(
            0.0, hh), LengthConstraintType.RANGE);
    Object retValue = null;
    final BlockParams p = new BlockParams();
    p.setGenerateEntities(entities);
View Full Code Here

Examples of com.positive.charts.block.RectangleConstraint

   *            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 RectangleConstraint cc = this.toContentConstraint(constraint);
    final LengthConstraintType w = cc.getWidthConstraintType();
    final LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
      if (h == LengthConstraintType.NONE) {
        contentSize = this.arrangeNN(g2);
      } else if (h == LengthConstraintType.RANGE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.FIXED) {
        throw new RuntimeException("Not yet implemented.");
      }
    } else if (w == LengthConstraintType.RANGE) {
      if (h == LengthConstraintType.NONE) {
        contentSize = this.arrangeRN(g2, cc.getWidthRange());
      } else if (h == LengthConstraintType.RANGE) {
        contentSize = this.arrangeRR(g2, cc.getWidthRange(),
            cc.getHeightRange());
      } else if (h == LengthConstraintType.FIXED) {
        throw new RuntimeException("Not yet implemented.");
      }
    } else if (w == LengthConstraintType.FIXED) {
      if (h == LengthConstraintType.NONE) {
        contentSize = this.arrangeFN(g2, cc.getWidth());
      } else if (h == LengthConstraintType.RANGE) {
        throw new RuntimeException("Not yet implemented.");
      } else if (h == LengthConstraintType.FIXED) {
        throw new RuntimeException("Not yet implemented.");
      }
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

        }
        if (this.coordinateType == XYCoordinateType.DATA) {
            maxW = this.maxWidth;
            maxH = this.maxHeight;
        }
        RectangleConstraint rc = new RectangleConstraint(
                new Range(0, maxW), new Range(0, maxH));

        Size2D size = this.title.arrange(g2, rc);
        Rectangle2D titleRect = new Rectangle2D.Double(0, 0, size.width,
                size.height);
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

      legend.setPosition(RectangleEdge.BOTTOM);
      BufferedImage bi = RenderingHelper.createImage(width, height);
      Graphics2D g = bi.createGraphics();
      g.setColor(Color.white);
      g.fillRect(0, 0, width, height);
      legend.arrange(g,new RectangleConstraint(width,height));
       legend.draw(g, new Rectangle(width, height));
      ByteArrayOutputStream out = new ByteArrayOutputStream();
/*
      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
      JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

        }
        if (this.coordinateType == XYCoordinateType.DATA) {
            maxW = this.maxWidth;
            maxH = this.maxHeight;
        }
        RectangleConstraint rc = new RectangleConstraint(
                new Range(0, maxW), new Range(0, maxH));

        Size2D size = this.title.arrange(g2, rc);
        Rectangle2D titleRect = new Rectangle2D.Double(0, 0, size.width,
                size.height);
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

        }
        BlockContainer container = this.wrapper;
        if (container == null) {
            container = this.items;
        }
        RectangleConstraint c = toContentConstraint(constraint);
        Size2D size = container.arrange(g2, c);
        result.height = calculateTotalHeight(size.height);
        result.width = calculateTotalWidth(size.width);
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

     */
    public void testCalculateConstrainedSize() {
        Size2D s;

        // NONE / NONE
        RectangleConstraint c1 = RectangleConstraint.NONE;
        s = c1.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 3.4, EPSILON);

        // NONE / RANGE
        RectangleConstraint c2 = new RectangleConstraint(
            0.0, new Range(0.0, 0.0), LengthConstraintType.NONE,
            0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE
        );
        s = c2.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 3.0, EPSILON);

        // NONE / FIXED
        RectangleConstraint c3 = new RectangleConstraint(
            0.0, null, LengthConstraintType.NONE,
            9.9, null, LengthConstraintType.FIXED
        );
        s = c3.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 9.9, EPSILON);

        // RANGE / NONE
        RectangleConstraint c4 = new RectangleConstraint(
            0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE,
            0.0, new Range(0.0, 0.0), LengthConstraintType.NONE
        );
        s = c4.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 2.0, EPSILON);
        assertEquals(s.height, 3.4, EPSILON);

        // RANGE / RANGE
        RectangleConstraint c5 = new RectangleConstraint(
            0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE,
            0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE
        );
        s = c5.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 2.0, EPSILON);
        assertEquals(s.height, 3.0, EPSILON);

        // RANGE / FIXED
        RectangleConstraint c6 = new RectangleConstraint(
            0.0, null, LengthConstraintType.NONE,
            9.9, null, LengthConstraintType.FIXED
        );
        s = c6.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 9.9, EPSILON);

        // FIXED / NONE
        RectangleConstraint c7 = RectangleConstraint.NONE;
        s = c7.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 3.4, EPSILON);

        // FIXED / RANGE
        RectangleConstraint c8 = new RectangleConstraint(
            0.0, new Range(0.0, 0.0), LengthConstraintType.NONE,
            0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE
        );
        s = c8.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 3.0, EPSILON);

        // FIXED / FIXED
        RectangleConstraint c9 = new RectangleConstraint(
            0.0, null, LengthConstraintType.NONE,
            9.9, null, LengthConstraintType.FIXED
        );
        s = c9.calculateConstrainedSize(new Size2D(1.2, 3.4));
        assertEquals(s.width, 1.2, EPSILON);
        assertEquals(s.height, 9.9, EPSILON);

    }
View Full Code Here

Examples of org.jfree.chart.block.RectangleConstraint

     * @param constraint  the constraint (<code>null</code> not permitted).
     *
     * @return The block size (in Java2D units, never <code>null</code>).
     */
    public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
        RectangleConstraint contentConstraint = toContentConstraint(constraint);
        LengthConstraintType w = contentConstraint.getWidthConstraintType();
        LengthConstraintType h = contentConstraint.getHeightConstraintType();
        Size2D contentSize = null;
        if (w == LengthConstraintType.NONE) {
            if (h == LengthConstraintType.NONE) {
                contentSize = arrangeNN(g2);
            }
            else if (h == LengthConstraintType.RANGE) {
                throw new RuntimeException("Not yet implemented.");
            }
            else if (h == LengthConstraintType.FIXED) {
                throw new RuntimeException("Not yet implemented.");
            }
        }
        else if (w == LengthConstraintType.RANGE) {
            if (h == LengthConstraintType.NONE) {
                throw new RuntimeException("Not yet implemented.");
            }
            else if (h == LengthConstraintType.RANGE) {
                throw new RuntimeException("Not yet implemented.");
            }
            else if (h == LengthConstraintType.FIXED) {
                throw new RuntimeException("Not yet implemented.");
            }
        }
        else if (w == LengthConstraintType.FIXED) {
            if (h == LengthConstraintType.NONE) {
                throw new RuntimeException("Not yet implemented.");
            }
            else if (h == LengthConstraintType.RANGE) {
                throw new RuntimeException("Not yet implemented.");
            }
            else if (h == LengthConstraintType.FIXED) {
                contentSize = new Size2D(
                    contentConstraint.getWidth(),
                    contentConstraint.getHeight()
                );
            }
        }
        return new Size2D(
            calculateTotalWidth(contentSize.getWidth()),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.