com.jrefinery.report
Class ItemFactory

java.lang.Object
  extended bycom.jrefinery.report.ItemFactory

public class ItemFactory
extends java.lang.Object

A factory used to create elements and bands using a single line command. The factory creates elements suitable for the static layout.

Author:
Thomas Morgner

Constructor Summary
protected ItemFactory()
          Constructor.
 
Method Summary
static TextElement createDateElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.text.DateFormat format, java.lang.String field)
          Creates a new TextElement containing a date filter structure.
static TextElement createDateElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String field)
          Creates a new TextElement containing a date filter structure.
static TextElement createDateElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String nullString, java.text.DateFormat format, java.lang.String field)
          Creates a new TextElement containing a date filter structure.
static TextElement createDateElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String field)
          Creates a new TextElement containing a date filter structure.
static TextElement createDateFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.text.DateFormat format, java.lang.String function)
          Deprecated. use createDateElement instead, as all DataAccess has been unified
static TextElement createDateFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String function)
          Deprecated. use createDateElement instead, as all DataAccess has been unified
static TextElement createGeneralElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String function)
          Deprecated. don't use the itemfactory for that kind of element or use the createStringElement method
static Group createGroup(java.lang.String name, java.util.List fields, GroupFooter footer, GroupHeader header)
          Creates a new group with the specified name and GroupHeader and -footer.
static Band createGroupFooter(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint)
          Creates a GroupFooter-band with the specified height and the DefaultFont and DefaultPaint given.
static Band createGroupHeader(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint, boolean pageBreak)
          Creates a GroupHeader-band with the specified height and the DefaultFont and DefaultPaint given.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field)
          Creates a new ImageElement.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field, boolean scale)
          Creates a new ImageElement.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field, boolean scale, boolean keepAspectRatio)
          Creates a new ImageElement.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.net.URL source)
          Creates a new ImageElement.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.net.URL source, boolean scale)
          Creates a new ImageElement.
static ImageElement createImageElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.net.URL source, boolean scale, boolean keepAspectRatio)
          Creates a new ImageElement.
static ImageElement createImageFieldElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field)
          Deprecated. use createImageDataRowElement instead
static ImageElement createImageFunctionElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String function)
          Deprecated. use createImageDataRowElement instead
static ImageElement createImageURLElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field)
          Creates a new ImageElement, which is fed from an URL stored in the datasource.
static ImageElement createImageURLElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field, boolean scale)
          Creates a new ImageElement, which is fed from an URL stored in the datasource.
static ImageElement createImageURLElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field, boolean scale, boolean keepAspectRatio)
          Creates a new ImageElement, which is fed from an URL stored in the datasource.
static ImageElement createImageURLField(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String field)
          Deprecated. use createImageURLElement instead
static ImageElement createImageURLFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.lang.String function)
          Deprecated. use createImageURLElement instead
static Band createItemBand(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint)
          Creates an ItemBand.
static TextElement createLabelElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String labeltext)
          Creates a new TextElement containing a label.
static TextElement createLabelElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String labeltext)
          Creates a new TextElement containing a label.
static ShapeElement createLineShapeElement(java.lang.String name, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.geom.Line2D shape)
          Creates a new LineShapeElement.
static TextElement createMultilineTextElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String field)
          Deprecated. use createStringElement instead
static TextElement createNumberElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.text.NumberFormat format, java.lang.String field)
          Creates a new TextElement containing a numeric filter structure.
static TextElement createNumberElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String field)
          Creates a new TextElement containing a numeric filter structure.
static TextElement createNumberElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String nullString, java.text.NumberFormat format, java.lang.String field)
          Creates a new TextElement containing a numeric filter structure.
static TextElement createNumberElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String field)
          Creates a new TextElement containing a numeric filter structure.
static TextElement createNumberFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.text.NumberFormat format, java.lang.String function)
          Deprecated. use createNumberElement instead
static TextElement createNumberFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String format, java.lang.String function)
          Deprecated. use createNumberElement instead
static Band createPageFooter(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint, boolean onfirstpage, boolean onlastpage)
          Creates a PageFooter-band with the specified height and the DefaultFont and DefaultPaint given.
