org.jfree.report.util
Class ElementLayoutInformation

java.lang.Object
  extended byorg.jfree.report.util.ElementLayoutInformation

public class ElementLayoutInformation
extends java.lang.Object

A small carrier class to encapsulate the common layout parameters. This information is a utility class, don't expect to find one bound to an element.

Author:
Thomas Morgner

Constructor Summary
ElementLayoutInformation(java.awt.geom.Point2D absolutePosition, java.awt.geom.Dimension2D minimumSize, java.awt.geom.Dimension2D maximumSize)
          Creates a new instance.
ElementLayoutInformation(java.awt.geom.Point2D absolutePosition, java.awt.geom.Dimension2D minimumSize, java.awt.geom.Dimension2D maximumSize, java.awt.geom.Dimension2D preferredSize)
          Creates a new instance.
ElementLayoutInformation(java.awt.geom.Rectangle2D rect)
          Creates a new instance.
 
Method Summary
 java.awt.geom.Point2D getAbsolutePosition()
          Gets the absolute positon defined in this LayoutInformation.
 java.awt.geom.Dimension2D getMaximumSize()
          Gets the maximum size defined in this LayoutInformation.
 java.awt.geom.Dimension2D getMinimumSize()
          Gets the minimum size defined in this LayoutInformation.
 java.awt.geom.Dimension2D getPreferredSize()
          Gets the preferred size defined in this LayoutInformation.
 java.lang.String toString()
          Returns a string representing the object (useful for debugging).
static java.awt.geom.Dimension2D unionMin(java.awt.geom.Dimension2D max, java.awt.geom.Dimension2D pref)
          Create a minimum dimension of the given 2 dimension objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementLayoutInformation

public ElementLayoutInformation(java.awt.geom.Rectangle2D rect)
Creates a new instance.

The position will be rect.x, rect.y and all dimensions are set to rect.width, rect.height.

Parameters:
rect - the rectangle that will be the base for this ElementLayoutInformation.
Throws:
java.lang.NullPointerException - if the given rectangle is null.

ElementLayoutInformation

public ElementLayoutInformation(java.awt.geom.Point2D absolutePosition,
                                java.awt.geom.Dimension2D minimumSize,
                                java.awt.geom.Dimension2D maximumSize)
Creates a new instance.

The preferred size will be undefined (null).

Parameters:
absolutePosition - the absolute position for the element.
minimumSize - the minimum size for the element.
maximumSize - the maximum size for the element.
Throws:
java.lang.NullPointerException - if one of the parameters is null.

ElementLayoutInformation

public ElementLayoutInformation(java.awt.geom.Point2D absolutePosition,
                                java.awt.geom.Dimension2D minimumSize,
                                java.awt.geom.Dimension2D maximumSize,
                                java.awt.geom.Dimension2D preferredSize)
Creates a new instance.

If the preferred size is null, then it is left undefined.

Parameters:
absolutePosition - the absolute position for the element
minimumSize - the minimum size for the element
maximumSize - the maximum size for the element
preferredSize - the preferred size or null if not known.
Throws:
java.lang.NullPointerException - if the position or max/min size is null.
Method Detail

getAbsolutePosition

public java.awt.geom.Point2D getAbsolutePosition()
Gets the absolute positon defined in this LayoutInformation.

Returns:
a clone of the absolute position.

getMinimumSize

public java.awt.geom.Dimension2D getMinimumSize()
Gets the minimum size defined in this LayoutInformation.

Returns:
a clone of the minimum size.

getMaximumSize

public java.awt.geom.Dimension2D getMaximumSize()
Gets the maximum size defined in this LayoutInformation.

Returns:
a clone of the maximum size.

getPreferredSize

public java.awt.geom.Dimension2D getPreferredSize()
Gets the preferred size defined in this LayoutInformation.

Returns:
a clone of the preferred size.

unionMin

public static java.awt.geom.Dimension2D unionMin(java.awt.geom.Dimension2D max,
                                                 java.awt.geom.Dimension2D pref)
Create a minimum dimension of the given 2 dimension objects. If pref is not given, the max parameter is returned unchanged.

This is used to limit the element bounds to the preferred size or the maximum size (in case the user misconfigured anything).

Parameters:
max - the maximum size as retrieved from the element.
pref - the preferred size.
Returns:
the minimum dimension.

toString

public java.lang.String toString()
Returns a string representing the object (useful for debugging).

Returns:
A string.