Class RMTableOfContents

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map

    public class RMTableOfContents
    extends java.util.Hashtable
    This Hashtable subclass provides page number information for table rows in a generated report for the purpose of generating a table of contents. It is initialized from a previously generated report and provides Lists of table row data for keys of the form "Table-ListKey.Table-Grouping-Key" from the original report. Tables based on these ListKeys can then reference any key from the original set of objects (and any key available to the Details table row for that grouping) and also the keys "page" and "row".

    Here's an example of using RMTableOfContents:

     // Generate report normally
     RMDocument template = RMDocument.getDoc("MyTemplate.rpt");
     RMDocument report = template.generateReport(myObjects);
    
     // Get table of contents and generate that report
     RMTableOfContents toc = new RMTableOfContents(report);
     RMDocument tocTemplate = RMDocument.getDoc("MyTemplateTOC.rpt");
     RMDocument report2 = tocTemplate.generateReport(toc);
    
     // Append original report to table of contents and get PDF
     report2.addPages(report);
     report2.writePDF("MyReport.pdf");
     

    In this example, the tocTemplate would be a simple template with a Table who's ListKey is equal to some Table-ListKey.Table-Grouping-Key from the original report (eg., "getMovies.getStudio", for our typical Hollywood example, where the original template has a "getMovies" table, with a grouping on the key "getSudio"). In addition to a large header row (that maybe says, "Hollywood Report - - Table of Contents"), this table would have a details row configured with a column of the form "@row@. @getStudio.getName@ ........ @page@". Additionally, the template might want to set the URL for the Details table row to "Page:@page@" so that the table of contents entries are actually hyperlinks to the appropriate page.

    It may be interesting to note (as an implementation detail only) that the "page" key in an RMTableOfContents entry actually returns the page number relative to the end of the document, in the form of a key itself, for example: "@PageMax-N@" (which gets re-evaluated before PDF generation), so that it can compensate for the length of the Table of Contents table itself. Also, RMTableOfContents uses lower case versions of the common keys @row@ and

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RMTableOfContents.RowGroup
      An inner class to assist flattening.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMTableOfContents​(RMDocument aDoc)
      Creates a new table of contents instance.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkForTableOfContents​(RMDocument aDoc, RMDocument aCopy, int aPageIndex)
      Checks for table of contents page in given template, and copies page as-is if found.
      static RMDocument generateReport​(RMDocument aReport, ReportMill aReportMill)
      Re-run report with table of contents.
      • Methods inherited from class java.util.Hashtable

        clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RMTableOfContents

        public RMTableOfContents​(RMDocument aDoc)
        Creates a new table of contents instance.
    • Method Detail

      • checkForTableOfContents

        public static boolean checkForTableOfContents​(RMDocument aDoc,
                                                      RMDocument aCopy,
                                                      int aPageIndex)
        Checks for table of contents page in given template, and copies page as-is if found.