com.jrefinery.report.filter
Class DecimalFormatFilter

java.lang.Object
  |
  +--com.jrefinery.report.filter.FormatFilter
        |
        +--com.jrefinery.report.filter.NumberFormatFilter
              |
              +--com.jrefinery.report.filter.DecimalFormatFilter
All Implemented Interfaces:
java.lang.Cloneable, DataFilter, DataSource, DataTarget, java.io.Serializable

public class DecimalFormatFilter
extends NumberFormatFilter

A filter that formats the numeric value from a data source to a string representation using the decimal number system as base. This filter will format java.lang.Number objects using a java.text.DecimalFormat to create the string representation for the date obtained from the datasource.

If the object read from the datasource is no date, the NullValue defined by setNullValue(Object) is returned.

Author:
Thomas Morgner
See Also:
NumberFormat, Number, Serialized Form

Constructor Summary
DecimalFormatFilter()
          DefaultConstructor, this object is initialized using a DecimalFormat with the default pattern for this locale.
 
Method Summary
 java.text.DecimalFormat getDecimalFormat()
          Returns the format for the filter.
 java.lang.String getFormatString()
          Synthesizes a pattern string that represents the current state of this Format object.
 java.lang.String getLocalizedFormatString()
          Synthesizes a localized pattern string that represents the current state of this Format object.
 void setDecimalFormat(java.text.DecimalFormat format)
          Sets the format for the filter.
 void setFormatString(java.lang.String format)
          Applies a format string to the internal DecimalFormat instance.
 void setFormatter(java.text.Format format)
          Sets the format for the filter.
 void setLocalizedFormatString(java.lang.String format)
          Applies a localised format string to the internal DecimalFormat instance.
 
Methods inherited from class com.jrefinery.report.filter.NumberFormatFilter
getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberFormat, isGroupingUsed, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setNumberFormat
 
Methods inherited from class com.jrefinery.report.filter.FormatFilter
clone, getDataSource, getFormatter, getNullValue, getValue, setDataSource, setNullValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecimalFormatFilter

public DecimalFormatFilter()
DefaultConstructor, this object is initialized using a DecimalFormat with the default pattern for this locale.

Method Detail

getDecimalFormat

public java.text.DecimalFormat getDecimalFormat()
Returns the format for the filter. The DecimalFormatParser has only DecimalFormat objects assigned.

Returns:
the formatter.
Throws:
java.lang.NullPointerException - if the given format is null

setDecimalFormat

public void setDecimalFormat(java.text.DecimalFormat format)
Sets the format for the filter.

Parameters:
format - the format.
Throws:
java.lang.NullPointerException - if the given format is null

setFormatter

public void setFormatter(java.text.Format format)
Sets the format for the filter. If the given format is no Decimal format, a ClassCastException is thrown

Overrides:
setFormatter in class NumberFormatFilter
Parameters:
format - the format.
Throws:
java.lang.NullPointerException - if the given format is null
java.lang.ClassCastException - if the format is no decimal format

getFormatString

public java.lang.String getFormatString()
Synthesizes a pattern string that represents the current state of this Format object.

Returns:
the pattern string of the format object contained in this filter.

setFormatString

public void setFormatString(java.lang.String format)
Applies a format string to the internal DecimalFormat instance.

Parameters:
format - the format string.

getLocalizedFormatString

public java.lang.String getLocalizedFormatString()
Synthesizes a localized pattern string that represents the current state of this Format object.

Returns:
the localized pattern string of the format-object.

setLocalizedFormatString

public void setLocalizedFormatString(java.lang.String format)
Applies a localised format string to the internal DecimalFormat instance.

Parameters:
format - the format string.