Save This Page
Home » pentaho-reporting-engine-classic-0.8.10 » org » jfree » report » function » [javadoc | source]
org.jfree.report.function
public class: TextFormatExpression [javadoc | source]
java.lang.Object
   org.jfree.report.function.AbstractExpression
      org.jfree.report.function.TextFormatExpression

All Implemented Interfaces:
    Expression, 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 the class java.text.MessageFormat .

Example:



Invoice for your order from {0, date, EEE, MMM d,
yyyy}
printdate


The org.jfree.report.function.strings.MessageFormatExpression allows to specify named field-references in the pattern, which greatly simplifies the pattern-definition.

Constructor:
 public TextFormatExpression() 
Method from org.jfree.report.function.TextFormatExpression Summary:
getEncoding,   getField,   getField,   getFieldCount,   getFieldValues,   getInstance,   getPattern,   getValue,   isUrlEncodeResult,   isUrlEncodeValues,   setEncoding,   setField,   setField,   setPattern,   setUrlEncodeResult,   setUrlEncodeValues
Methods from org.jfree.report.function.AbstractExpression:
clone,   getDataRow,   getDependencyLevel,   getInstance,   getName,   getReportConfiguration,   getResourceBundleFactory,   getRuntime,   isActive,   isDeepTraversing,   isPreserve,   setActive,   setDependencyLevel,   setName,   setPreserve,   setRuntime
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.report.function.TextFormatExpression Detail:
 public String getEncoding() 
    Returns the defined character encoding that is used to transform the Java-Unicode strings into bytes.
 public String[] getField() 
    Returns all defined fields as array of strings.
 public String getField(int index) 
    Returns the defined field at the given index-position.
 public int getFieldCount() 
    Returns the number of fields defined in this expression.
 protected Object[] getFieldValues(Object[] retval) throws UnsupportedEncodingException 
    Collects the values of all fields defined in the fieldList.
 public Expression getInstance() 
    Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.
 public String getPattern() 
    Returns the pattern defined for this expression.
 public 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.
 public boolean isUrlEncodeResult() 
    Queries, whether the formatted result-string will be URL encoded.
 public boolean isUrlEncodeValues() 
    Queries, whether the values read from the data-row should be URL encoded.
 public  void setEncoding(String encoding) 
    Defines the character encoding that is used to transform the Java-Unicode strings into bytes.
 public  void setField(String[] fields) 
    Defines all fields as array. This completely replaces any previously defined fields.
 public  void setField(int index,
    String field) 
    Defines the field in the field-list at the given index.
 public  void setPattern(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.
 public  void setUrlEncodeResult(boolean urlEncodeResult) 
    Defines, whether the formatted result-string will be URL encoded.
 public  void setUrlEncodeValues(boolean urlEncode) 
    Defines, whether the values read from the data-row should be URL encoded. Dates and Number objects are never encoded.