Class HtmlReportPage

    • Field Detail

      • pageRefs

        protected java.util.LinkedHashSet<PageRef> pageRefs
    • Constructor Detail

      • HtmlReportPage

        public HtmlReportPage()
      • HtmlReportPage

        public HtmlReportPage​(java.lang.String path)
    • Method Detail

      • getParentPage

        public HtmlReportPage getParentPage()
        Gets a parent page if there is such. The sections' level nesting maybe more than 1. The section generation is done by the parent page.
        Returns:
        null for a common page and a reference for a parent page for a section.
      • getParentMark

        public java.lang.String getParentMark()
        Gets a current section's mark inside a parent page.
      • setParent

        public void setParent​(HtmlReportPage parent,
                              java.lang.String parentMark)
        Sets a parent page. If the parent page is set then this page becomes it's section and stops being generated in filesystem by itself. Requests for generator, path, coding, forming references for this page and maybe something else is redirected for the parent page.
        Parameters:
        parent - Parent page or null, if this page must become independent.
        parentMark - Mark of this page inside parent page.
      • setMasterPage

        public void setMasterPage​(HtmlReportPage master)
        Sets a master page. Existence of the master page may be checked, for example, during a list of report pages generation.
        Parameters:
        master - Master page.
      • getMasterPage

        public HtmlReportPage getMasterPage()
        Gets a master page if there is such.
        Returns:
        Master page. If this page is a section then a parent page is returned.
      • getGenerator

        public ReportGenerator getGenerator()
        Gets generator to which this report page is adjusted. If parent page is defined then it's generator is called.
        Overrides:
        getGenerator in class ReportPage
      • getPath

        public java.lang.String getPath()
        Gets path to page relative to report root. If parent page is defined then it's path is called.
        Overrides:
        getPath in class ReportPage
      • getCharset

        public java.lang.String getCharset()
        Gets a page coding. If the coding is not set then a generator default coding is returned. If parent page is defined then it's coding is called.
        Overrides:
        getCharset in class ReportPage
      • generate

        public void generate()
                      throws java.io.IOException
        Generates complete page text.
        Input-Output channel creation is assigned to a generator.
        Pre: getParentPage() == null
        Specified by:
        generate in class ReportPage
        Throws:
        java.io.IOException - Input-Output error.
      • generatePage

        public void generatePage​(java.io.PrintWriter pw)
        Generates a page full code:
        Head
        Body
        RefSection
        Tail

        If the page is included in another then only the "body" is generated.

      • generatePageHead

        protected void generatePageHead​(java.io.PrintWriter pw)
        Generates page head.
      • generateHeadContents

        protected void generateHeadContents​(java.io.PrintWriter pw)
        Generates content of tag <head>.
      • generatePageTail

        protected void generatePageTail​(java.io.PrintWriter pw)
        Generates page tail.
      • generatePageBody

        public abstract void generatePageBody​(java.io.PrintWriter pw)
        Generates page body.
      • setTitle

        public void setTitle​(java.lang.String title)
        Sets page title.
      • getTitle

        public java.lang.String getTitle()
        Gets a page title. If the page title is not set explicitly then the default realization returns path to this page.
      • setStyle

        public void setStyle​(java.lang.String cssStyle)
        Sets CSS style.
        Parameters:
        cssStyle - Path relative to report root.
      • getStyle

        public java.lang.String getStyle()
        Gets CSS style.
      • addPageRef

        public boolean addPageRef​(HtmlReportPage otherPage,
                                  java.lang.String mark)
        Adds a reference to other page.
        Parameters:
        otherPage - Page.
        mark - Mark.
        Returns:
        true if there has been none such reference.
      • addPageRef

        public boolean addPageRef​(PageRef ref)
        Adds a reference to other page.
        Parameters:
        ref - Reference. Must be from this page.
        Returns:
        true if there has been none such reference.
        Throws:
        java.lang.IllegalArgumentException - Reference is not from this page.
      • getRelativeRef

        public java.lang.String getRelativeRef​(HtmlReportPage from,
                                               java.lang.String mark)
        Gets a relative reference to a page. If this page is included in another then generation is delegated to a parent page.
        Parameters:
        from - Page from where reference is.
        mark - Section's anchor. Null for reference to whole page.
        Returns:
        Reference type path/.../path/file#section
      • generateRef

        public java.lang.String generateRef​(HtmlReportPage from,
                                            java.lang.String mark)
        Generates a reference to the section mark of this page from the page from. If this page is included in another then generation is delegated to parent page.
        Parameters:
        from - Page from where reference is.
        mark - Section's anchor. Null for reference to whole page.
        Returns:
        HTML-code of reference.
      • encodeSimple

        protected static java.lang.String encodeSimple​(java.lang.String str)
        Simple encoder of HTML special-symbols.
      • generateTextRef

        public java.lang.String generateTextRef​(HtmlReportPage from,
                                                java.lang.String mark,
                                                java.lang.String refText)
        Generates a simple text reference for the section mark of this page from the page from. If this page is included in another then generation is delegated to parent page.
        Parameters:
        from - Page from where reference is.
        mark - Section's anchor. Null for reference to whole page.
        refText - Text of reference.
        Returns:
        HTML-code of reference.
      • generateRefSection

        protected void generateRefSection​(java.io.PrintWriter pw)
        Generates reference section.
      • generateRefs

        public void generateRefs​(java.io.PrintWriter pw,
                                 boolean compact)
        Generates block of references from this page without heads.