static Band createPageHeader(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint, boolean onfirstpage, boolean onlastpage)
          Creates a PageHeader-band with the specified height and the DefaultFont and DefaultPaint given.
static ShapeElement createRectangleShapeElement(java.lang.String name, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.geom.Rectangle2D shape, boolean shouldDraw, boolean shouldFill)
          Creates a new RectangleShapeElement.
static JFreeReport createReport(java.lang.String name, ReportHeader rheader, ReportFooter rfooter, PageHeader pheader, PageFooter pfooter, GroupList groups, ItemBand items, ExpressionCollection functions, ExpressionCollection expressions, java.awt.print.PageFormat pageformat, javax.swing.table.TableModel data)
          Creates a new report.
static Band createReportFooter(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint, boolean isownpage)
          Creates a ReportFooter-band with the specified height and the DefaultFont and DefaultPaint given.
static Band createReportHeader(float height, java.awt.Font defaultFont, java.awt.Paint defaultPaint, boolean isownpage)
          Creates a ReportHeader-band with the specified height and the DefaultFont and DefaultPaint given.
static TextElement createResourceElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Color color, int alignment, int valignment, java.awt.Font font, java.lang.String nullValue, java.lang.String resourceBase, java.lang.String field)
          creates a ResourceElement.
static TextElement createResourceLabel(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Color paint, int alignment, int valign, java.awt.Font font, java.lang.String nullValue, java.lang.String resourceBase, java.lang.String resourceKey)
          creates a ResourceElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill)
          Deprecated. this methods has to extract the bounds from the shape and correct the shape by using an AffineTransform. Use one of the createShape methods, that allow you to supply separate bounds and shapes.
static ShapeElement createShapeElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill, boolean shouldScale)
          Creates a new ShapeElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Shape shape, boolean shouldDraw, boolean shouldFill, boolean shouldScale, boolean keepAspectRatio)
          Creates a new ShapeElement.
static ShapeElement createShapeElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, java.awt.Stroke stroke, java.lang.String fieldname, boolean shouldDraw, boolean shouldFill, boolean shouldScale, boolean keepAspectRatio)
          Creates a new ShapeElement.
static TextElement createStringElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String field)
          Creates a new TextElement without any additional filtering.
static TextElement createStringElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, int valign, java.awt.Font font, java.lang.String nullString, java.lang.String field)
          Creates a new TextElement without any additional filtering.
static TextElement createStringFunction(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Paint paint, int alignment, java.awt.Font font, java.lang.String nullString, java.lang.String function)
          Deprecated. use createStringElement instead
static void setElementBounds(Element e, java.awt.geom.Rectangle2D bounds)
          A utility method for setting the element bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemFactory

protected ItemFactory()
Constructor. Not used.

Method Detail

createDateElement

public static TextElement createDateElement(java.lang.String name,
                                            java.awt.geom.Rectangle2D bounds,
                                            java.awt.Paint paint,
                                            int alignment,
                                            java.awt.Font font,
                                            java.lang.String nullString,
                                            java.lang.String format,
                                            java.lang.String field)
Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat-formatstring used to format the date
field - the fieldname to retrieve values from
Returns:
a report element for displaying a java.util.Date value.
Throws:
java.lang.NullPointerException - if bounds, format or field are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createDateElement

public static TextElement createDateElement(java.lang.String name,
                                            java.awt.geom.Rectangle2D bounds,
                                            java.awt.Paint paint,
                                            int alignment,
                                            int valign,
                                            java.awt.Font font,
                                            java.lang.String nullString,
                                            java.lang.String format,
                                            java.lang.String field)
Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment
valign - the vertical text alignment
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat-formatstring used to format the date
field - the fieldname to retrieve values from
Returns:
a report element for displaying a java.util.Date value.
Throws:
java.lang.NullPointerException - if bounds, format or field are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createDateElement

public static TextElement createDateElement(java.lang.String name,
                                            java.awt.geom.Rectangle2D bounds,
                                            java.awt.Paint paint,
                                            int alignment,
                                            java.awt.Font font,
                                            java.lang.String nullString,
                                            java.text.DateFormat format,
                                            java.lang.String field)
Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat used to format the date
field - the fieldname to retrieve values from
Returns:
a report element for displaying a java.util.Date value.
Throws:
java.lang.NullPointerException - if bounds, name, format or field are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createDateElement

