org.pentaho.reporting.engine.classic.core.function
Class FunctionUtilities

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.function.FunctionUtilities

public final class FunctionUtilities
extends Object

A collection of utility methods relating to functions.

Author:
Thomas Morgner.

Method Summary
static Element[] findAllElements(Band band, String element)
          Try to find all element with the given name in the last active root-band.
static Element findElement(Band band, String element)
          Try to find the first element with the given name in the last active root-band.
static ReportElement findElementByAttribute(Section band, String attributeNamespace, String attributeName, String attributeValue)
          Try to find the defined element in the last active root-band.
static ReportElement findElementById(ReportDefinition reportDefinition, String id)
           
static ReportElement findElementById(Section band, String id)
          Try to find the defined element in the last active root-band.
static ReportElement findElementByInstanceId(ReportDefinition reportDefinition, InstanceID id)
           
static ReportElement findElementByInstanceId(Section band, InstanceID id)
          Try to find the defined element in the last active root-band.
static Group getCurrentDeepTraverseGroup(ReportEvent event)
          Returns the current group instance, based on the given report event.
static Group getCurrentGroup(ReportEvent event)
          Returns the current group instance, based on the given report event.
static boolean isDefinedGroup(String groupName, ReportEvent event)
          Returns true if the events current groupname is equal to the group name.
static boolean isDefinedPrepareRunLevel(Function f, ReportEvent event)
          Returns true, if the current run level is defined for the given function and this is a prepare run.
static boolean isLayoutLevel(ReportEvent event)
          Returns true or false.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findElement

public static Element findElement(Band band,
                                  String element)
Try to find the first element with the given name in the last active root-band.

Parameters:
band - the band that is suspected to contain the element.
element - the element name.
Returns:
the found element or null, if no element could be found.

findElementById

public static ReportElement findElementById(ReportDefinition reportDefinition,
                                            String id)

findElementByInstanceId

public static ReportElement findElementByInstanceId(ReportDefinition reportDefinition,
                                                    InstanceID id)

findElementById

public static ReportElement findElementById(Section band,
                                            String id)
Try to find the defined element in the last active root-band.

Parameters:
band - the band that is suspected to contain the element.
id - the element's unique id.
Returns:
the found element or null, if no element could be found.

findElementByInstanceId

public static ReportElement findElementByInstanceId(Section band,
                                                    InstanceID id)
Try to find the defined element in the last active root-band.

Parameters:
band - the band that is suspected to contain the element.
id - the element's unique id.
Returns:
the found element or null, if no element could be found.

findElementByAttribute

public static ReportElement findElementByAttribute(Section band,
                                                   String attributeNamespace,
                                                   String attributeName,
                                                   String attributeValue)
Try to find the defined element in the last active root-band.

Parameters:
band - the band that is suspected to contain the element.
attributeNamespace -
attributeValue -
attributeName -
Returns:
the found element or null, if no element could be found.

findAllElements

public static Element[] findAllElements(Band band,
                                        String element)
Try to find all element with the given name in the last active root-band.

Parameters:
band - the band that is suspected to contain the element.
element - the element name.
Returns:
the found element or null, if no element could be found.

isDefinedGroup

public static boolean isDefinedGroup(String groupName,
                                     ReportEvent event)
Returns true if the events current groupname is equal to the group name.

Parameters:
groupName - the group name.
event - the report event.
Returns:
A boolean.

isDefinedPrepareRunLevel

public static boolean isDefinedPrepareRunLevel(Function f,
                                               ReportEvent event)
Returns true, if the current run level is defined for the given function and this is a prepare run. The prepare run is used to compute the function values.

Parameters:
f - the function.
event - the event.
Returns:
A boolean.

isLayoutLevel

public static boolean isLayoutLevel(ReportEvent event)
Returns true or false.

Parameters:
event - the report event.
Returns:
A boolean.

getCurrentGroup

public static Group getCurrentGroup(ReportEvent event)
Returns the current group instance, based on the given report event.

Parameters:
event - the event which is base for the action.
Returns:
the current group of the event, never null.

getCurrentDeepTraverseGroup

public static Group getCurrentDeepTraverseGroup(ReportEvent event)
Returns the current group instance, based on the given report event.

Parameters:
event - the event which is base for the action.
Returns:
the current group of the event, or null if the event is a deep traversing event.