* @return An instance of {@link EntityBlockResult}, or <code>null</code>.
*/
public Object draw(final GC g2, final Rectangle area, final Object params) {
// check if we need to collect chart entities from the container
EntityBlockParams ebp = null;
StandardEntityCollection sec = null;
if (params instanceof EntityBlockParams) {
ebp = (EntityBlockParams) params;
if (ebp.getGenerateEntities()) {
sec = new StandardEntityCollection();
}
}
Rectangle contentArea = new Rectangle(area.x, area.y, area.width,
area.height);
contentArea = this.trimMargin(contentArea);
this.drawBorder(g2, contentArea);
contentArea = this.trimBorder(contentArea);
contentArea = this.trimPadding(contentArea);
final Iterator iterator = this.blocks.iterator();
while (iterator.hasNext()) {
final Block block = (Block) iterator.next();
final Rectangle bounds = block.getBounds();
final Rectangle drawArea = RectUtils.doubleRect(bounds.x + area.x,
bounds.y + area.y, bounds.width, bounds.height);
final Object r = block.draw(g2, drawArea, params);
if (sec != null) {
if (r instanceof EntityBlockResult) {
final EntityBlockResult ebr = (EntityBlockResult) r;
final EntityCollection ec = ebr.getEntityCollection();
sec.addAll(ec);
}
}
}
BlockResult result = null;
if (sec != null) {