com.jrefinery.report.filter.templates
Class NumberFieldTemplate

java.lang.Object
  extended bycom.jrefinery.report.filter.templates.AbstractTemplate
      extended bycom.jrefinery.report.filter.templates.NumberFieldTemplate
All Implemented Interfaces:
java.lang.Cloneable, DataRowConnectable, DataSource, java.io.Serializable, Template

public class NumberFieldTemplate
extends AbstractTemplate
implements DataRowConnectable

A number field template.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
NumberFieldTemplate()
          Creates a new number field template.
 
Method Summary
 java.lang.Object clone()
          Clones the template.
 void connectDataRow(DataRow row)
          Connects a DataRow to the data source.
 void disconnectDataRow(DataRow row)
          Releases the connection to the data row.
 java.text.DecimalFormat getDecimalFormat()
          Returns the number formatter.
 java.lang.String getField()
          Returns the field name.
 java.lang.String getFormat()
          Returns the format string.
 java.lang.String getNullValue()
          Returns the string that represents a null value.
 java.lang.Object getValue()
          Returns the current value for the data source.
 void setDecimalFormat(java.text.DecimalFormat decimalFormat)
          Sets the number formatter.
 void setField(java.lang.String field)
          Sets the field name.
 void setFormat(java.lang.String format)
          Sets the format string.
 void setNullValue(java.lang.String nullValue)
          Sets the string that represents a null value.
 
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

NumberFieldTemplate

public NumberFieldTemplate()
Creates a new number field template.

Method Detail

getDecimalFormat

public java.text.DecimalFormat getDecimalFormat()
Returns the number formatter.

Returns:
The number formatter.

setDecimalFormat

public void setDecimalFormat(java.text.DecimalFormat decimalFormat)
Sets the number formatter.

Parameters:
decimalFormat - the number formatter.

getFormat

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

Returns:
The format string.

setFormat

public void setFormat(java.lang.String format)
Sets the 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 a null value.

Returns:
A string.

setNullValue

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

Parameters:
nullValue - the string that represents a null value.

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 the template.

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

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.