public static TextElement createDateElement(java.lang.String name,
                                            java.awt.geom.Rectangle2D bounds,
                                            java.awt.Paint paint,
                                            int alignment,
                                            int valign,
                                            java.awt.Font font,
                                            java.lang.String nullString,
                                            java.text.DateFormat format,
                                            java.lang.String field)
Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
valign - the vertical text alignment
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat used to format the date
field - the fieldname to retrieve values from
Returns:
a report element for displaying a java.util.Date value.
Throws:
java.lang.NullPointerException - if bounds, name, format or field are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createDateFunction

public static TextElement createDateFunction(java.lang.String name,
                                             java.awt.geom.Rectangle2D bounds,
                                             java.awt.Paint paint,
                                             int alignment,
                                             java.awt.Font font,
                                             java.lang.String nullString,
                                             java.lang.String format,
                                             java.lang.String function)
Deprecated. use createDateElement instead, as all DataAccess has been unified

Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat-formatstring used to format the date
function - the function name to retrieve values from
Returns:
a report element for displaying a java.util.Date function value.
Throws:
java.lang.NullPointerException - if bounds, name, format or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createDateFunction

public static TextElement createDateFunction(java.lang.String name,
                                             java.awt.geom.Rectangle2D bounds,
                                             java.awt.Paint paint,
                                             int alignment,
                                             java.awt.Font font,
                                             java.lang.String nullString,
                                             java.text.DateFormat format,
                                             java.lang.String function)
Deprecated. use createDateElement instead, as all DataAccess has been unified

Creates a new TextElement containing a date filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
format - the SimpleDateFormat-formatstring used to format the date
function - the function name to retrieve values from
Returns:
a report element for displaying a java.util.Date function value.
Throws:
java.lang.NullPointerException - if bounds, name, format or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createGeneralElement

public static TextElement createGeneralElement(java.lang.String name,
                                               java.awt.geom.Rectangle2D bounds,
                                               java.awt.Paint paint,
                                               int alignment,
                                               java.awt.Font font,
                                               java.lang.String nullString,
                                               java.lang.String function)
Deprecated. don't use the itemfactory for that kind of element or use the createStringElement method

Creates a new TextElement containing a general filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
function - the function to retrieve values from
Returns:
a report element for displaying a general object.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.net.URL source)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
source - the source url from where to load the image
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.net.URL source,
                                              boolean scale)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the color of this element (currently not used).
source - the source url from where to load the image.
scale - scale the image?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageElement

public static ImageElement createImageElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.net.URL source,
                                              boolean scale,
                                              boolean keepAspectRatio)
Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will not change during the report processing.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the color of this element (currently not used).
source - the source url from where to load the image.
scale - scale the image?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageURLField

public static ImageElement createImageURLField(java.lang.String name,
                                               java.awt.geom.Rectangle2D bounds,
                                               java.awt.Paint paint,
                                               java.lang.String field)
Deprecated. use createImageURLElement instead

Creates a new ImageElement, which is fed from an URL stored in the datasource.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
field - the name of the column/function/expression that returns the URL for the image.
Returns:
a report element for displaying an image from a URL.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageURLElement

public static ImageElement createImageURLElement(java.lang.String name,
                                                 java.awt.geom.Rectangle2D bounds,
                                                 java.awt.Paint paint,
                                                 java.lang.String field)
Creates a new ImageElement, which is fed from an URL stored in the datasource.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
field - the name of the column/function/expression that returns the URL for the image.
Returns:
a report element for displaying an image based on a URL.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageURLElement

public static ImageElement createImageURLElement(java.lang.String name,
                                                 java.awt.geom.Rectangle2D bounds,
                                                 java.awt.Paint paint,
                                                 java.lang.String field,
                                                 boolean scale)
Creates a new ImageElement, which is fed from an URL stored in the datasource.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the color of this element (currently not used).
field - the name of the column/function/expression that returns the URL for the image.
scale - scale the image?
Returns:
a report element for displaying an image based on a URL.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageURLElement

