org.jfree.report.layout
Class AbstractBandLayoutManager

java.lang.Object
  |
  +--org.jfree.report.layout.AbstractBandLayoutManager
Direct Known Subclasses:
StackedLayoutManager, StaticLayoutManager

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

An abstract band layout manager.

Author:
Thomas Morgner.

Field Summary
static long RELATIVE_CORRECTION_FACTOR
          The factor which gets used to correct relative coordinate values.
 
Fields inherited from interface org.jfree.report.layout.BandLayoutManager
LAYOUTMANAGER
 
Constructor Summary
protected AbstractBandLayoutManager()
          Default constructor.
 
Method Summary
static long alignDown(long value, long boundary)
          Aligns the given value to the boundary.
static long alignUp(long value, long boundary)
          Aligns the given value to the boundary.
protected static StrictDimension correctDimension(StrictDimension dim, StrictDimension base, StrictDimension retval, LayoutSupport support)
          Corrects the relative (proportional) values.
protected static StrictPoint correctPoint(StrictPoint dim, StrictDimension base, StrictPoint retval, LayoutSupport support)
          Corrects the relative (proportional) values.
protected static long correctRelativeValue(long dim, long base)
          Corrects a single value.
protected  ElementLayoutInformation createLayoutInfoForDynamics(Element e, StrictDimension parentDim, StrictDimension maxUsableSize, LayoutSupport support)
          Creates a layout information object for a DynamicElement content calculation.
protected  ElementLayoutInformation createLayoutInformationForMinimumSize(Element e, StrictDimension containerBounds, StrictDimension maxUsableSize, LayoutSupport support)
          Creates layout information for the minimum size.
protected  ElementLayoutInformation createLayoutInformationForPreferredSize(Element e, StrictDimension containerDims, StrictDimension maxUsableSize, LayoutSupport support)
          Creates layout information for the preferred size.
protected  StrictDimension getElementContentBounds(StrictDimension bounds, Element e, StrictDimension containerBounds, StrictDimension maxUsablesize, 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
 

Field Detail

RELATIVE_CORRECTION_FACTOR

public static final long RELATIVE_CORRECTION_FACTOR
The factor which gets used to correct relative coordinate values.
Constructor Detail

AbstractBandLayoutManager

protected AbstractBandLayoutManager()
Default constructor.
Method Detail

getElementContentBounds

protected StrictDimension getElementContentBounds(StrictDimension bounds,
                                                  Element e,
                                                  StrictDimension containerBounds,
                                                  StrictDimension maxUsablesize,
                                                  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.
containerBounds -  
maxUsablesize -  
support - the layout support used to compute sizes.
Returns:
the new elements dimension.

createLayoutInfoForDynamics

protected ElementLayoutInformation createLayoutInfoForDynamics(Element e,
                                                               StrictDimension parentDim,
                                                               StrictDimension maxUsableSize,
                                                               LayoutSupport support)
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
maxUsableSize -  
Returns:
the created layout information.

createLayoutInformationForMinimumSize

protected ElementLayoutInformation createLayoutInformationForMinimumSize(Element e,
                                                                         StrictDimension containerBounds,
                                                                         StrictDimension maxUsableSize,
                                                                         LayoutSupport support)
Creates layout information for the minimum size.
Parameters:
e - the element.
containerBounds - the bounds of the container.
maxUsableSize -  
Returns:
layout information.

createLayoutInformationForPreferredSize

protected ElementLayoutInformation createLayoutInformationForPreferredSize(Element e,
                                                                           StrictDimension containerDims,
                                                                           StrictDimension maxUsableSize,
                                                                           LayoutSupport support)
Creates layout information for the preferred size.
Parameters:
e - the element.
containerDims - the dimensions of the container.
maxUsableSize -  
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 StrictDimension correctDimension(StrictDimension dim,
                                                  StrictDimension base,
                                                  StrictDimension retval,
                                                  LayoutSupport support)
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 long correctRelativeValue(long dim,
                                           long base)
Corrects a single value.
Parameters:
dim - the dimensions value
base - the base value (the containers value), should never be negative.
Returns:
the corrected value if necessary or the dim value unchanged.

correctPoint

protected static StrictPoint correctPoint(StrictPoint dim,
                                          StrictDimension base,
                                          StrictPoint retval,
                                          LayoutSupport support)
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.

alignDown

public static long alignDown(long value,
                             long 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.

alignUp

public static long alignUp(long value,
                           long 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.