org.pentaho.reporting.engine.classic.core.elementfactory
Class DateFieldElementFactory

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory
      extended by org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
          extended by org.pentaho.reporting.engine.classic.core.elementfactory.TextFieldElementFactory
              extended by org.pentaho.reporting.engine.classic.core.elementfactory.DateFieldElementFactory

public class DateFieldElementFactory
extends TextFieldElementFactory

The date format factory can be used to create date/time text elements. These text elements have special abilities to format date/time values.

Once the desired properties are set, the factory can be reused to create similiar text elements.

Author:
Thomas Morgner

Constructor Summary
DateFieldElementFactory()
          Creates a new date field element factory.
 
Method Summary
static Element createDateElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, ElementAlignment valign, FontDefinition font, String nullString, DateFormat format, String field)
          Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.
static Element createDateElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, ElementAlignment valign, FontDefinition font, String nullString, String format, String field)
          Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.
static Element createDateElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, FontDefinition font, String nullString, DateFormat format, String field)
          Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.
static Element createDateElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, FontDefinition font, String nullString, String format, String field)
          Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.
 Element createElement()
          Creates the date text element based on the defined settings.
 String getExcelCellFormat()
          Returns the excel export cell format.
 DateFormat getFormat()
          Returns the date format used for all generated text elements.
 String getFormatString()
          Returns the format string of the used date format.
 void setExcelCellFormat(String excelCellFormat)
          Defines a special cell format that should be used when exporting the report into Excel workbooks.
 void setFormat(DateFormat format)
          Defines the date format used for all generated text elements.
 void setFormatString(String formatString)
          Defines the format string of the used date format.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.TextFieldElementFactory
createStringElement, createStringElement, getFieldname, getFormula, getNullString, setFieldname, setFormula, setNullString
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
getBold, getEmbedFont, getEncoding, getFontName, getFontSize, getItalic, getLineHeight, getMaximumLetterSpacing, getMinimumLetterSpacing, getOptimumLetterSpacing, getReservedLiteral, getStrikethrough, getTrimTextContent, getUnderline, getVerticalTextAlignment, getWhitespaceCollapse, getWrap, getWrapText, setBold, setEmbedFont, setEncoding, setFontName, setFontSize, setItalic, setLineHeight, setMaximumLetterSpacing, setMinimumLetterSpacing, setOptimumLetterSpacing, setReservedLiteral, setStrikethrough, setTrimTextContent, setUnderline, setVerticalTextAlignment, setWhitespaceCollapse, setWrap, setWrapText
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory
getAbsolutePosition, getAvoidPagebreaks, getBackgroundColor, getBorderBottomColor, getBorderBottomLeftRadius, getBorderBottomLeftRadiusHeight, getBorderBottomLeftRadiusWidth, getBorderBottomRightRadius, getBorderBottomRightRadiusHeight, getBorderBottomRightRadiusWidth, getBorderBottomStyle, getBorderBottomWidth, getBorderBreakColor, getBorderBreakStyle, getBorderBreakWidth, getBorderColor, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRadius, getBorderRadiusHeight, getBorderRadiusWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderStyle, getBorderTopColor, getBorderTopLeftRadius, getBorderTopLeftRadiusHeight, getBorderTopLeftRadiusWidth, getBorderTopRightRadius, getBorderTopRightRadiusHeight, getBorderTopRightRadiusWidth, getBorderTopStyle, getBorderTopWidth, getBorderWidth, getColor, getDynamicHeight, getFontSmooth, getHeight, getHorizontalAlignment, getHRefTarget, getHRefTitle, getHRefWindow, getLayoutCachable, getMaximumHeight, getMaximumSize, getMaximumWidth, getMinimumHeight, getMinimumSize, getMinimumWidth, getName, getOrphans, getOverflowX, getOverflowY, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredSize, getUseMinChunkWidth, getVerticalAlignment, getVisible, getWidows, getWidth, getX, getY, setAbsolutePosition, setAvoidPagebreaks, setBackgroundColor, setBorderBottomColor, setBorderBottomLeftRadius, setBorderBottomLeftRadiusHeight, setBorderBottomLeftRadiusWidth, setBorderBottomRightRadius, setBorderBottomRightRadiusHeight, setBorderBottomRightRadiusWidth, setBorderBottomStyle, setBorderBottomWidth, setBorderBreakColor, setBorderBreakStyle, setBorderBreakWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRadius, setBorderRadiusHeight, setBorderRadiusWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopLeftRadius, setBorderTopLeftRadiusHeight, setBorderTopLeftRadiusWidth, setBorderTopRightRadius, setBorderTopRightRadiusHeight, setBorderTopRightRadiusWidth, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setColor, setDynamicHeight, setFontSmooth, setHeight, setHorizontalAlignment, setHRefTarget, setHRefTitle, setHRefWindow, setLayoutCachable, setMaximumHeight, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumWidth, setName, setOrphans, setOverflowX, setOverflowY, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPreferredSize, setUseMinChunkWidth, setVerticalAlignment, setVisible, setWidows, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFieldElementFactory

