Example usage for org.jfree.chart.block BlockResult getEntityCollection

List of usage examples for org.jfree.chart.block BlockResult getEntityCollection

Introduction

In this page you can find the example usage for org.jfree.chart.block BlockResult getEntityCollection.

Prototype

@Override
public EntityCollection getEntityCollection() 

Source Link

Document

Returns the collection of entities from the block.

Usage

From source file:gda.plots.SimpleLegendLabelBlock.java

/**
 * Overrides super class method to provide a BlockResult which contains a SimpleLegendEntity instead of an ordinary
 * ChartEntity.// www.  j  ava2s  . com
 * 
 * @param g2
 *            the Graphics to use
 * @param area
 *            the area to draw in
 * @param params
 *            ignored
 * @return a BlockResult containing the SimpleLegendEntity
 */
@Override
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
    // It was impossible to reuse the super class code because of
    // private fields with no accessor methods. So run the method
    // then replace the EntityCollection with one containing a
    // SimpleLegendEntity. The super class method may return null
    // (e.g. when being drawn for printing). If it does then we
    // should too.
    BlockResult result = (BlockResult) super.draw(g2, area, params);
    if (result != null) {
        StandardEntityCollection sec = new StandardEntityCollection();
        ChartEntity ce = result.getEntityCollection().getEntity(0);
        sec.add(new SimpleLegendEntity(ce, sxys));
        result.setEntityCollection(sec);
    }
    return result;
}