本文整理汇总了Java中org.jfree.chart.block.BlockContainer类的典型用法代码示例。如果您正苦于以下问题:Java BlockContainer类的具体用法?Java BlockContainer怎么用?Java BlockContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockContainer类属于org.jfree.chart.block包,在下文中一共展示了BlockContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LegendTitle
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Creates a new legend title with the specified arrangement.
*
* @param source the source.
* @param hLayout the horizontal item arrangement (<code>null</code> not
* permitted).
* @param vLayout the vertical item arrangement (<code>null</code> not
* permitted).
*/
public LegendTitle(LegendItemSource source,
Arrangement hLayout, Arrangement vLayout) {
this.sources = new LegendItemSource[] {source};
this.items = new BlockContainer(hLayout);
this.hLayout = hLayout;
this.vLayout = vLayout;
this.backgroundPaint = null;
this.legendItemGraphicEdge = RectangleEdge.LEFT;
this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
this.legendItemGraphicLocation = RectangleAnchor.CENTER;
this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.itemFont = DEFAULT_ITEM_FONT;
this.itemPaint = DEFAULT_ITEM_PAINT;
this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
}
示例2: testEquals
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Confirm that the equals() method can distinguish all the required fields.
*/
public void testEquals() {
BlockContainer c1 = new BlockContainer(new FlowArrangement());
BlockContainer c2 = new BlockContainer(new FlowArrangement());
assertTrue(c1.equals(c2));
assertTrue(c2.equals(c2));
c1.setArrangement(new ColumnArrangement());
assertFalse(c1.equals(c2));
c2.setArrangement(new ColumnArrangement());
assertTrue(c1.equals(c2));
c1.add(new EmptyBlock(1.2, 3.4));
assertFalse(c1.equals(c2));
c2.add(new EmptyBlock(1.2, 3.4));
assertTrue(c1.equals(c2));
}
示例3: arrange
import org.jfree.chart.block.BlockContainer; //导入依赖的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;
}
示例4: draw
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Draws the block within the specified area.
*
* @param g2 the graphics device.
* @param area the area.
* @param params ignored (<code>null</code> permitted).
*
* @return An {@link org.jfree.chart.block.EntityBlockResult} or
* <code>null</code>.
*/
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
Rectangle2D target = (Rectangle2D) area.clone();
target = trimMargin(target);
if (this.backgroundPaint != null) {
g2.setPaint(this.backgroundPaint);
g2.fill(target);
}
BlockFrame border = getFrame();
border.draw(g2, target);
border.getInsets().trim(target);
BlockContainer container = this.wrapper;
if (container == null) {
container = this.items;
}
target = trimPadding(target);
return container.draw(g2, target, params);
}
示例5: testCloning
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() {
CompositeTitle t1 = new CompositeTitle(new BlockContainer());
t1.getContainer().add(new TextTitle("T1"));
t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red,
3.0f, 4.0f, Color.yellow));
CompositeTitle t2 = null;
try {
t2 = (CompositeTitle) t1.clone();
}
catch (CloneNotSupportedException e) {
fail(e.toString());
}
assertTrue(t1 != t2);
assertTrue(t1.getClass() == t2.getClass());
assertTrue(t1.equals(t2));
}
示例6: LegendTitle
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Creates a new legend title with the specified arrangement.
*
* @param source the source.
* @param hLayout the horizontal item arrangement (<code>null</code> not
* permitted).
* @param vLayout the vertical item arrangement (<code>null</code> not
* permitted).
*/
public LegendTitle(LegendItemSource source,
Arrangement hLayout, Arrangement vLayout) {
this.sources = new LegendItemSource[] {source};
this.items = new BlockContainer(hLayout);
this.hLayout = hLayout;
this.vLayout = vLayout;
this.backgroundPaint = null;
this.legendItemGraphicEdge = RectangleEdge.LEFT;
this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
this.legendItemGraphicLocation = RectangleAnchor.CENTER;
this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.itemFont = DEFAULT_ITEM_FONT;
this.itemPaint = DEFAULT_ITEM_PAINT;
this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.sortOrder = SortOrder.ASCENDING;
}
示例7: arrange
import org.jfree.chart.block.BlockContainer; //导入依赖的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;
}
示例8: LegendTitle
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Creates a new legend title with the specified arrangement.
*
* @param source the source.
* @param hLayout the horizontal item arrangement ({@code null} not
* permitted).
* @param vLayout the vertical item arrangement ({@code null} not
* permitted).
*/
public LegendTitle(LegendItemSource source,
Arrangement hLayout, Arrangement vLayout) {
this.sources = new LegendItemSource[] {source};
this.items = new BlockContainer(hLayout);
this.hLayout = hLayout;
this.vLayout = vLayout;
this.backgroundPaint = null;
this.legendItemGraphicEdge = RectangleEdge.LEFT;
this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
this.legendItemGraphicLocation = RectangleAnchor.CENTER;
this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.itemFont = DEFAULT_ITEM_FONT;
this.itemPaint = DEFAULT_ITEM_PAINT;
this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.sortOrder = SortOrder.ASCENDING;
}
示例9: arrange
import org.jfree.chart.block.BlockContainer; //导入依赖的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;
}
示例10: testCloning
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() {
CompositeTitle t1 = new CompositeTitle(new BlockContainer());
t1.getContainer().add(new TextTitle("T1"));
t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.RED,
3.0f, 4.0f, Color.YELLOW));
CompositeTitle t2 = null;
try {
t2 = (CompositeTitle) t1.clone();
}
catch (CloneNotSupportedException e) {
fail(e.toString());
}
assertTrue(t1 != t2);
assertTrue(t1.getClass() == t2.getClass());
assertTrue(t1.equals(t2));
}
示例11: LegendTitle
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Creates a new legend title with the specified arrangement.
*
* @param source the source.
* @param hLayout the horizontal item arrangement (<code>null</code> not
* permitted).
* @param vLayout the vertical item arrangement (<code>null</code> not
* permitted).
*/
public LegendTitle(LegendItemSource source,
Arrangement hLayout, Arrangement vLayout) {
this.sources = new LegendItemSource[] {source};
this.items = new BlockContainer(hLayout);
this.hLayout = hLayout;
this.vLayout = vLayout;
this.backgroundPaint = null;
this.legendItemGraphicEdge = RectangleEdge.LEFT;
this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
this.legendItemGraphicLocation = RectangleAnchor.CENTER;
this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
this.itemFont = DEFAULT_ITEM_FONT;
this.itemPaint = DEFAULT_ITEM_PAINT;
this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
}
示例12: arrange
import org.jfree.chart.block.BlockContainer; //导入依赖的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;
}
示例13: draw
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Draws the block within the specified area.
*
* @param g2 the graphics device.
* @param area the area.
* @param params ignored (<code>null</code> permitted).
*
* @return An {@link org.jfree.chart.block.EntityBlockResult} or
* <code>null</code>.
*/
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
Rectangle2D target = (Rectangle2D) area.clone();
target = trimMargin(target);
if (this.backgroundPaint != null) {
g2.setPaint(this.backgroundPaint);
g2.fill(target);
}
BlockFrame border = getFrame();
border.draw(g2, target);
border.getInsets().trim(target);
BlockContainer container = this.wrapper;
if (container == null) {
container = this.items;
}
target = trimPadding(target);
return container.draw(g2, target, params);
}
示例14: testBugX
import org.jfree.chart.block.BlockContainer; //导入依赖的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);
}
示例15: testEquals
import org.jfree.chart.block.BlockContainer; //导入依赖的package包/类
/**
* Confirm that the equals() method can distinguish all the required fields.
*/
public void testEquals() {
BlockContainer c1 = new BlockContainer(new FlowArrangement());
BlockContainer c2 = new BlockContainer(new FlowArrangement());
assertTrue(c1.equals(c2));
assertTrue(c2.equals(c2));
c1.setArrangement(new ColumnArrangement());
assertFalse(c1.equals(c2));
c2.setArrangement(new ColumnArrangement());
assertTrue(c1.equals(c2));
c1.add(new EmptyBlock(1.2, 3.4));
assertFalse(c1.equals(c2));
c2.add(new EmptyBlock(1.2, 3.4));
assertTrue(c1.equals(c2));
}