org.pentaho.reporting.engine.classic.core.filter.templates
Class MessageFieldTemplate

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
      extended by org.pentaho.reporting.engine.classic.core.filter.templates.MessageFieldTemplate
All Implemented Interfaces:
Serializable, Cloneable, DataSource, Template

public class MessageFieldTemplate
extends AbstractTemplate

The message field template simplifies the on-the-fly creation of strings.

Author:
Thomas Morgner
See Also:
MessageFormatSupport, Serialized Form

Constructor Summary
MessageFieldTemplate()
          Creates a new string field template.
 
Method Summary
 Object clone()
          Clones the template.
 String getFormat()
          Returns the format string used in the message format filter.
 String getNullValue()
          Returns the value displayed by the field when the data source value is null.
 Object getValue(ExpressionRuntime runtime, Element element)
          Returns the current value for the data source.
 void setFormat(String format)
          Redefines the format string for the message format.
 void setNullValue(String nullValue)
          Sets the value displayed by the field when the data source value is null.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.filter.templates.AbstractTemplate
getInstance, getName, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFieldTemplate

public MessageFieldTemplate()
Creates a new string field template.

Method Detail

getFormat

public String getFormat()
Returns the format string used in the message format filter. This is a raw value which contains untranslated references to column names. It cannot be used directly in java.text.MessageFormat objects.

Returns:
the format string.

setFormat

public void setFormat(String format)
Redefines the format string for the message format. The assigned message format string must be given as raw value, where column references are given in the format $(COLNAME).

Parameters:
format - the new format string.

getNullValue

public String getNullValue()
Returns the value displayed by the field when the data source value is null.

Returns:
A value to represent null.

setNullValue

public void setNullValue(String nullValue)
Sets the value displayed by the field when the data source value is null.

Parameters:
nullValue - the value that represents null.

getValue

public Object getValue(ExpressionRuntime runtime,
                       Element element)
Returns the current value for the data source.

Parameters:
runtime - the expression runtime that is used to evaluate formulas and expressions when computing the value of this filter.
element -
Returns:
the value.

clone

public Object clone()
             throws CloneNotSupportedException
Clones the template.

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