public DateFieldElementFactory()
Creates a new date field element factory.

Method Detail

getExcelCellFormat

public String getExcelCellFormat()
Returns the excel export cell format.

Returns:
the excel cell format.

setExcelCellFormat

public void setExcelCellFormat(String excelCellFormat)
Defines a special cell format that should be used when exporting the report into Excel workbooks.

Parameters:
excelCellFormat - the excel cell format

getFormat

public DateFormat getFormat()
Returns the date format used for all generated text elements. The date format is shared among all generated elements.

Returns:
the date format used in this factory.

setFormat

public void setFormat(DateFormat format)
Defines the date format used for all generated text elements. The date format is shared among all generated elements.

Parameters:
format - the date format used in this factory.

getFormatString

public String getFormatString()
Returns the format string of the used date format. This method will return null, if the current date format is no instance of SimpleDateFormat.

Returns:
the formatstring of the date format instance.

setFormatString

public void setFormatString(String formatString)
Defines the format string of the used date format. This method will replace the date format instance of this factory. If the format string is null, the default format string of the current locale is used.

Parameters:
formatString - the formatstring of the date format instance.

createElement

public Element createElement()
Creates the date text element based on the defined settings. Undefined properties will not be set in the generated element.

Overrides:
createElement in class TextFieldElementFactory
Returns:
the generated date text element
See Also:
ElementFactory.createElement()

createDateElement

public static Element createDateElement(String name,
                                        Rectangle2D bounds,
                                        Color paint,
                                        ElementAlignment alignment,
                                        FontDefinition font,
                                        String nullString,
                                        String format,
                                        String field)
Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.

Creates a new Element 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:
NullPointerException - if bounds, format or field are null
IllegalArgumentException - if the given alignment is invalid

createDateElement

public static Element createDateElement(String name,
                                        Rectangle2D bounds,
                                        Color paint,
                                        ElementAlignment alignment,
                                        ElementAlignment valign,
                                        FontDefinition font,
                                        String nullString,
                                        String format,
                                        String field)
Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.

Creates a new Element 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:
NullPointerException - if bounds, format or field are null
IllegalArgumentException - if the given alignment is invalid

createDateElement

public static Element createDateElement(String name,
                                        Rectangle2D bounds,
                                        Color paint,
                                        ElementAlignment alignment,
                                        FontDefinition font,
                                        String nullString,
                                        DateFormat format,
                                        String field)
Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.

Creates a new Element 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:
NullPointerException - if bounds, name, format or field are null
IllegalArgumentException - if the given alignment is invalid

createDateElement

public static Element createDateElement(String name,
                                        Rectangle2D bounds,
                                        Color paint,
                                        ElementAlignment alignment,
                                        ElementAlignment valign,
                                        FontDefinition font,
                                        String nullString,
                                        DateFormat format,
                                        String field)
Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.

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:
NullPointerException - if bounds, name, format or field are null
IllegalArgumentException - if the given alignment is invalid