public static ImageElement createImageURLElement(java.lang.String name,
                                                 java.awt.geom.Rectangle2D bounds,
                                                 java.awt.Paint paint,
                                                 java.lang.String field,
                                                 boolean scale,
                                                 boolean keepAspectRatio)
Creates a new ImageElement, which is fed from an URL stored in the datasource.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
field - the name of the column/function/expression that returns the URL for the image.
scale - true if the content should be scaled to fit.
keepAspectRatio - preserve the aspect ratio.
Returns:
a report element for displaying an image based on a URL.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageURLFunction

public static ImageElement createImageURLFunction(java.lang.String name,
                                                  java.awt.geom.Rectangle2D bounds,
                                                  java.awt.Paint paint,
                                                  java.lang.String function)
Deprecated. use createImageURLElement instead

Creates a new ImageElement, which is fed from an URL stored in the datasource.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
function - the name of the function that returns the image URL.
Returns:
a report element for displaying an image based on a URL.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageFieldElement

public static ImageElement createImageFieldElement(java.lang.String name,
                                                   java.awt.geom.Rectangle2D bounds,
                                                   java.awt.Paint paint,
                                                   java.lang.String field)
Deprecated. use createImageDataRowElement instead

Creates a new ImageElement.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
field - the name of the column/function/expression that returns the URL for the image.
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageDataRowElement

public static ImageElement createImageDataRowElement(java.lang.String name,
                                                     java.awt.geom.Rectangle2D bounds,
                                                     java.awt.Paint paint,
                                                     java.lang.String field)
Creates a new ImageElement.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
field - the name of the column/function/expression that returns the URL for the image.
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageDataRowElement

public static ImageElement createImageDataRowElement(java.lang.String name,
                                                     java.awt.geom.Rectangle2D bounds,
                                                     java.awt.Paint paint,
                                                     java.lang.String field,
                                                     boolean scale)
Creates a new ImageElement.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the color of this element (currently not used).
field - the name of the column/function/expression that returns the URL for the image.
scale - scale the image?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageDataRowElement

public static ImageElement createImageDataRowElement(java.lang.String name,
                                                     java.awt.geom.Rectangle2D bounds,
                                                     java.awt.Paint paint,
                                                     java.lang.String field,
                                                     boolean scale,
                                                     boolean keepAspectRatio)
Creates a new ImageElement.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the color of this element (currently not used).
field - the name of the column/function/expression that returns the URL for the image.
scale - scale the image?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createImageFunctionElement

public static ImageElement createImageFunctionElement(java.lang.String name,
                                                      java.awt.geom.Rectangle2D bounds,
                                                      java.awt.Paint paint,
                                                      java.lang.String function)
Deprecated. use createImageDataRowElement instead

Creates a new ImageElement.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the color of this element (currently not used)
function - the name of the function that returns the URL for the image.
Returns:
a report element for displaying an image.
Throws:
java.lang.NullPointerException - if bounds, name or source are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createLabelElement

public static TextElement createLabelElement(java.lang.String name,
                                             java.awt.geom.Rectangle2D bounds,
                                             java.awt.Paint paint,
                                             int alignment,
                                             java.awt.Font font,
                                             java.lang.String labeltext)
Creates a new TextElement containing a label.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
labeltext - the text to display
Returns:
a report element for displaying a label (static text).
Throws:
java.lang.NullPointerException - if bounds, name, format or field are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createLabelElement

public static TextElement createLabelElement(java.lang.String name,
                                             java.awt.geom.Rectangle2D bounds,
                                             java.awt.Paint paint,
                                             int alignment,
                                             int valign,
                                             java.awt.Font font,
                                             java.lang.String labeltext)
Creates a new TextElement containing a label.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the text color of this text element.
alignment - the horizontal alignment.
valign - the vertical alignment.
font - the font for this element.
labeltext - the text to display.
Returns:
a report element for displaying a label (static text).
Throws:
java.lang.NullPointerException - if bounds, name, format or field are null.
java.lang.IllegalArgumentException - if the given alignment is invalid.

createLineShapeElement

