public class BlockContainer extends AbstractBlock implements Block, java.lang.Cloneable, PublicCloneable, java.io.Serializable
Block objects. The container uses
an Arrangement object to handle the position of each block.| Constructor and Description |
|---|
BlockContainer()
Creates a new instance with default settings.
|
BlockContainer(Arrangement arrangement)
Creates a new instance with the specified arrangement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Block block)
Adds a block to the container.
|
void |
add(Block block,
java.lang.Object key)
Adds a block to the container.
|
Size2D |
arrange(java.awt.Graphics2D g2,
RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and
returns the block size.
|
void |
clear()
Clears all the blocks from the container.
|
java.lang.Object |
clone()
Returns a clone of the container.
|
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Draws the container and all the blocks within it.
|
java.lang.Object |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.lang.Object params)
Draws the block within the specified area.
|
boolean |
equals(java.lang.Object obj)
Tests this container for equality with an arbitrary object.
|
Arrangement |
getArrangement()
Returns the arrangement (layout) manager for the container.
|
java.util.List |
getBlocks()
Returns an unmodifiable list of the
Block objects managed by
this arrangement. |
boolean |
isEmpty()
Returns
true if there are no blocks in the container, and
false otherwise. |
void |
setArrangement(Arrangement arrangement)
Sets the arrangement (layout) manager.
|
arrange, calculateTotalHeight, calculateTotalWidth, drawBorder, getBorder, getBounds, getContentXOffset, getContentYOffset, getFrame, getHeight, getID, getMargin, getPadding, getWidth, setBorder, setBorder, setBounds, setFrame, setHeight, setID, setMargin, setMargin, setPadding, setPadding, setWidth, toContentConstraint, trimBorder, trimMargin, trimPadding, trimToContentHeight, trimToContentWidthpublic BlockContainer()
public BlockContainer(Arrangement arrangement)
arrangement - the arrangement manager (null not
permitted).public Arrangement getArrangement()
null).public void setArrangement(Arrangement arrangement)
arrangement - the arrangement (null not permitted).public boolean isEmpty()
true if there are no blocks in the container, and
false otherwise.public java.util.List getBlocks()
Block objects managed by
this arrangement.public void add(Block block)
block - the block (null permitted).public void add(Block block, java.lang.Object key)
block - the block (null permitted).key - the key (null permitted).public void clear()
public Size2D arrange(java.awt.Graphics2D g2, RectangleConstraint constraint)
arrange in interface Blockarrange in class AbstractBlockg2 - the graphics device.constraint - the constraint (null not permitted).null).public void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
public java.lang.Object draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.lang.Object params)
draw in interface Blockg2 - the graphics device.area - the area.params - passed on to blocks within the container
(null permitted).EntityBlockResult, or null.public boolean equals(java.lang.Object obj)
equals in class AbstractBlockobj - the object (null permitted).public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface PublicCloneableclone in class AbstractBlockjava.lang.CloneNotSupportedException - if there is a problem cloning.