org.jfree.report.function
Class TextFormatExpression
java.lang.Object
|
+--org.jfree.report.function.AbstractExpression
|
+--org.jfree.report.function.TextFormatExpression
- public class TextFormatExpression
- extends AbstractExpression
- implements java.io.Serializable
A TextFormatExpression uses a java.text.MessageFormat to concat and format
one or more values evaluated from an expression, function or report
datasource.
The TextFormatExpression uses the pattern property to define the global
format-pattern used when evaluating the expression. The dataRow fields used
to fill the expressions placeholders are defined in a list of properties
where the property-names are numbers. The property counting starts at "0".
The Syntax of the pattern property is explained in
java.text.MessageFormat.
Example:
Invoice for your order from {0, date, EEE, MMM d,
yyyy}
printdate
- Author:
- Thomas Morgner
- See Also:
- Serialized Form
|
Constructor Summary |
TextFormatExpression()
Default constructor, creates a new unnamed TextFormatExpression. |
| Methods inherited from class org.jfree.report.function.AbstractExpression |
getDataRow,
getDependencyLevel,
getInstance,
getName,
getReportConfiguration,
getResourceBundleFactory,
getRuntime,
isActive,
setActive,
setDependencyLevel,
setName,
setRuntime |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
TextFormatExpression
public TextFormatExpression()
- Default constructor, creates a new unnamed TextFormatExpression.
getEncoding
public java.lang.String getEncoding()
setEncoding
public void setEncoding(java.lang.String encoding)
setUrlEncodeValues
public void setUrlEncodeValues(boolean urlEncode)
isUrlEncodeValues
public boolean isUrlEncodeValues()
isUrlEncodeResult
public boolean isUrlEncodeResult()
setUrlEncodeResult
public void setUrlEncodeResult(boolean urlEncodeResult)
getValue
public java.lang.Object getValue()
- Evaluates the expression by collecting all values defined in the fieldlist
from the datarow. The collected values are then parsed and formated by the
MessageFormat-object.
- Returns:
- a string containing the pattern inclusive the formatted values from
the datarow
getFieldValues
protected java.lang.Object[] getFieldValues()
throws java.io.UnsupportedEncodingException
- collects the values of all fields defined in the fieldList.
- Returns:
- an Objectarray containing all defined values from the datarow
getPattern
public java.lang.String getPattern()
- Returns the pattern defined for this expression.
- Returns:
- the pattern.
setPattern
public void setPattern(java.lang.String pattern)
- Defines the pattern for this expression. The pattern syntax is defined by
the java.text.MessageFormat object and the given pattern string has to be
valid according to the rules defined there.
- Parameters:
pattern - the pattern string
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Clones the expression.
- Overrides:
- clone in class AbstractExpression
- Returns:
- a copy of this expression.
- Throws:
- java.lang.CloneNotSupportedException - this should never happen.
setField
public void setField(int index,
java.lang.String field)
getField
public java.lang.String getField(int index)
getFieldCount
public int getFieldCount()
getField
public java.lang.String[] getField()
setField
public void setField(java.lang.String[] fields)