public static ShapeElement createLineShapeElement(java.lang.String name,
                                                  java.awt.Paint paint,
                                                  java.awt.Stroke stroke,
                                                  java.awt.geom.Line2D shape)
Creates a new LineShapeElement. The line must not contain negative coordinates, or an IllegalArgumentException will be thrown. If you want to define scaling lines, you will have use one of the createShape methods.

Parameters:
name - the name of the new element
paint - the line color of this element
stroke - the stroke of this shape. For pdf use, restrict to BasicStokes.
shape - the Line2D shape
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.Paint paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill)
Deprecated. this methods has to extract the bounds from the shape and correct the shape by using an AffineTransform. Use one of the createShape methods, that allow you to supply separate bounds and shapes.

Creates a new LineShapeElement.

Parameters:
name - the name of the new element.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill,
                                              boolean shouldScale)
Creates a new ShapeElement.

Parameters:
name - the name of the new element.
bounds - the bounds.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
shouldScale - scale the shape?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.awt.Stroke stroke,
                                              java.awt.Shape shape,
                                              boolean shouldDraw,
                                              boolean shouldFill,
                                              boolean shouldScale,
                                              boolean keepAspectRatio)
Creates a new ShapeElement.

Parameters:
name - the name of the new element.
bounds - the bounds.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
shape - the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
shouldScale - scale the shape?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createShapeElement

public static ShapeElement createShapeElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              java.awt.Stroke stroke,
                                              java.lang.String fieldname,
                                              boolean shouldDraw,
                                              boolean shouldFill,
                                              boolean shouldScale,
                                              boolean keepAspectRatio)
Creates a new ShapeElement.

Parameters:
name - the name of the new element.
bounds - the bounds.
paint - the line color of this element.
stroke - the stroke of this shape. For pdf use, restrict to BasicStrokes.
fieldname - the fieldname from where to get the shape.
shouldDraw - draw the shape?
shouldFill - fill the shape?
shouldScale - scale the shape?
keepAspectRatio - preserve the aspect ratio?
Returns:
a report element for drawing a line.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createRectangleShapeElement

public static ShapeElement createRectangleShapeElement(java.lang.String name,
                                                       java.awt.Paint paint,
                                                       java.awt.Stroke stroke,
                                                       java.awt.geom.Rectangle2D shape,
                                                       boolean shouldDraw,
                                                       boolean shouldFill)
Creates a new RectangleShapeElement.

Parameters:
name - the name of the new element
paint - the line color of this element
stroke - the stroke of this shape. For pdf use, restrict to BasicStokes.
shape - the Rectangle2D shape
shouldDraw - a flag controlling whether or not the shape outline is drawn.
shouldFill - a flag controlling whether or not the shape interior is filled.
Returns:
a report element for drawing a rectangle.
Throws:
java.lang.NullPointerException - if bounds, name or shape are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createMultilineTextElement

public static TextElement createMultilineTextElement(java.lang.String name,
                                                     java.awt.geom.Rectangle2D bounds,
                                                     java.awt.Paint paint,
                                                     int alignment,
                                                     java.awt.Font font,
                                                     java.lang.String nullString,
                                                     java.lang.String field)
Deprecated. use createStringElement instead

Creates a new TextElement. The difference between StringElements and MultilineTextElements is historical and no longer relevant.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
field - the field in the datamodel to retrieve values from
Returns:
a report element for displaying text on multiple lines.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberElement

public static TextElement createNumberElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.text.NumberFormat format,
                                              java.lang.String field)
Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
field - the field in the datamodel to retrieve values from
format - the NumberFormat used in this number element
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberElement

public static TextElement createNumberElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              int valign,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.text.NumberFormat format,
                                              java.lang.String field)
Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the text color of this text element.
alignment - the horizontal text alignment.
valign - the vertical alignment.
font - the font for this element.
nullString - the text used when the value of this element is null.
field - the field in the datamodel to retrieve values from.
format - the NumberFormat used in this number element.
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberElement

public static TextElement createNumberElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.lang.String format,
                                              java.lang.String field)
Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
field - the fieldname in the datamodel to retrieve values from
format - the DecimalFormatString used in this text field
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberElement

