org.jfree.chart.block.Block Java Examples

The following examples show how to use org.jfree.chart.block.Block. 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: LegendTitle.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Fetches the latest legend items.
 */
protected void fetchLegendItems() {
    this.items.clear();
    RectangleEdge p = getPosition();
    if (RectangleEdge.isTopOrBottom(p)) {
        this.items.setArrangement(this.hLayout);
    }
    else {
        this.items.setArrangement(this.vLayout);
    }
    for (int s = 0; s < this.sources.length; s++) {
        LegendItemCollection legendItems = this.sources[s].getLegendItems();
        if (legendItems != null) {
            for (int i = 0; i < legendItems.getItemCount(); i++) {
                LegendItem item = legendItems.get(i);
                Block block = createLegendItemBlock(item);
                this.items.add(block);
            }
        }
    }
}
 
Example #2
Source File: LegendTitle.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Fetches the latest legend items.
 */
protected void fetchLegendItems() {
    this.items.clear();
    RectangleEdge p = getPosition();
    if (RectangleEdge.isTopOrBottom(p)) {
        this.items.setArrangement(this.hLayout);   
    }
    else {
        this.items.setArrangement(this.vLayout);   
    }
    for (int s = 0; s < this.sources.length; s++) {
        LegendItemCollection legendItems = this.sources[s].getLegendItems();
        if (legendItems != null) {
            for (int i = 0; i < legendItems.getItemCount(); i++) {
                LegendItem item = legendItems.get(i);
                Block block = createLegendItemBlock(item);
                this.items.add(block);
            }
        }
    }
}
 
Example #3
Source File: LegendTitle.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Fetches the latest legend items.
 */
protected void fetchLegendItems() {
    this.items.clear();
    RectangleEdge p = getPosition();
    if (RectangleEdge.isTopOrBottom(p)) {
        this.items.setArrangement(this.hLayout);   
    }
    else {
        this.items.setArrangement(this.vLayout);   
    }
    for (int s = 0; s < this.sources.length; s++) {
        LegendItemCollection legendItems = this.sources[s].getLegendItems();
        if (legendItems != null) {
            for (int i = 0; i < legendItems.getItemCount(); i++) {
                LegendItem item = legendItems.get(i);
                Block block = createLegendItemBlock(item);
                this.items.add(block);
            }
        }
    }
}
 
Example #4
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #5
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #6
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #7
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #8
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #9
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #10
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #11
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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 #12
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #13
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #14
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #15
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #16
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #17
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #18
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #19
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #20
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #21
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #22
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #23
Source File: SmartLegendTitle.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected Block createLegendItemBlock(LegendItem item) {
	if (item instanceof FlankedShapeLegendItem) {
		return createFlankedShapeLegendItem((FlankedShapeLegendItem) item);
	} else {
		return createDefaultLegendItem(item);
	}
}
 
Example #24
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #25
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}
 
Example #26
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
Example #27
Source File: GridArrangementTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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 #28
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #29
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified block.
 *
 * @param b  the block.
 */
protected void applyToBlock(Block b) {
    if (b instanceof Title) {
        applyToTitle((Title) b);
    }
    else if (b instanceof LabelBlock) {
        LabelBlock lb = (LabelBlock) b;
        lb.setFont(this.regularFont);
        lb.setPaint(this.legendItemPaint);
    }
}
 
Example #30
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies the attributes of this theme to the specified container.
 *
 * @param bc  a block container (<code>null</code> not permitted).
 */
protected void applyToBlockContainer(BlockContainer bc) {
    Iterator iterator = bc.getBlocks().iterator();
    while (iterator.hasNext()) {
        Block b = (Block) iterator.next();
        applyToBlock(b);
    }
}