Java 类org.jfree.chart.block.RectangleConstraint 实例源码

项目:parabuild-ci    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;   
    }
    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;
}
项目:ccu-historian    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:jfreechart    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint ({@code null} not permitted).
 *
 * @return The block size (in Java2D units, never {@code null}).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:aya-lang    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:HTML5_WebSite    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:populus    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:PI    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:nabs    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;   
    }
    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;
}
项目:ECG-Viewer    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:astor    文件:BorderArrangementTests.java   
/**
 * This test is for a particular bug that arose just prior to the release
 * of JFreeChart 1.0.10.  A BorderArrangement with LEFT, CENTRE and RIGHT
 * blocks that is too wide, by default, for the available space, wasn't
 * shrinking the centre block as expected.
 */
public void testBugX() {
    RectangleConstraint constraint = new RectangleConstraint(
            new Range(0.0, 200.0), new Range(0.0, 100.0));
    BlockContainer container = new BlockContainer(new BorderArrangement());
    BufferedImage image = new BufferedImage(200, 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();

    container.add(new EmptyBlock(10.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(20.0, 6.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(30.0, 6.0));
    Size2D size = container.arrange(g2, constraint);
    assertEquals(60.0, size.width, EPSILON);
    assertEquals(6.0, size.height, EPSILON);

    container.clear();
    container.add(new EmptyBlock(10.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(20.0, 6.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(300.0, 6.0));
    size = container.arrange(g2, constraint);
    assertEquals(200.0, size.width, EPSILON);
    assertEquals(6.0, size.height, EPSILON);


}
项目:astor    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:opensim-gui    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;   
    }
    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;
}
项目:group-five    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:manydesigns.cn    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:aorra    文件:TwoColumnArrangement.java   
@SuppressWarnings("unchecked")
@Override
public Size2D arrange(BlockContainer container, Graphics2D g2,
    RectangleConstraint constraint) {
  List<Block> blocks = container.getBlocks();
  double cellHeight = maxHeight(blocks, g2);
  double cellWidth = maxWidth(blocks, g2);
  int rows = Math.round(blocks.size() / 2.0f);
  for (int i = 0; i < blocks.size(); i++) {
    Block block = blocks.get(i);
    int col = (i<rows?0:1);
    int row = i-col*rows;
    block.setBounds(new Rectangle2D.Double(
        col*cellWidth, row*cellHeight, cellWidth, cellHeight));
  }
  return new Size2D(blocks.size()==1?cellWidth:cellWidth*2, cellHeight*rows);
}
项目:buffer_bci    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:buffer_bci    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:proyecto-teoria-control-utn-frro    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:neoload-plugin    文件:NeoloadGraphXPathStat.java   
private int computeLegendHeight(final JFreeChart chart, final int imageWidth) {
    if (chart.getSubtitleCount() == 0) {
        return 0;
    }

    BufferedImage image = new BufferedImage(imageWidth, IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    RectangleConstraint constraint = new RectangleConstraint(
            imageWidth, new Range(0.0, imageWidth), LengthConstraintType.RANGE,
            0.0, null, LengthConstraintType.NONE
    );
    int height = 0;
    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        final Title subtitle = chart.getSubtitle(i);
        final Size2D arrange = subtitle.arrange(g2, constraint);
        height += arrange.getHeight();
    }
    return height;
}
项目:Memetic-Algorithm-for-TSP    文件:LegendTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @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) {
    Size2D result = new Size2D();
    fetchLegendItems();
    if (this.items.isEmpty()) {
        return result;
    }
    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;
}
项目:parabuild-ci    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testNN() {
    BlockContainer c = createTestContainer1();
    Size2D s = c.arrange(null, RectangleConstraint.NONE);
    assertEquals(90.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:parabuild-ci    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(
        100.0, null, LengthConstraintType.FIXED, 
        0.0, null, LengthConstraintType.NONE
    );
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:nabs    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testNN() {
    BlockContainer c = createTestContainer1();
    Size2D s = c.arrange(null, RectangleConstraint.NONE);
    assertEquals(90.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:nabs    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(
        100.0, null, LengthConstraintType.FIXED, 
        0.0, null, LengthConstraintType.NONE
    );
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testNN() {
    BlockContainer c = createTestContainer1();
    Size2D s = c.arrange(null, RectangleConstraint.NONE);
    assertEquals(90.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a fixed width and no height constraint.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(100.0, null,
            LengthConstraintType.FIXED, 0.0, null,
            LengthConstraintType.NONE);
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a fixed height and no width constraint.
 */
public void testNF() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = RectangleConstraint.NONE.toFixedHeight(
            100.0);
    Size2D s = c.arrange(null, constraint);
    assertEquals(90.0, s.width, EPSILON);
    assertEquals(100.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a range for the width and a fixed height.
 */
public void testRF() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(new Range(40.0,
            60.0), 100.0);
    Size2D s = c.arrange(null, constraint);
    assertEquals(60.0, s.width, EPSILON);
    assertEquals(100.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a range for the width and height.
 */
public void testRR() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(new Range(40.0,
            60.0), new Range(50.0, 70.0));
    Size2D s = c.arrange(null, constraint);
    assertEquals(60.0, s.width, EPSILON);
    assertEquals(50.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a range for the width and no height constraint.
 */
public void testRN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = RectangleConstraint.NONE.toRangeWidth(
            new Range(40.0, 60.0));
    Size2D s = c.arrange(null, constraint);
    assertEquals(60.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a range for the height and no width constraint.
 */
public void testNR() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = RectangleConstraint.NONE.toRangeHeight(
            new Range(40.0, 60.0));
    Size2D s = c.arrange(null, constraint);
    assertEquals(90.0, s.width, EPSILON);
    assertEquals(40.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle null blocks in the layout.
 */
public void testNullBlock_FF() {
    BlockContainer c = new BlockContainer(new GridArrangement(1, 1));
    c.add(null);
    Size2D s = c.arrange(null, new RectangleConstraint(20, 10));
    assertEquals(20.0, s.getWidth(), EPSILON);
    assertEquals(10.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle null blocks in the layout.
 */
public void testNullBlock_FN() {
    BlockContainer c = new BlockContainer(new GridArrangement(1, 1));
    c.add(null);
    Size2D s = c.arrange(null, RectangleConstraint.NONE.toFixedWidth(10));
    assertEquals(10.0, s.getWidth(), EPSILON);
    assertEquals(0.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle null blocks in the layout.
 */
public void testNullBlock_FR() {
    BlockContainer c = new BlockContainer(new GridArrangement(1, 1));
    c.add(null);
    Size2D s = c.arrange(null, new RectangleConstraint(30.0, new Range(5.0,
            10.0)));
    assertEquals(30.0, s.getWidth(), EPSILON);
    assertEquals(5.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle null blocks in the layout.
 */
public void testNullBlock_NN() {
    BlockContainer c = new BlockContainer(new GridArrangement(1, 1));
    c.add(null);
    Size2D s = c.arrange(null, RectangleConstraint.NONE);
    assertEquals(0.0, s.getWidth(), EPSILON);
    assertEquals(0.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle less blocks than grid spaces.
 */
public void testGridNotFull_FF() {
    Block b1 = new EmptyBlock(5, 5);
    BlockContainer c = new BlockContainer(new GridArrangement(2, 3));
    c.add(b1);
    Size2D s = c.arrange(null, new RectangleConstraint(200, 100));
    assertEquals(200.0, s.getWidth(), EPSILON);
    assertEquals(100.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle less blocks than grid spaces.
 */
public void testGridNotFull_FN() {
    Block b1 = new EmptyBlock(5, 5);
    BlockContainer c = new BlockContainer(new GridArrangement(2, 3));
    c.add(b1);
    Size2D s = c.arrange(null, RectangleConstraint.NONE.toFixedWidth(30.0));
    assertEquals(30.0, s.getWidth(), EPSILON);
    assertEquals(10.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle less blocks than grid spaces.
 */
public void testGridNotFull_FR() {
    Block b1 = new EmptyBlock(5, 5);
    BlockContainer c = new BlockContainer(new GridArrangement(2, 3));
    c.add(b1);
    Size2D s = c.arrange(null, new RectangleConstraint(30.0, new Range(5.0,
            10.0)));
    assertEquals(30.0, s.getWidth(), EPSILON);
    assertEquals(10.0, s.getHeight(), EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * The arrangement should be able to handle less blocks than grid spaces.
 */
public void testGridNotFull_NN() {
    Block b1 = new EmptyBlock(5, 5);
    BlockContainer c = new BlockContainer(new GridArrangement(2, 3));
    c.add(b1);
    Size2D s = c.arrange(null, RectangleConstraint.NONE);
    assertEquals(15.0, s.getWidth(), EPSILON);
    assertEquals(10.0, s.getHeight(), EPSILON);
}
项目:aorra    文件:TwoColumnArrangement.java   
private double maxWidth(List<Block> blocks, Graphics2D g2) {
  double max = 0.0;
  for(Block b : blocks) {
    max = Math.max(max, b.arrange(g2, RectangleConstraint.NONE).width);
  }
  return max;
}