public static TextElement createNumberElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              int valign,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.lang.String format,
                                              java.lang.String field)
Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the text color of this text element.
alignment - the horizontal text alignment.
valign - the vertical alignment.
font - the font for this element.
nullString - t he text used when the value of this element is null.
field - the fieldname in the datamodel to retrieve values from.
format - the DecimalFormatString used in this text field.
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberFunction

public static TextElement createNumberFunction(java.lang.String name,
                                               java.awt.geom.Rectangle2D bounds,
                                               java.awt.Paint paint,
                                               int alignment,
                                               java.awt.Font font,
                                               java.lang.String nullString,
                                               java.lang.String format,
                                               java.lang.String function)
Deprecated. use createNumberElement instead

Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
function - the function to retrieve values from
format - the DecimalFormatString used in this text field
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createNumberFunction

public static TextElement createNumberFunction(java.lang.String name,
                                               java.awt.geom.Rectangle2D bounds,
                                               java.awt.Paint paint,
                                               int alignment,
                                               java.awt.Font font,
                                               java.lang.String nullString,
                                               java.text.NumberFormat format,
                                               java.lang.String function)
Deprecated. use createNumberElement instead

Creates a new TextElement containing a numeric filter structure.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
function - the function to retrieve values from
format - the NumberFormat used in this text field
Returns:
a report element for displaying Number objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createStringElement

public static TextElement createStringElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.lang.String field)
Creates a new TextElement without any additional filtering.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
field - the field in the datamodel to retrieve values from
Returns:
a report element for displaying String objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createStringElement

public static TextElement createStringElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Paint paint,
                                              int alignment,
                                              int valign,
                                              java.awt.Font font,
                                              java.lang.String nullString,
                                              java.lang.String field)
Creates a new TextElement without any additional filtering.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
valign - the vertical alignment.
font - the font for this element
nullString - the text used when the value of this element is null
field - the field in the datamodel to retrieve values from
Returns:
a report element for displaying String objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createStringFunction

public static TextElement createStringFunction(java.lang.String name,
                                               java.awt.geom.Rectangle2D bounds,
                                               java.awt.Paint paint,
                                               int alignment,
                                               java.awt.Font font,
                                               java.lang.String nullString,
                                               java.lang.String function)
Deprecated. use createStringElement instead

Creates a new TextElement without any additional filtering.

Parameters:
name - the name of the new element
bounds - the bounds of the new element
paint - the text color of this text element
alignment - the horizontal text alignment.
font - the font for this element
nullString - the text used when the value of this element is null
function - the name of the function to retrieve values from
Returns:
a report element for displaying String objects.
Throws:
java.lang.NullPointerException - if bounds, name or function are null
java.lang.IllegalArgumentException - if the given alignment is invalid

createGroupFooter

public static Band createGroupFooter(float height,
                                     java.awt.Font defaultFont,
                                     java.awt.Paint defaultPaint)
Creates a GroupFooter-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
Returns:
the GroupFooter

createGroupHeader

public static Band createGroupHeader(float height,
                                     java.awt.Font defaultFont,
                                     java.awt.Paint defaultPaint,
                                     boolean pageBreak)
Creates a GroupHeader-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
pageBreak - a flag indicating whether to do a pagebreak before this header is printed
Returns:
the GroupHeader

createPageFooter

public static Band createPageFooter(float height,
                                    java.awt.Font defaultFont,
                                    java.awt.Paint defaultPaint,
                                    boolean onfirstpage,
                                    boolean onlastpage)
Creates a PageFooter-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
onfirstpage - a flag indicating whether to print this footer on the first page of the report
onlastpage - a flag indicating whether to print this footer on the last page of the report
Returns:
the PageFooter

createPageHeader

public static Band createPageHeader(float height,
                                    java.awt.Font defaultFont,
                                    java.awt.Paint defaultPaint,
                                    boolean onfirstpage,
                                    boolean onlastpage)
Creates a PageHeader-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
onfirstpage - a flag indicating whether to print this footer on the first page of the report
onlastpage - a flag indicating whether to print this footer on the last page of the report
Returns:
the PageHeader

createReportFooter

public static Band createReportFooter(float height,
                                      java.awt.Font defaultFont,
                                      java.awt.Paint defaultPaint,
                                      boolean isownpage)
