org.jfree.report.elementfactory
Class TextFieldElementFactory

java.lang.Object
  extended byorg.jfree.report.elementfactory.ElementFactory
      extended byorg.jfree.report.elementfactory.TextElementFactory
          extended byorg.jfree.report.elementfactory.TextFieldElementFactory
Direct Known Subclasses:
DateFieldElementFactory, NumberFieldElementFactory, ResourceFieldElementFactory

public class TextFieldElementFactory
extends TextElementFactory

A factory to define text fields. Text fields read their content from the dataRow and try to print it as plain text (using toString() if required).

Author:
Thomas Morgner

Constructor Summary
TextFieldElementFactory()
          DefaultConstructor.
 
Method Summary
 Element createElement()
          Creates the text field element.
static TextElement createStringElement(java.lang.String name, java.awt.geom.Rectangle2D bounds, java.awt.Color paint, ElementAlignment alignment, ElementAlignment valign, FontDefinition 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.Color paint, ElementAlignment alignment, FontDefinition font, java.lang.String nullString, java.lang.String field)
          Creates a new TextElement without any additional filtering.
 java.lang.String getFieldname()
          Returns the field name from where to read the content of the element.
 java.lang.String getNullString()
          Returns the null string for the text element.
 void setFieldname(java.lang.String fieldname)
          Defines the field name from where to read the content of the element.
 void setNullString(java.lang.String nullString)
          Defines the null string for the text element.
 
Methods inherited from class org.jfree.report.elementfactory.TextElementFactory
applyStyle, getBold, getColor, getEmbedFont, getEncoding, getFontName, getFontSize, getHorizontalAlignment, getItalic, getLineHeight, getReservedLiteral, getStrikethrough, getTrimTextContent, getUnderline, getVerticalAlignment, setBold, setColor, setEmbedFont, setEncoding, setFontName, setFontSize, setHorizontalAlignment, setItalic, setLineHeight, setReservedLiteral, setStrikethrough, setTrimTextContent, setUnderline, setVerticalAlignment
 
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

TextFieldElementFactory

public TextFieldElementFactory()
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.

getNullString

public java.lang.String getNullString()
Returns the null string for the text element. The null string is used when no content is found for that element.

Returns:
the null string.

setNullString

public void setNullString(java.lang.String nullString)
Defines the null string for the text element. The null string is used when no content is found for that element. The nullstring itself can be null.

Parameters:
nullString - the null string.

createElement

public Element createElement()
Creates the text field element.

Specified by:
createElement in class ElementFactory
Returns:
the generated text field element
Throws:
java.lang.IllegalStateException - if the fieldname is null.
See Also:
ElementFactory.createElement()

createStringElement

public static TextElement createStringElement(java.lang.String name,
                                              java.awt.geom.Rectangle2D bounds,
                                              java.awt.Color paint,
                                              ElementAlignment alignment,
                                              FontDefinition 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.Color paint,
                                              ElementAlignment alignment,
                                              ElementAlignment valign,
                                              FontDefinition 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