Class TocDataGeneratorFunction

  • All Implemented Interfaces:
    Serializable, Cloneable, EventListener, org.pentaho.reporting.engine.classic.core.event.PageEventListener, org.pentaho.reporting.engine.classic.core.event.ReportListener, org.pentaho.reporting.engine.classic.core.function.Expression, org.pentaho.reporting.engine.classic.core.function.Function

    public class TocDataGeneratorFunction
    extends org.pentaho.reporting.engine.classic.core.function.AbstractFunction
    implements org.pentaho.reporting.engine.classic.core.event.PageEventListener
    A data-collector that collects table-of-contents items at group-starts. The function collects these items accross subreport boundaries.
    Author:
    Thomas Morgner.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object clone()
      Clones the expression.
      int getDependencyLevel()
      Returns the dependency level for the expression (controls evaluation order for expressions and functions).
      String[] getGroup()
      Returns all defined groups as array of strings.
      String getGroup​(int index)
      Returns the defined field at the given index-position.
      int getGroupCount()
      Returns the number of groups defined in this expression.
      String getIndexSeparator()  
      org.pentaho.reporting.engine.classic.core.function.Expression getInstance()
      Return a completly separated copy of this function.
      org.pentaho.reporting.engine.classic.core.util.TypedTableModel getModel()  
      String getTitleField()  
      String getTitleFormula()  
      Object getValue()
      Return the current expression value.
      void groupFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a group has finished.
      void groupStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)  
      boolean isCollectDetails()  
      boolean isDeepTraversing()
      Checks whether this expression is a deep-traversing expression.
      void itemsAdvanced​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a row of data is being processed.
      void itemsFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a group of item bands has been completed.
      void itemsStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a group of item bands is about to be processed.
      void pageFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a page is completed.
      void pageStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that a new page is being started.
      void reportInitialized​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that report generation initializes the current run.
      void reportStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
      Receives notification that the report has started.
      void setCollectDetails​(boolean collectDetails)  
      void setDependencyLevel​(int dependencyLevel)  
      void setGroup​(int index, String field)
      Defines the field in the field-list at the given index.
      void setGroup​(String[] fields)
      Defines all groups as array.
      void setIndexSeparator​(String indexSeparator)  
      void setTitleField​(String titleField)  
      void setTitleFormula​(String titleFormula)  
      • Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction

        reportDone, reportFinished, summaryRowSelection
      • Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression

        getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setActive, setName, setPreserve, setRuntime
      • Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression

        getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setName, setRuntime
    • Constructor Detail

      • TocDataGeneratorFunction

        public TocDataGeneratorFunction()
        Creates an unnamed function. Make sure the name of the function is set using AbstractExpression.setName(java.lang.String) before the function is added to the report's function collection.
    • Method Detail

      • setDependencyLevel

        public void setDependencyLevel​(int dependencyLevel)
        Specified by:
        setDependencyLevel in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Overrides:
        setDependencyLevel in class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
      • getDependencyLevel

        public int getDependencyLevel()
        Returns the dependency level for the expression (controls evaluation order for expressions and functions).
        Specified by:
        getDependencyLevel in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Overrides:
        getDependencyLevel in class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
        Returns:
        the level.
      • getIndexSeparator

        public String getIndexSeparator()
      • setIndexSeparator

        public void setIndexSeparator​(String indexSeparator)
      • getTitleFormula

        public String getTitleFormula()
      • setTitleFormula

        public void setTitleFormula​(String titleFormula)
      • getTitleField

        public String getTitleField()
      • setTitleField

        public void setTitleField​(String titleField)
      • isCollectDetails

        public boolean isCollectDetails()
      • setCollectDetails

        public void setCollectDetails​(boolean collectDetails)
      • setGroup

        public void setGroup​(int index,
                             String field)
        Defines the field in the field-list at the given index.
        Parameters:
        index - the position in the list, where the field should be defined.
        field - the name of the field.
      • getGroup

        public String getGroup​(int index)
        Returns the defined field at the given index-position.
        Parameters:
        index - the position of the field name that should be queried.
        Returns:
        the field name at the given position.
      • getGroupCount

        public int getGroupCount()
        Returns the number of groups defined in this expression.
        Returns:
        the number of groups.
      • getGroup

        public String[] getGroup()
        Returns all defined groups as array of strings.
        Returns:
        all the groups.
      • setGroup

        public void setGroup​(String[] fields)
        Defines all groups as array. This completely replaces any previously defined groups.
        Parameters:
        fields - the new list of groups.
      • reportInitialized

        public void reportInitialized​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that report generation initializes the current run.

        The event carries a ReportState.Started state. Use this to initialize the report.

        Specified by:
        reportInitialized in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        reportInitialized in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - The event.
      • reportStarted

        public void reportStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that the report has started.
        Specified by:
        reportStarted in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        reportStarted in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - the event.
      • groupStarted

        public void groupStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Specified by:
        groupStarted in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        groupStarted in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
      • itemsStarted

        public void itemsStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a group of item bands is about to be processed.

        The next events will be itemsAdvanced events until the itemsFinished event is raised.

        Specified by:
        itemsStarted in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        itemsStarted in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - The event.
      • itemsAdvanced

        public void itemsAdvanced​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a row of data is being processed.
        Specified by:
        itemsAdvanced in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        itemsAdvanced in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - the event.
      • itemsFinished

        public void itemsFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a group of item bands has been completed.

        The itemBand is finished, the report starts to close open groups.

        Specified by:
        itemsFinished in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        itemsFinished in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - The event.
      • groupFinished

        public void groupFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a group has finished.
        Specified by:
        groupFinished in interface org.pentaho.reporting.engine.classic.core.event.ReportListener
        Overrides:
        groupFinished in class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
        Parameters:
        event - the event.
      • pageStarted

        public void pageStarted​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a new page is being started.
        Specified by:
        pageStarted in interface org.pentaho.reporting.engine.classic.core.event.PageEventListener
        Parameters:
        event - The event.
      • pageFinished

        public void pageFinished​(org.pentaho.reporting.engine.classic.core.event.ReportEvent event)
        Receives notification that a page is completed.
        Specified by:
        pageFinished in interface org.pentaho.reporting.engine.classic.core.event.PageEventListener
        Parameters:
        event - The event.
      • getValue

        public Object getValue()
        Return the current expression value.

        The value depends (obviously) on the expression implementation.

        Specified by:
        getValue in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Returns:
        the value of the function.
      • getModel

        public org.pentaho.reporting.engine.classic.core.util.TypedTableModel getModel()
      • isDeepTraversing

        public boolean isDeepTraversing()
        Checks whether this expression is a deep-traversing expression. Deep-traversing expressions receive events from all sub-reports. This returns false by default, as ordinary expressions have no need to be deep-traversing.
        Specified by:
        isDeepTraversing in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Overrides:
        isDeepTraversing in class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
        Returns:
        false.
      • clone

        public Object clone()
                     throws CloneNotSupportedException
        Clones the expression. The expression should be reinitialized after the cloning.

        Expressions maintain no state, cloning is done at the beginning of the report processing to disconnect the expression from any other object space.

        Specified by:
        clone in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Overrides:
        clone in class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
        Returns:
        a clone of this expression.
        Throws:
        CloneNotSupportedException - this should never happen.
      • getInstance

        public org.pentaho.reporting.engine.classic.core.function.Expression getInstance()
        Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.
        Specified by:
        getInstance in interface org.pentaho.reporting.engine.classic.core.function.Expression
        Overrides:
        getInstance in class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
        Returns:
        a copy of this function.