Creates a ReportFooter-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
isownpage - a flag indicating whether to issue a pagebreak before the report footer is printed
Returns:
the ReportFooter

createReportHeader

public static Band createReportHeader(float height,
                                      java.awt.Font defaultFont,
                                      java.awt.Paint defaultPaint,
                                      boolean isownpage)
Creates a ReportHeader-band with the specified height and the DefaultFont and DefaultPaint given.

Parameters:
height - the height of the band in points
defaultFont - the default font for this band
defaultPaint - the default paint for this band
isownpage - a flag indicating whether to issue a pagebreak after the report header is printed
Returns:
the ReportHeader

createItemBand

public static Band createItemBand(float height,
                                  java.awt.Font defaultFont,
                                  java.awt.Paint defaultPaint)
Creates an ItemBand.

Parameters:
height - the height of the band in points.
defaultFont - the default font for this band.
defaultPaint - the default paint for this band.
Returns:
the band.

createGroup

public static Group createGroup(java.lang.String name,
                                java.util.List fields,
                                GroupFooter footer,
                                GroupHeader header)
Creates a new group with the specified name and GroupHeader and -footer. The columnnames forming the group are contained as Strings in the fields list. If no field list is given, a default group is created. This group contains all rows of the datamodel and behaves like a report header and -footer.

Parameters:
name - the name of the group
fields - the fields as a list of strings (optional)
footer - the optional groupfooter
header - the optional groupheader
Returns:
the ReportFooter

createReport

public static JFreeReport createReport(java.lang.String name,
                                       ReportHeader rheader,
                                       ReportFooter rfooter,
                                       PageHeader pheader,
                                       PageFooter pfooter,
                                       GroupList groups,
                                       ItemBand items,
                                       ExpressionCollection functions,
                                       ExpressionCollection expressions,
                                       java.awt.print.PageFormat pageformat,
                                       javax.swing.table.TableModel data)
Creates a new report.

Parameters:
name - the name of the report.
rheader - the optional report header.
rfooter - the optional report footer.
pheader - the optional page header.
pfooter - the optional page footer.
groups - the list of groups for this report (optional).
items - the itemband for this report (optional).
functions - the (optional) functions used in this report.
expressions - the (optional) expressions used in this report.
pageformat - the (optional) default pageformat.
data - the data for this report, which is optional at this point.
Returns:
the created report.

setElementBounds

public static void setElementBounds(Element e,
                                    java.awt.geom.Rectangle2D bounds)
A utility method for setting the element bounds.

Parameters:
e - the element.
bounds - the bounds.

createResourceElement

public static TextElement createResourceElement(java.lang.String name,
                                                java.awt.geom.Rectangle2D bounds,
                                                java.awt.Color color,
                                                int alignment,
                                                int valignment,
                                                java.awt.Font font,
                                                java.lang.String nullValue,
                                                java.lang.String resourceBase,
                                                java.lang.String field)
creates a ResourceElement. ResourceElements resolve their value using a java.util.ResourceBundle.

Parameters:
name - the name of the element (null allowed)
bounds - the element's bounds
color - the text color of the element
alignment - the element's horizontal text alignment
valignment - the element's vertical text alignment
font - the elements font
nullValue - the text used when the value of this element is null
field - the field in the datamodel to retrieve values from
resourceBase - the classname/basename of the assigned resource bundle
Returns:
the created ResourceElement

createResourceLabel

public static TextElement createResourceLabel(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Color paint,
                                              int alignment,
                                              int valign,
                                              java.awt.Font font,
                                              java.lang.String nullValue,
                                              java.lang.String resourceBase,
                                              java.lang.String resourceKey)
creates a ResourceElement. ResourceElements resolve their value using a java.util.ResourceBundle.

Parameters:
name - the name of the element (null allowed)
bounds - the element's bounds
paint - the text color of the element
alignment - the element's horizontal text alignment
valign - the element's vertical text alignment
font - the elements font
nullValue - the text used when the value of this element is null
resourceKey - the key which is used to query the resource bundle
resourceBase - the classname/basename of the assigned resource bundle
Returns:
the created ResourceElement