public class NumberFieldTemplate extends AbstractTemplate implements RawDataSource
Constructor and Description |
---|
NumberFieldTemplate()
Creates a new number field template.
|
Modifier and Type | Method and Description |
---|---|
NumberFieldTemplate |
clone()
Clones the template.
|
DecimalFormat |
getDecimalFormat()
Returns the number formatter.
|
String |
getField()
Returns the field name.
|
String |
getFormat()
Returns the format string.
|
FormatSpecification |
getFormatString(ExpressionRuntime runtime,
ReportElement 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 a
null value. |
Object |
getRawValue(ExpressionRuntime runtime,
ReportElement element)
Returns the unformated raw value.
|
Object |
getValue(ExpressionRuntime runtime,
ReportElement element)
Returns the current value for the data source.
|
void |
setDecimalFormat(DecimalFormat decimalFormat)
Sets the number formatter.
|
void |
setField(String field)
Sets the field name.
|
void |
setFormat(String format)
Sets the 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 a
null value. |
getInstance, getName, setName
public NumberFieldTemplate()
public DecimalFormat getDecimalFormat()
public void setDecimalFormat(DecimalFormat decimalFormat)
decimalFormat
- the number formatter.public String getFormat()
public void setFormat(String format)
format
- the format string.public String getField()
public void setField(String field)
field
- the field name.public String getFormula()
public void setFormula(String formula)
formula
- the formula for the data source.public String getNullValue()
null
value.public void setNullValue(String nullValue)
null
value.nullValue
- the string that represents a null
value.public Object getValue(ExpressionRuntime runtime, ReportElement element)
getValue
in interface DataSource
runtime
- the expression runtime that is used to evaluate formulas and expressions when computing the value of this
filter.element
- public NumberFieldTemplate clone() throws CloneNotSupportedException
clone
in interface DataSource
clone
in class AbstractTemplate
CloneNotSupportedException
- this should never happen.public Object getRawValue(ExpressionRuntime runtime, ReportElement element)
RawDataSource
Number
or Date
objects is a good idea.getRawValue
in interface RawDataSource
runtime
- the expression runtime that is used to evaluate formulas and expressions when computing the value of this
filter.public FormatSpecification getFormatString(ExpressionRuntime runtime, ReportElement element, FormatSpecification formatSpecification)
RawDataSource
.classic.core.filter.FormatSpecification#TYPE_UNDEFINED
in that case.getFormatString
in interface RawDataSource
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.