Java Code Examples for org.jfree.chart.block.BlockContainer#add()
The following examples show how to use
org.jfree.chart.block.BlockContainer#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BorderArrangementTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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); }
Example 2
Source File: BlockContainerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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)); }
Example 3
Source File: BlockContainerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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)); }
Example 4
Source File: ChartImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public void drawLegend(JFreeChart chart){ //remove ipotetical other legend chart.removeLegend(); BlockContainer wrapper = new BlockContainer(new BorderArrangement()); wrapper.setFrame(new BlockBorder(1.0, 1.0, 1.0, 1.0)); /*LabelBlock titleBlock = new LabelBlock("Legend Items:", new Font("SansSerif", Font.BOLD, 12)); titleBlock.setPadding(5, 5, 5, 5); wrapper.add(titleBlock, RectangleEdge.TOP);*/ LegendTitle legend = new LegendTitle(chart.getPlot()); BlockContainer items = legend.getItemContainer(); if(styleLegend!=null && styleLegend.getFont()!=null){ legend.setItemFont(new Font(styleLegend.getFontName(), Font.BOLD, styleLegend.getSize())); } items.setPadding(2, 5, 5, 2); wrapper.add(items); legend.setWrapper(wrapper); if(legendPosition.equalsIgnoreCase("bottom")) legend.setPosition(RectangleEdge.BOTTOM); else if(legendPosition.equalsIgnoreCase("left")) legend.setPosition(RectangleEdge.LEFT); else if(legendPosition.equalsIgnoreCase("right")) legend.setPosition(RectangleEdge.RIGHT); else if(legendPosition.equalsIgnoreCase("top")) legend.setPosition(RectangleEdge.TOP); else legend.setPosition(RectangleEdge.BOTTOM); legend.setHorizontalAlignment(HorizontalAlignment.CENTER); chart.addSubtitle(legend); }
Example 5
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
private BlockContainer createTestContainer1() { Block b1 = new EmptyBlock(10, 11); Block b2 = new EmptyBlock(20, 22); Block b3 = new EmptyBlock(30, 33); BlockContainer result = new BlockContainer(new GridArrangement(1, 3)); result.add(b1); result.add(b2); result.add(b3); return result; }
Example 6
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 7
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 8
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 9
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 10
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 11
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 12
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 13
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 14
Source File: GridArrangementTests.java From astor with GNU General Public License v2.0 | 5 votes |
private BlockContainer createTestContainer1() { Block b1 = new EmptyBlock(10, 11); Block b2 = new EmptyBlock(20, 22); Block b3 = new EmptyBlock(30, 33); BlockContainer result = new BlockContainer(new GridArrangement(1, 3)); result.add(b1); result.add(b2); result.add(b3); return result; }