Search in sources :

Example 1 with CenterArrangement

use of org.jfree.chart.block.CenterArrangement in project SIMVA-SoS by SESoS.

the class LegendTitle method createLegendItemBlock.

/**
 * Creates a legend item block.
 *
 * @param item  the legend item.
 *
 * @return The block.
 */
protected Block createLegendItemBlock(LegendItem item) {
    BlockContainer result;
    LegendGraphic lg = new LegendGraphic(item.getShape(), item.getFillPaint());
    lg.setFillPaintTransformer(item.getFillPaintTransformer());
    lg.setShapeFilled(item.isShapeFilled());
    lg.setLine(item.getLine());
    lg.setLineStroke(item.getLineStroke());
    lg.setLinePaint(item.getLinePaint());
    lg.setLineVisible(item.isLineVisible());
    lg.setShapeVisible(item.isShapeVisible());
    lg.setShapeOutlineVisible(item.isShapeOutlineVisible());
    lg.setOutlinePaint(item.getOutlinePaint());
    lg.setOutlineStroke(item.getOutlineStroke());
    lg.setPadding(this.legendItemGraphicPadding);
    LegendItemBlockContainer legendItem = new LegendItemBlockContainer(new BorderArrangement(), item.getDataset(), item.getSeriesKey());
    lg.setShapeAnchor(getLegendItemGraphicAnchor());
    lg.setShapeLocation(getLegendItemGraphicLocation());
    legendItem.add(lg, this.legendItemGraphicEdge);
    Font textFont = item.getLabelFont();
    if (textFont == null) {
        textFont = this.itemFont;
    }
    Paint textPaint = item.getLabelPaint();
    if (textPaint == null) {
        textPaint = this.itemPaint;
    }
    LabelBlock labelBlock = new LabelBlock(item.getLabel(), textFont, textPaint);
    labelBlock.setPadding(this.itemLabelPadding);
    legendItem.add(labelBlock);
    legendItem.setToolTipText(item.getToolTipText());
    legendItem.setURLText(item.getURLText());
    result = new BlockContainer(new CenterArrangement());
    result.add(legendItem);
    return result;
}
Also used : BlockContainer(org.jfree.chart.block.BlockContainer) Paint(java.awt.Paint) BorderArrangement(org.jfree.chart.block.BorderArrangement) LabelBlock(org.jfree.chart.block.LabelBlock) Font(java.awt.Font) CenterArrangement(org.jfree.chart.block.CenterArrangement)

Aggregations

Font (java.awt.Font)1 Paint (java.awt.Paint)1 BlockContainer (org.jfree.chart.block.BlockContainer)1 BorderArrangement (org.jfree.chart.block.BorderArrangement)1 CenterArrangement (org.jfree.chart.block.CenterArrangement)1 LabelBlock (org.jfree.chart.block.LabelBlock)1