org.jfree.report.layout
Class AbstractBandLayoutManager

java.lang.Object
  extended byorg.jfree.report.layout.AbstractBandLayoutManager
All Implemented Interfaces:
BandLayoutManager
Direct Known Subclasses:
CardLayoutBLayoutManager, GridBLayoutManager, StaticLayoutManager

public abstract class AbstractBandLayoutManager
extends java.lang.Object
implements BandLayoutManager

An abstract band layout manager.

Author:
Thomas Morgner.

Field Summary
 
Fields inherited from interface org.jfree.report.layout.BandLayoutManager
LAYOUTMANAGER
 
Constructor Summary
protected AbstractBandLayoutManager()
          Default constructor.
 
Method Summary
protected static float align(float value, float boundary)
          Aligns the given value to the boundary.
protected  java.awt.geom.Dimension2D computeMinimumSize(Element e, java.awt.geom.Dimension2D containerBounds, java.awt.geom.Dimension2D retval, LayoutSupport support)
          Returns the minimum size for an element.
protected  java.awt.geom.Dimension2D computePreferredSize(Element e, java.awt.geom.Dimension2D containerBounds, java.awt.geom.Dimension2D retval, LayoutSupport support)
          Calculates the preferred size of an element.
protected static java.awt.geom.Dimension2D correctDimension(java.awt.geom.Dimension2D dim, java.awt.geom.Dimension2D base, java.awt.geom.Dimension2D retval)
          Corrects the relative (proportional) values.
protected static java.awt.geom.Point2D correctPoint(java.awt.geom.Point2D dim, java.awt.geom.Dimension2D base, java.awt.geom.Point2D retval)
          Corrects the relative (proportional) values.
protected static float correctRelativeValue(float dim, float base)
          Corrects a single value.
protected  ElementLayoutInformation createLayoutInfoForDynamics(Element e, java.awt.geom.Dimension2D parentDim)
          Creates a layout information object for a DynamicElement content calculation.
protected  ElementLayoutInformation createLayoutInformationForMinimumSize(Element e, java.awt.geom.Dimension2D containerBounds)
          Creates layout information for the minimum size.
protected  ElementLayoutInformation createLayoutInformationForPreferredSize(Element e, java.awt.geom.Dimension2D containerDims)
          Creates layout information for the preferred size.
protected  java.awt.geom.Dimension2D getElementContentBounds(java.awt.geom.Dimension2D bounds, Element e, java.awt.geom.Dimension2D conBounds, LayoutSupport support)
          Calculates the size of an element by creating the content for this element and then trying to layout that content.
protected  boolean isElementStaticHeight(Element e)
          Returns true if the element has a static height, and false otherwise.
protected  boolean isElementStaticWidth(Element e)
          Returns true if the element has a static width, and false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.report.layout.BandLayoutManager
doLayout, invalidateLayout, minimumLayoutSize, preferredLayoutSize
 

Constructor Detail

AbstractBandLayoutManager

protected AbstractBandLayoutManager()
Default constructor.

Method Detail

computeMinimumSize

protected java.awt.geom.Dimension2D computeMinimumSize(Element e,
                                                       java.awt.geom.Dimension2D containerBounds,
                                                       java.awt.geom.Dimension2D retval,
                                                       LayoutSupport support)
Returns the minimum size for an element.

Parameters:
e - the element.
containerBounds - the bounds of the elements parents.
retval - a dimension object that should be filled, or null, if a new object should be created
support - the layout support used to compute sizes.
Returns:
the minimum size.

computePreferredSize

protected java.awt.geom.Dimension2D computePreferredSize(Element e,
                                                         java.awt.geom.Dimension2D containerBounds,
                                                         java.awt.geom.Dimension2D retval,
                                                         LayoutSupport support)
Calculates the preferred size of an element.

Parameters:
e - the element.
containerBounds - the bounds of the element's container.
retval - a dimension object that should be filled, or null, if a new object should be created
support - the layout support used to compute sizes.
Returns:
the preferred size of the element.

getElementContentBounds

protected java.awt.geom.Dimension2D getElementContentBounds(java.awt.geom.Dimension2D bounds,
                                                            Element e,
                                                            java.awt.geom.Dimension2D conBounds,
                                                            LayoutSupport support)
Calculates the size of an element by creating the content for this element and then trying to layout that content. This operation is performed for all "dynamic" elements.

Calculation rules: Take the width of given bounds to calculate a height based on the content. Then cut the content to a maybe defined max-value.

Parameters:
bounds - the bounds of the element calculated so far. These bounds will be modified and returned.
e - the element.
conBounds - the bounds of the surrounding container.
support - the layout support used to compute sizes.
Returns:
the new elements dimension.

createLayoutInfoForDynamics

protected ElementLayoutInformation createLayoutInfoForDynamics(Element e,
                                                               java.awt.geom.Dimension2D parentDim)
Creates a layout information object for a DynamicElement content calculation. The maximum height is only limited by the elements max height, not by the parent.

Parameters:
e - the element for that the layout should be done.
parentDim - the dimensions for the parent of the element
Returns:
the created layout information.

createLayoutInformationForMinimumSize

protected ElementLayoutInformation createLayoutInformationForMinimumSize(Element e,
                                                                         java.awt.geom.Dimension2D containerBounds)
Creates layout information for the minimum size.

Parameters:
e - the element.
containerBounds - the bounds of the container.
Returns:
layout information.

createLayoutInformationForPreferredSize

protected ElementLayoutInformation createLayoutInformationForPreferredSize(Element e,
                                                                           java.awt.geom.Dimension2D containerDims)
Creates layout information for the preferred size.

Parameters:
e - the element.
containerDims - the dimensions of the container.
Returns:
layout information.

isElementStaticWidth

protected boolean isElementStaticWidth(Element e)
Returns true if the element has a static width, and false otherwise.

Parameters:
e - the element.
Returns:
true or false.

isElementStaticHeight

protected boolean isElementStaticHeight(Element e)
Returns true if the element has a static height, and false otherwise.

Parameters:
e - the element.
Returns:
true or false.

correctDimension

protected static java.awt.geom.Dimension2D correctDimension(java.awt.geom.Dimension2D dim,
                                                            java.awt.geom.Dimension2D base,
                                                            java.awt.geom.Dimension2D retval)
Corrects the relative (proportional) values. The values are given in the range from -100 (= 100%) to 0 (0%) and are resolved to the base values.

Parameters:
dim - the dimension that should be corrected.
base - the base to define the 100% limit.
retval - the return value.
Returns:
the corrected dimension.

correctRelativeValue

protected static float correctRelativeValue(float dim,
                                            float base)
Corrects a single value.

Parameters:
dim - the dimensions value
base - the base value (the containers value)
Returns:
the corrected value if necessary or the dim value unchanged.

correctPoint

protected static java.awt.geom.Point2D correctPoint(java.awt.geom.Point2D dim,
                                                    java.awt.geom.Dimension2D base,
                                                    java.awt.geom.Point2D retval)
Corrects the relative (proportional) values. The values are given in the range from -100 (= 100%) to 0 (0%) and are resolved to the base values.

Parameters:
dim - the point that should be corrected.
base - the base to define the 100% limit.
retval - the return value.
Returns:
the corrected point.

align

protected static float align(float value,
                             float boundary)
Aligns the given value to the boundary. This is used to align the content to an grid, in case that the output target needs all coordinates aligned.

Parameters:
value - the value.
boundary - the boundary.
Returns:
The aligned value.