com.jrefinery.report.filter.templates
Class DateFieldTemplate

java.lang.Object
  |
  +--com.jrefinery.report.filter.templates.AbstractTemplate
        |
        +--com.jrefinery.report.filter.templates.DateFieldTemplate
All Implemented Interfaces:
java.lang.Cloneable, DataRowConnectable, DataSource, java.io.Serializable, Template

public class DateFieldTemplate
extends AbstractTemplate
implements DataRowConnectable

A date field template.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
DateFieldTemplate()
          Creates a new date field template.
 
Method Summary
 java.lang.Object clone()
          Clones this template.
 void connectDataRow(DataRow row)
          Connects a DataRow to the data source.
 void disconnectDataRow(DataRow row)
          Releases the connection to the data row.
protected  DataRowDataSource getDataRowDataSource()
          Returns the data-row datasource.
protected  SimpleDateFormatFilter getDateFilter()
          Returns the date filter.
 java.text.SimpleDateFormat getDateFormat()
          Returns the date formatter.
 java.lang.String getField()
          Returns the field name.
 java.lang.String getFormat()
          Returns the date format string.
 java.lang.String getNullValue()
          Returns the string that represents null values.
protected  StringFilter getStringFilter()
          Returns the string filter.
 java.lang.Object getValue()
          Returns the current value for the data source.
 void setDateFormat(java.text.SimpleDateFormat dateFormat)
          Sets the date formatter.
 void setField(java.lang.String field)
          Sets the field name.
 void setFormat(java.lang.String format)
          Sets the date format string.
 void setNullValue(java.lang.String nullValue)
          Sets the string that represents null values.
 
Methods inherited from class com.jrefinery.report.filter.templates.AbstractTemplate
getInstance, getName, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFieldTemplate

public DateFieldTemplate()
Creates a new date field template.

Method Detail

getFormat

public java.lang.String getFormat()
Returns the date format string.

Returns:
The date format string.

setFormat

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

Parameters:
format - the format string.

getField

public java.lang.String getField()
Returns the field name.

Returns:
The field name.

setField

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

Parameters:
field - the field name.

getNullValue

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

Returns:
A string.

setNullValue

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

Parameters:
nullValue - the string that represents null values.

getDateFormat

public java.text.SimpleDateFormat getDateFormat()
Returns the date formatter.

Returns:
The date formatter.

setDateFormat

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

Parameters:
dateFormat - the date formatter.

connectDataRow

public void connectDataRow(DataRow row)
                    throws java.lang.IllegalStateException
Connects a DataRow to the data source.

Specified by:
connectDataRow in interface DataRowConnectable
Parameters:
row - the data row.
Throws:
java.lang.IllegalStateException - if there is already a data row connected.

disconnectDataRow

public void disconnectDataRow(DataRow row)
                       throws java.lang.IllegalStateException
Releases the connection to the data row.

If no data row is connected, an IllegalStateException is thrown to indicate the programming error.

Specified by:
disconnectDataRow in interface DataRowConnectable
Parameters:
row - the data row.
Throws:
java.lang.IllegalStateException - if there is already a data row connected.

getValue

public java.lang.Object getValue()
Returns the current value for the data source.

Specified by:
getValue in interface DataSource
Returns:
the value.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones this template.

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

getDateFilter

protected SimpleDateFormatFilter getDateFilter()
Returns the date filter.

Returns:
The date filter.

getDataRowDataSource

protected DataRowDataSource getDataRowDataSource()
Returns the data-row datasource.

Returns:
The data-row datasource.

getStringFilter

protected StringFilter getStringFilter()
Returns the string filter.

Returns:
The string filter.