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

All Implemented Interfaces:
    Serializable, Function, Expression

This is a function used in report4-demo. The function demonstrates how to alter an elements property during the report generation. The elements font is changed base on the data provided in the reports datasource.

For every new item row in the report, the font for that row is changed to the fontname specified in the second column of the report data source.

Parameters:
The function expects the name of a field in the item band in the parameter "element". This functions value will always be null.

Constructor:
 public FontChangeFunction() 
Method from org.jfree.report.demo.helper.FontChangeFunction Summary:
getElement,   getValue,   initialize,   itemsAdvanced,   setElement
Methods from org.jfree.report.function.AbstractFunction:
groupFinished,   groupStarted,   itemsAdvanced,   itemsFinished,   itemsStarted,   reportDone,   reportFinished,   reportInitialized,   reportStarted
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.demo.helper.FontChangeFunction Detail:
 public String getElement() 
    Returns the name of the element that should get the font set. Returns an empty string, if the property is not set.
 public Object getValue() 
    Returns the value calculated by this function. As this function does not calculate values, this method does always return null.
 public  void initialize() throws FunctionInitializeException 
    Performs the functions initialisation. The initialisation will fail, if the function has no valid name or the required parameter "element" is missing.

 public  void itemsAdvanced(ReportEvent event) 
    Before an ItemBand is printed, the report generator will call itemsAdvanced for all functions in the function collection. This is the right place to alter the font of the element defined in the "element" property, so that every ItemBand has the font set, that is defined in the data model.
 public  void setElement(String name) 
    Defines the name of the text element that gets its font altered. If the element does not exist or is no text element, the function will do nothing.

    This functions property is reachable by using the key "element" on getProperty.