org.jfree.report.layout
Class StaticLayoutManager
java.lang.Object
|
+--org.jfree.report.layout.AbstractBandLayoutManager
|
+--org.jfree.report.layout.StaticLayoutManager
- public class StaticLayoutManager
- extends AbstractBandLayoutManager
An implementation of the BandLayoutManager interface.
Rule: Bands can have minimum, max and pref size defined. These values are hints for the
layout container, no restrictions. If min and pref are '0', they are ignored. MaxSize
is never ignored.
Elements that have the "dynamic" flag set, are checked for their content-bounds. This
operation is expensive, so this is only done if really needed. The dynamic flag will
influence the height of an element, a valid width must be already set.
Invisible elements within the layouted band are not evaluated. This layout manager will
ignore invisible child bands and -elements.
Note to everybody who tries to understand this class: This class is full of old
compatibility code, this class is not designed to be smart, or suitable for complex
layouts. The only purpose of this class is to maintain backward compatiblity with older
releases of JFreeReport.
The use of relative elements (the one's with 100% should be considered carefully, as
these elements are not fully predictable).
- Author:
- Thomas Morgner
|
Method Summary |
protected StrictDimension |
computeMinimumSize(Element e,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
StrictDimension retval,
LayoutSupport support,
boolean allowCaching)
Returns the minimum size for an element. |
protected StrictDimension |
computePreferredSize(Element e,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
StrictDimension retval,
LayoutSupport support,
boolean allowCaching)
Calculates the preferred size of an element. |
protected ElementLayoutInformation |
createLayoutInfoForDynamics(Element e,
StrictDimension parentDim,
StrictDimension maxUsableSize,
LayoutSupport support)
Creates a layout information object for a DynamicElement content calculation. |
void |
doLayout(Band b,
LayoutSupport support)
Layout a single band with all elements contained within the band.
|
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. |
StrictDimension |
minimumLayoutSize(Band b,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
LayoutSupport support)
Calculates the minimum layout size for a band. |
StrictDimension |
preferredLayoutSize(Band b,
StrictDimension containerDims,
StrictDimension maxUsableSize,
LayoutSupport support)
Calculates the preferred layout size for a band. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ABSOLUTE_POS
public static final StyleKey ABSOLUTE_POS
- A key for the absolute position of an element.
StaticLayoutManager
public StaticLayoutManager()
- Creates a new layout manager.
computeMinimumSize
protected StrictDimension computeMinimumSize(Element e,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
StrictDimension retval,
LayoutSupport support,
boolean allowCaching)
- Returns the minimum size for an element.
- Parameters:
e - the element.containerBounds - the bounds of the elements parents.maxUsableSize - retval - a dimension object that should be filled, or null, if a new
object should be createdsupport - the layout support used to compute sizes.- Returns:
- the minimum size.
computePreferredSize
protected StrictDimension computePreferredSize(Element e,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
StrictDimension retval,
LayoutSupport support,
boolean allowCaching)
- Calculates the preferred size of an element.
- Parameters:
e - the element.containerBounds - the bounds of the element's container.maxUsableSize - support - the layout support used to compute sizes.- Returns:
- the preferred size of the element.
preferredLayoutSize
public StrictDimension preferredLayoutSize(Band b,
StrictDimension containerDims,
StrictDimension maxUsableSize,
LayoutSupport support)
- Calculates the preferred layout size for a band. The band is limited to the given
container bounds as well as to the own maximum size.
The preferred size of non-absolute elements is calculated by using the parents
dimensions supplied in containerDims. Elements with a width or height of 100% will
consume all available space of the parent.
- Parameters:
b - the band.containerDims - the maximum size the band should use for that container.maxUsableSize - support - the layout support used to compute sizes.- Returns:
- the preferred size.
minimumLayoutSize
public StrictDimension minimumLayoutSize(Band b,
StrictDimension containerBounds,
StrictDimension maxUsableSize,
LayoutSupport support)
- Calculates the minimum layout size for a band. The width for the child elements are
not calculated, as we assume that the width's are defined fixed within the parent.
- Parameters:
b - the band.containerBounds - the bounds of the bands parents.maxUsableSize - support - the layout support used to compute sizes.- Returns:
- the minimum size.
doLayout
public void doLayout(Band b,
LayoutSupport support)
- Layout a single band with all elements contained within the band.
The band has its
BOUNDS already set and all elements are laid out within
these bounds. The band's properties will not be changed during the layouting.
This layout manager requires that all direct child elements have the
ABSOLUTE_POS and MINIMUM_SIZE properties set to valid
values.
- Parameters:
b - the band to lay out.support - the layout support used to compute sizes.- Throws:
- java.lang.IllegalStateException - if the bands has no bounds set.
isElementStaticWidth
protected boolean isElementStaticWidth(Element e)
- Returns
true if the element has a static width, and false
otherwise.
- Overrides:
- isElementStaticWidth in class AbstractBandLayoutManager
- 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.
- Overrides:
- isElementStaticHeight in class AbstractBandLayoutManager
- Parameters:
e - the element.- Returns:
- true or false.
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.
- Overrides:
- createLayoutInfoForDynamics in class AbstractBandLayoutManager
- Parameters:
e - the element for that the layout should be done.parentDim - the dimensions for the parent of the elementmaxUsableSize - - Returns:
- the created layout information.