Module platform

Class BlockContainer

java.lang.Object
org.jfree.chart.block.AbstractBlock
org.jfree.chart.block.BlockContainer
All Implemented Interfaces:
Serializable, Cloneable, Block, Drawable, PublicCloneable
Direct Known Subclasses:
LegendItemBlockContainer

public class BlockContainer extends AbstractBlock implements Block, Cloneable, PublicCloneable, Serializable
A container for a collection of Block objects. The container uses an Arrangement object to handle the position of each block.
See Also:
  • Constructor Details

    • BlockContainer

      public BlockContainer()
      Creates a new instance with default settings.
    • BlockContainer

      public BlockContainer(Arrangement arrangement)
      Creates a new instance with the specified arrangement.
      Parameters:
      arrangement - the arrangement manager (null not permitted).
  • Method Details

    • getArrangement

      public Arrangement getArrangement()
      Returns the arrangement (layout) manager for the container.
      Returns:
      The arrangement manager (never null).
    • setArrangement

      public void setArrangement(Arrangement arrangement)
      Sets the arrangement (layout) manager.
      Parameters:
      arrangement - the arrangement (null not permitted).
    • isEmpty

      public boolean isEmpty()
      Returns true if there are no blocks in the container, and false otherwise.
      Returns:
      A boolean.
    • getBlocks

      public List getBlocks()
      Returns an unmodifiable list of the Block objects managed by this arrangement.
      Returns:
      A list of blocks.
    • add

      public void add(Block block)
      Adds a block to the container.
      Parameters:
      block - the block (null permitted).
    • add

      public void add(Block block, Object key)
      Adds a block to the container.
      Parameters:
      block - the block (null permitted).
      key - the key (null permitted).
    • clear

      public void clear()
      Clears all the blocks from the container.
    • arrange

      public Size2D arrange(Graphics2D g2, RectangleConstraint constraint)
      Arranges the contents of the block, within the given constraints, and returns the block size.
      Specified by:
      arrange in interface Block
      Overrides:
      arrange in class AbstractBlock
      Parameters:
      g2 - the graphics device.
      constraint - the constraint (null not permitted).
      Returns:
      The block size (in Java2D units, never null).
    • draw

      public void draw(Graphics2D g2, Rectangle2D area)
      Draws the container and all the blocks within it.
      Specified by:
      draw in interface Drawable
      Parameters:
      g2 - the graphics device.
      area - the area.
    • draw

      public Object draw(Graphics2D g2, Rectangle2D area, Object params)
      Draws the block within the specified area.
      Specified by:
      draw in interface Block
      Parameters:
      g2 - the graphics device.
      area - the area.
      params - passed on to blocks within the container (null permitted).
      Returns:
      An instance of EntityBlockResult, or null.
    • equals

      public boolean equals(Object obj)
      Tests this container for equality with an arbitrary object.
      Overrides:
      equals in class AbstractBlock
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of the container.
      Specified by:
      clone in interface PublicCloneable
      Overrides:
      clone in class AbstractBlock
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - if there is a problem cloning.