org.pentaho.reporting.engine.classic.core.filter.templates
Class DateFieldTemplate

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
      extended by org.pentaho.reporting.engine.classic.core.filter.templates.DateFieldTemplate
All Implemented Interfaces:
Serializable, Cloneable, DataSource, RawDataSource, Template

public class DateFieldTemplate
extends AbstractTemplate
implements RawDataSource

A date field template.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
DateFieldTemplate()
          Creates a new date field template.
 
Method Summary
 Object clone()
          Clones this template.
 SimpleDateFormat getDateFormat()
          Returns the date formatter.
 String getField()
          Returns the field name.
 String getFormat()
          Returns the date format string.
 FormatSpecification getFormatString(ExpressionRuntime runtime, Element element, FormatSpecification formatSpecification)
          Returns information about the formatstring that was used to transform a raw-value into a formatted text.
 String getFormula()
          Returns the formula used to compute the value of the data source.
 String getNullValue()
          Returns the string that represents null values.
 Object getRawValue(ExpressionRuntime runtime, Element element)
          Returns the unformated raw value.
 Object getValue(ExpressionRuntime runtime, Element element)
          Returns the current value for the data source.
 void setDateFormat(SimpleDateFormat dateFormat)
          Sets the date formatter.
 void setField(String field)
          Sets the field name.
 void setFormat(String format)
          Sets the date format string.
 void setFormula(String formula)
          Defines the formula used to compute the value of this data source.
 void setNullValue(String nullValue)
          Sets the string that represents null values.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
getInstance, getName, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFieldTemplate

public DateFieldTemplate()
Creates a new date field template.

Method Detail

getFormat

public String getFormat()
Returns the date format string.

Returns:
The date format string.

setFormat

public void setFormat(String format)
Sets the date format string.

Parameters:
format - the format string.

getField

public String getField()
Returns the field name.

Returns:
The field name.

setField

public void setField(String field)
Sets the field name.

Parameters:
field - the field name.

getFormula

public String getFormula()
Returns the formula used to compute the value of the data source.

Returns:
the formula.

setFormula

public void setFormula(String formula)
Defines the formula used to compute the value of this data source.

Parameters:
formula - the formula for the data source.

getNullValue

public String getNullValue()
Returns the string that represents null values.

Returns:
A string.

setNullValue

public void setNullValue(String nullValue)
Sets the string that represents null values.

Parameters:
nullValue - the string that represents null values.

getDateFormat

public SimpleDateFormat getDateFormat()
Returns the date formatter.

Returns:
The date formatter.

setDateFormat

public void setDateFormat(SimpleDateFormat dateFormat)
Sets the date formatter.

Parameters:
dateFormat - the date formatter.

getValue

public Object getValue(ExpressionRuntime runtime,
                       Element element)
Returns the current value for the data source.

Specified by:
getValue in interface DataSource
Parameters:
runtime - the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.
element -
Returns:
the value.

clone

public Object clone()
             throws CloneNotSupportedException
Clones this template.

Specified by:
clone in interface DataSource
Overrides:
clone in class AbstractTemplate
Returns:
the clone.
Throws:
CloneNotSupportedException - this should never happen.

getRawValue

public Object getRawValue(ExpressionRuntime runtime,
                          Element element)
Description copied from interface: RawDataSource
Returns the unformated raw value. Whether that raw value is useable for the export is beyond the scope of this API definition, but providing access to Number or Date objects is a good idea.

Specified by:
getRawValue in interface RawDataSource
Parameters:
runtime - the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.
Returns:
the raw data.

getFormatString

public FormatSpecification getFormatString(ExpressionRuntime runtime,
                                           Element element,
                                           FormatSpecification formatSpecification)
Description copied from interface: RawDataSource
Returns information about the formatstring that was used to transform a raw-value into a formatted text. Not all elements will make use of a format-string. These elements will return FormatSpecification.TYPE_UNDEFINED in that case.

Specified by:
getFormatString in interface RawDataSource
Parameters:
runtime - the Expression runtime used to possibly compute the raw-value.
element - the element to which this datasource is added.
formatSpecification - the format specification (can be null). @return a filled format specififcation. If the formatSpecification parameter was not null, this given instance is reused.