当前位置: 首页>>代码示例>>Java>>正文


Java RectangleConstraint类代码示例

本文整理汇总了Java中org.jfree.chart.block.RectangleConstraint的典型用法代码示例。如果您正苦于以下问题:Java RectangleConstraint类的具体用法?Java RectangleConstraint怎么用?Java RectangleConstraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RectangleConstraint类属于org.jfree.chart.block包,在下文中一共展示了RectangleConstraint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: arrange

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:LegendTitle.java

示例2: arrange

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:27,代码来源:LegendTitle.java

示例3: arrange

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:27,代码来源:LegendTitle.java

示例4: arrange

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:26,代码来源:LegendTitle.java

示例5: testBugX

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);


}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:32,代码来源:BorderArrangementTests.java

示例6: arrange

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
@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);
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:18,代码来源:TwoColumnArrangement.java

示例7: computeLegendHeight

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
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;
}
 
开发者ID:jenkinsci,项目名称:neoload-plugin,代码行数:20,代码来源:NeoloadGraphXPathStat.java

示例8: testNN

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:GridArrangementTests.java

示例9: testFN

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:GridArrangementTests.java

示例10: testFN

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:GridArrangementTests.java

示例11: testNF

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:GridArrangementTests.java

示例12: testRF

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:GridArrangementTests.java

示例13: testRR

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:GridArrangementTests.java

示例14: testRN

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:GridArrangementTests.java

示例15: testNR

import org.jfree.chart.block.RectangleConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:GridArrangementTests.java


注:本文中的org.jfree.chart.block.RectangleConstraint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。