Class ReportProgressEvent

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class ReportProgressEvent
    extends EventObject
    implements Cloneable
    A report progress event notifies the listeners about the proceedings of the report processing. It is generated by the report processor implementations.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int COMPUTING_LAYOUT
      An activity constant that indicates that the current report is currently being processed.
      static int GENERATING_CONTENT
      An activity constant that indicates that the report content is generated.
      static int PAGINATING
      An activity constant that indicates that the report's page-layout is being computed.
      static int PRECOMPUTING_VALUES
      An activity constant that indicates that the report is precomputing values.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReportProgressEvent​(Object source)
      Creates a new even without any properties defined.
      ReportProgressEvent​(Object source, int page)
      Deprecated.
      Use constructor with total pages instead
      ReportProgressEvent​(Object source, int page, int totalPages)
      Creates a new even without any properties defined.
      ReportProgressEvent​(Object source, int activity, int row, int maximumRow, int page, int level, int maximumLevel)
      Deprecated.
      Use constructor with total pages instead
      ReportProgressEvent​(Object source, int activity, int row, int maximumRow, int page, int totalPages, int level, int maximumLevel)
      Creates a new report-progress event.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object clone()
      Creats a copy of the current instance of this object.
      static double computePercentageComplete​(ReportProgressEvent event, boolean onlyPagination)
      Computes the percentage complete (on a scale from 0.0 to 100.0) based on the information found in the report progress event.
      int getActivity()
      Returns the current activity (one of COMPUTING_LAYOUT, PRECOMPUTING_VALUES, PAGINATING or GENERATING_CONTENT).
      int getLevel()
      Returns the current processing level.
      int getMaximumLevel()
      Returns the maximum level the report processing can reach for the report that generated the event.
      int getMaximumRow()
      Returns the total number of rows contained in this report's datasource.
      int getPage()
      Returns the current page number.
      int getRow()
      Returns the current row.
      int getTotalPages()
      Returns total number pages in the report
      void reuse​(int activity, int row, int maximumRow, int page, int level, int maximumLevel)
      Reuses the report event by updating the internal properties.
      void reuse​(int activity, int row, int maximumRow, int page, int totalPages, int level, int maximumLevel)
      Reuses the report event by updating the internal properties.
      void reuse​(int activity, ReportState rawState, int pageCount)  
      void reuse​(int activity, ReportState rawState, int pageCount, int totalPages)  
      String toString()
      Returns a string representation of this object.
    • Field Detail

      • COMPUTING_LAYOUT

        public static final int COMPUTING_LAYOUT
        An activity constant that indicates that the current report is currently being processed. (This is a boilerplate event in case none of the other events matched.)
        See Also:
        Constant Field Values
      • PRECOMPUTING_VALUES

        public static final int PRECOMPUTING_VALUES
        An activity constant that indicates that the report is precomputing values. This is usually the first stage of report processing.
        See Also:
        Constant Field Values
      • PAGINATING

        public static final int PAGINATING
        An activity constant that indicates that the report's page-layout is being computed. This computes where pagebreaks will be inserted and how many pages are available.
        See Also:
        Constant Field Values
      • GENERATING_CONTENT

        public static final int GENERATING_CONTENT
        An activity constant that indicates that the report content is generated. This is the final processing step.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ReportProgressEvent

        public ReportProgressEvent​(Object source)
        Creates a new even without any properties defined. Use this to create a reusable event object.
        Parameters:
        source - the report processor that generated this event.
      • ReportProgressEvent

        @Deprecated
        public ReportProgressEvent​(Object source,
                                   int page)
        Deprecated.
        Use constructor with total pages instead
        Creates a new even without any properties defined. Use this to create a reusable event object.
        Parameters:
        source - the report processor that generated this event.
      • ReportProgressEvent

        public ReportProgressEvent​(Object source,
                                   int page,
                                   int totalPages)
        Creates a new even without any properties defined. Use this to create a reusable event object.
        Parameters:
        source - the report processor that generated this event.
        totalPages - total pages in the report
      • ReportProgressEvent

        @Deprecated
        public ReportProgressEvent​(Object source,
                                   int activity,
                                   int row,
                                   int maximumRow,
                                   int page,
                                   int level,
                                   int maximumLevel)
        Deprecated.
        Use constructor with total pages instead
        Creates a new report-progress event.
        Parameters:
        source - the report processor that generated this event.
        activity - the current activity.
        row - the currently processed row.
        maximumRow - the number of rows in this local report.
        page - the current page that is being processed.
        level - the current processing level.
        maximumLevel - the maximum processing level.
      • ReportProgressEvent

        public ReportProgressEvent​(Object source,
                                   int activity,
                                   int row,
                                   int maximumRow,
                                   int page,
                                   int totalPages,
                                   int level,
                                   int maximumLevel)
        Creates a new report-progress event.
        Parameters:
        source - the report processor that generated this event.
        activity - the current activity.
        row - the currently processed row.
        maximumRow - the number of rows in this local report.
        page - the current page that is being processed.
        totalPages - total pages in the report
        level - the current processing level.
        maximumLevel - the maximum processing level.
    • Method Detail

      • toString

        public String toString()
        Returns a string representation of this object.
        Overrides:
        toString in class EventObject
        Returns:
        a string representing the state of this object.
      • getRow

        public int getRow()
        Returns the current row.
        Returns:
        the row.
      • getPage

        public int getPage()
        Returns the current page number.
        Returns:
        the current page.
      • getTotalPages

        public int getTotalPages()
        Returns total number pages in the report
        Returns:
        total number pages in the report
      • getMaximumRow

        public int getMaximumRow()
        Returns the total number of rows contained in this report's datasource.
        Returns:
        the number of rows.
      • getMaximumLevel

        public int getMaximumLevel()
        Returns the maximum level the report processing can reach for the report that generated the event.
        Returns:
        the maximum level.
      • getLevel

        public int getLevel()
        Returns the current processing level. Report processing is a multi-pass process, the level provides a linear measurement of the current progress.
        Returns:
        the level.
      • reuse

        public void reuse​(int activity,
                          ReportState rawState,
                          int pageCount)
      • reuse

        public void reuse​(int activity,
                          ReportState rawState,
                          int pageCount,
                          int totalPages)
      • reuse

        public void reuse​(int activity,
                          int row,
                          int maximumRow,
                          int page,
                          int level,
                          int maximumLevel)
        Reuses the report event by updating the internal properties. This is used as simple mean to reduce the number of objects generated in the system and should not be used elsewhere.
        Parameters:
        activity - the activity as constant.
        row - the current row.
        maximumRow - the total rows in the datasource.
        page - the current page.
        level - the current processing level.
        maximumLevel - the maximum processing level.
      • reuse

        public void reuse​(int activity,
                          int row,
                          int maximumRow,
                          int page,
                          int totalPages,
                          int level,
                          int maximumLevel)
        Reuses the report event by updating the internal properties. This is used as simple mean to reduce the number of objects generated in the system and should not be used elsewhere.
        Parameters:
        activity - the activity as constant.
        row - the current row.
        maximumRow - the total rows in the datasource.
        page - the current page.
        totalPages - total pages in the report
        level - the current processing level.
        maximumLevel - the maximum processing level.
      • clone

        public Object clone()
        Creats a copy of the current instance of this object.
        Overrides:
        clone in class Object
        Returns:
        a copy of the current object as a new object.
      • computePercentageComplete

        public static double computePercentageComplete​(ReportProgressEvent event,
                                                       boolean onlyPagination)
        Computes the percentage complete (on a scale from 0.0 to 100.0) based on the information found in the report progress event.
        Parameters:
        event - the data used to calculate the percentage complete
        onlyPagination - true, if the processing stops after pagination, or false, if a full export is done.
        Returns:
        the calculated percentage complete