org.norther.tammi.sprig.jasper.model
Class ReportEvaluator

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JREvaluator
      extended by org.norther.tammi.sprig.jasper.model.ReportEvaluator

public abstract class ReportEvaluator
extends net.sf.jasperreports.engine.fill.JREvaluator

An extended report calculator with variable support.

Version:
$Id: ReportEvaluator.java,v 1.11 2009/09/28 15:08:51 cvsimp Exp $
Author:
Ilkka Priha

Constructor Summary
ReportEvaluator()
          Construcs a new evalautor.
 
Method Summary
 String concat(Object first, Object second)
          Concatenates objects.
 Number fixed(Object value)
          Returns the object as a fixed number.
 String format(Date value)
          Formats a date.
 String format(Date value, String pattern)
          Formats a date with a pattern.
 String format(Number value)
          Formats a number.
 String format(Number value, String pattern)
          Formats a number with a pattern.
 String format(String value)
          Formats a string.
 String format(String qualifier, String value)
          Formats a qualified string.
 String getDescription(Variable var, String name)
          Gets the named attribute description.
 String getDetail(Variable var, String name)
          Gets the named attribute detail.
 String getGroup(Variable var, String name)
          Gets the named attribute group.
protected  ReportModel getReportModel()
          Gets the report model.
 Object getValue(Variable var, String name)
          Gets the named attribute value.
 void init(Map params, Map fields, Map vars, net.sf.jasperreports.engine.fill.JRFillParameter bundle, byte rmtype)
           
 Double percent(Object value, Object total)
          Calculates the specified percentage.
 String toString(Variable var, String name)
          Returns the named attribute value as a string.
 String[] toStrings(Variable var, String name)
          Returns the named attribute values as a string array.
 
Methods inherited from class net.sf.jasperreports.engine.fill.JREvaluator
customizedInit, evaluate, evaluate, evaluateEstimated, evaluateEstimated, evaluateOld, evaluateOld, handleMissingResource, msg, msg, msg, str
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportEvaluator

public ReportEvaluator()
Construcs a new evalautor.

Method Detail

init

public void init(Map params,
                 Map fields,
                 Map vars,
                 net.sf.jasperreports.engine.fill.JRFillParameter bundle,
                 byte rmtype)
          throws net.sf.jasperreports.engine.JRException
Overrides:
init in class net.sf.jasperreports.engine.fill.JREvaluator
Throws:
net.sf.jasperreports.engine.JRException

concat

public String concat(Object first,
                     Object second)
Concatenates objects.

Parameters:
first - the first string.
second - the second string.
Returns:
the concatenated string.

fixed

public Number fixed(Object value)
Returns the object as a fixed number.

Parameters:
value - the object.
Returns:
the fixed number.

percent

public Double percent(Object value,
                      Object total)
Calculates the specified percentage.

Parameters:
value - the value.
total - the total.
Returns:
the persentage.

getValue

public Object getValue(Variable var,
                       String name)
                throws Exception
Gets the named attribute value.

Parameters:
var - the variable.
name - the attribute.
Returns:
the value or null.
Throws:
Exception - on errors.

toString

public String toString(Variable var,
                       String name)
                throws Exception
Returns the named attribute value as a string.

Parameters:
var - the variable.
name - the attribute.
Returns:
the string or null.
Throws:
Exception - on errors.

toStrings

public String[] toStrings(Variable var,
                          String name)
                   throws Exception
Returns the named attribute values as a string array.

Parameters:
var - the variable.
name - the attribute.
Returns:
the strings or null.
Throws:
Exception - on errors.

getDescription

public String getDescription(Variable var,
                             String name)
Gets the named attribute description.

Parameters:
var - the variable.
name - the attribute.
Returns:
the attribute description.

getGroup

public String getGroup(Variable var,
                       String name)
Gets the named attribute group.

Parameters:
var - the variable.
name - the attribute.
Returns:
the attribute group or an empty string.

getDetail

public String getDetail(Variable var,
                        String name)
Gets the named attribute detail.

Parameters:
var - the variable.
name - the attribute.
Returns:
the attribute detail or an empty string.

format

public String format(String value)
Formats a string.

Parameters:
value - the string.
Returns:
the formatted string.

format

public String format(String qualifier,
                     String value)
Formats a qualified string.

Parameters:
qualifier - the qualifier.
value - the string.
Returns:
the formatted string.

format

public String format(Number value)
Formats a number.

Parameters:
value - the number.
Returns:
the formatted number.

format

public String format(Number value,
                     String pattern)
Formats a number with a pattern.

Parameters:
value - the number.
pattern - the pattern.
Returns:
the formatted number.

format

public String format(Date value)
Formats a date.

Parameters:
value - the date.
Returns:
the formatted date.

format

public String format(Date value,
                     String pattern)
Formats a date with a pattern.

Parameters:
value - the date.
pattern - the pattern.
Returns:
the formatted date.

getReportModel

protected ReportModel getReportModel()
Gets the report model.

Returns:
the report model.
Throws:
IllegalStateException - is not available.


Copyright © 2004 The Norther Organization. All rights reserved.