org.jfree.chart.block
Class CenterArrangement

java.lang.Object
  extended byorg.jfree.chart.block.CenterArrangement
All Implemented Interfaces:
Arrangement, java.io.Serializable

public class CenterArrangement
extends java.lang.Object
implements Arrangement, java.io.Serializable

Arranges a block in the center of its container. This class is immutable.

See Also:
Serialized Form

Constructor Summary
CenterArrangement()
          Creates a new instance.
 
Method Summary
 void add(Block block, java.lang.Object key)
          Adds a block to be managed by this instance.
 Size2D arrange(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Calculates and sets the bounds of all the items in the specified container, subject to the given constraint.
protected  Size2D arrangeFF(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks in the container with the overall height and width specified as fixed constraints.
protected  Size2D arrangeFN(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks in the container with a fixed width and no height constraint.
protected  Size2D arrangeFR(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks in the container with a fixed with and a range constraint on the height.
protected  Size2D arrangeNF(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks with no width constraint and a fixed height constraint.
protected  Size2D arrangeNN(BlockContainer container, java.awt.Graphics2D g2)
          Arranges the blocks without any constraints.
protected  Size2D arrangeRF(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks in the container with a range constraint on the width and a fixed height.
protected  Size2D arrangeRN(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the block with a range constraint on the width, and no constraint on the height.
protected  Size2D arrangeRR(BlockContainer container, RectangleConstraint constraint, java.awt.Graphics2D g2)
          Arranges the blocks with the overall width and height to fit within specified ranges.
 void clear()
          Clears any cached information.
 boolean equals(java.lang.Object obj)
          Tests this instance for equality with an arbitrary object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CenterArrangement

public CenterArrangement()
Creates a new instance.

Method Detail

add

public void add(Block block,
                java.lang.Object key)
Adds a block to be managed by this instance. This method is usually called by the BlockContainer, you shouldn't need to call it directly.

Specified by:
add in interface Arrangement
Parameters:
block - the block.
key - a key that controls the position of the block.

arrange

public Size2D arrange(BlockContainer container,
                      RectangleConstraint constraint,
                      java.awt.Graphics2D g2)
Calculates and sets the bounds of all the items in the specified container, subject to the given constraint. The Graphics2D can be used by some items (particularly items containing text) to calculate sizing parameters.

Specified by:
arrange in interface Arrangement
Parameters:
container - the container whose items are being arranged.
constraint - the size constraint.
g2 - the graphics device.
Returns:
The size of the container after arrangement of the contents.

arrangeFN

protected Size2D arrangeFN(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks in the container with a fixed width and no height constraint.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size.

arrangeFR

protected Size2D arrangeFR(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks in the container with a fixed with and a range constraint on the height.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size following the arrangement.

arrangeFF

protected Size2D arrangeFF(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks in the container with the overall height and width specified as fixed constraints.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size following the arrangement.

arrangeRR

protected Size2D arrangeRR(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks with the overall width and height to fit within specified ranges.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size after the arrangement.

arrangeRF

protected Size2D arrangeRF(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks in the container with a range constraint on the width and a fixed height.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size following the arrangement.

arrangeRN

protected Size2D arrangeRN(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the block with a range constraint on the width, and no constraint on the height.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size following the arrangement.

arrangeNN

protected Size2D arrangeNN(BlockContainer container,
                           java.awt.Graphics2D g2)
Arranges the blocks without any constraints. This puts all blocks into a single row.

Parameters:
container - the container.
g2 - the graphics device.
Returns:
The size after the arrangement.

arrangeNF

protected Size2D arrangeNF(BlockContainer container,
                           RectangleConstraint constraint,
                           java.awt.Graphics2D g2)
Arranges the blocks with no width constraint and a fixed height constraint. This puts all blocks into a single row.

Parameters:
container - the container.
constraint - the constraint.
g2 - the graphics device.
Returns:
The size after the arrangement.

clear

public void clear()
Clears any cached information.

Specified by:
clear in interface Arrangement

equals

public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.

Parameters:
obj - the object (null permitted).
Returns:
A boolean.