objects. The container uses
an
object to handle the position of each block.
| Method from org.jfree.chart.block.BlockContainer Detail: |
public void add(Block block) {
add(block, null);
}
Adds a block to the container. |
public void add(Block block,
Object key) {
this.blocks.add(block);
this.arrangement.add(block, key);
}
Adds a block to the container. |
public Size2D arrange(Graphics2D g2,
RectangleConstraint constraint) {
return this.arrangement.arrange(this, g2, constraint);
}
Arranges the contents of the block, within the given constraints, and
returns the block size. |
public void clear() {
this.blocks.clear();
this.arrangement.clear();
}
Clears all the blocks from the container. |
public Object clone() throws CloneNotSupportedException {
BlockContainer clone = (BlockContainer) super.clone();
// TODO : complete this
return clone;
}
Returns a clone of the container. |
public void draw(Graphics2D g2,
Rectangle2D area) {
draw(g2, area, null);
}
Draws the container and all the blocks within it. |
public Object draw(Graphics2D g2,
Rectangle2D area,
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();
}
}
Rectangle2D contentArea = (Rectangle2D) area.clone();
contentArea = trimMargin(contentArea);
drawBorder(g2, contentArea);
contentArea = trimBorder(contentArea);
contentArea = trimPadding(contentArea);
Iterator iterator = this.blocks.iterator();
while (iterator.hasNext()) {
Block block = (Block) iterator.next();
Rectangle2D bounds = block.getBounds();
Rectangle2D drawArea = new Rectangle2D.Double(bounds.getX()
+ area.getX(), bounds.getY() + area.getY(),
bounds.getWidth(), bounds.getHeight());
Object r = block.draw(g2, drawArea, params);
if (sec != null) {
if (r instanceof EntityBlockResult) {
EntityBlockResult ebr = (EntityBlockResult) r;
EntityCollection ec = ebr.getEntityCollection();
sec.addAll(ec);
}
}
}
BlockResult result = null;
if (sec != null) {
result = new BlockResult();
result.setEntityCollection(sec);
}
return result;
}
Draws the block within the specified area. |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof BlockContainer)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
BlockContainer that = (BlockContainer) obj;
if (!this.arrangement.equals(that.arrangement)) {
return false;
}
if (!this.blocks.equals(that.blocks)) {
return false;
}
return true;
}
Tests this container for equality with an arbitrary object. |
public Arrangement getArrangement() {
return this.arrangement;
}
Returns the arrangement (layout) manager for the container. |
public List getBlocks() {
return Collections.unmodifiableList(this.blocks);
}
Returns an unmodifiable list of the Block objects managed by
this arrangement. |
public boolean isEmpty() {
return this.blocks.isEmpty();
}
Returns true if there are no blocks in the container, and
false otherwise. |
public void setArrangement(Arrangement arrangement) {
if (arrangement == null) {
throw new IllegalArgumentException("Null 'arrangement' argument.");
}
this.arrangement = arrangement;
}
Sets the arrangement (layout) manager. |