org.jfree.report.elementfactory
Class ImageFieldElementFactory

java.lang.Object
  extended byorg.jfree.report.elementfactory.ElementFactory
      extended byorg.jfree.report.elementfactory.ImageElementFactory
          extended byorg.jfree.report.elementfactory.ImageFieldElementFactory

public class ImageFieldElementFactory
extends ImageElementFactory

A factory to define ImageFieldElements. These elements expect an java.awt.Image or an ImageReference instance as content and will display the content in the report.

Author:
Thomas Morgner

Constructor Summary
ImageFieldElementFactory()
          DefaultConstructor.
 
Method Summary
 Element createElement()
          Creates the image element based on the defined properties.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.lang.String field)
          Creates a new ImageElement.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.lang.String field, boolean scale)
          Creates a new ImageElement.
static ImageElement createImageDataRowElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.lang.String field, boolean scale, boolean keepAspectRatio)
          Creates a new ImageElement.
 java.lang.String getFieldname()
          Returns the field name from where to read the content of the element.
 void setFieldname(java.lang.String fieldname)
          Defines the field name from where to read the content of the element.
 
Methods inherited from class org.jfree.report.elementfactory.ImageElementFactory
applyStyle, getKeepAspectRatio, getScale, setKeepAspectRatio, setScale
 
Methods inherited from class org.jfree.report.elementfactory.ElementFactory
applyElementName, getAbsolutePosition, getDynamicHeight, getMaximumSize, getMinimumSize, getName, getPreferredSize, setAbsolutePosition, setDynamicHeight, setMaximumSize, setMinimumSize, setName, setPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageFieldElementFactory

public ImageFieldElementFactory()
DefaultConstructor.

Method Detail

getFieldname

public java.lang.String getFieldname()
Returns the field name from where to read the content of the element.

Returns:
the field name.

setFieldname

public void setFieldname(java.lang.String fieldname)
Defines the field name from where to read the content of the element. The field name is the name of a datarow column.

Parameters:
fieldname - the field name.

createElement

public Element createElement()
Creates the image element based on the defined properties.

Specified by:
createElement in class ElementFactory
Returns:
the created image element.
Throws:
java.lang.IllegalStateException - if the fieldname is not set.
See Also:
ElementFactory.createElement()

createImageDataRowElement

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

Parameters:
name - the name of the new element
bounds - the bounds of the new element
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.lang.String field,
                                                     boolean scale)
Creates a new ImageElement.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
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.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.
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