Class FoAggregateSink

  • All Implemented Interfaces:
    org.apache.maven.doxia.logging.LogEnabled, org.apache.maven.doxia.markup.Markup, org.apache.maven.doxia.markup.XmlMarkup, FoMarkup, org.apache.maven.doxia.sink.Sink

    public class FoAggregateSink
    extends FoSink
    A Doxia Sink that produces an aggregated FO model. The usage is similar to the following:
     FoAggregateSink sink = new FoAggregateSink( writer );
     sink.setDocumentModel( documentModel );
     sink.beginDocument();
     sink.coverPage();
     sink.toc();
     ...
     sink.endDocument();
     
    Note: the documentModel object contains several document metadata, but only a few of them are used in this sink (i.e. author, confidential, date and title), the others are ignored.
    Since:
    1.1
    Author:
    ltheussl
    • Constructor Detail

      • FoAggregateSink

        public FoAggregateSink​(java.io.Writer writer)
        Constructor.
        Parameters:
        writer - The writer for writing the result.
    • Method Detail

      • head

        public void head()
        Specified by:
        head in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        head in class FoSink
      • head

        public void head​(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        head in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        head in class FoSink
      • head_

        public void head_()
        Specified by:
        head_ in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        head_ in class FoSink
      • title

        public void title()
        Specified by:
        title in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        title in class FoSink
      • title

        public void title​(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        title in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        title in class FoSink
      • title_

        public void title_()
        Specified by:
        title_ in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        title_ in class FoSink
      • author

        public void author()
        Specified by:
        author in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        author in class FoSink
      • author

        public void author​(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        author in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        author in class FoSink
      • author_

        public void author_()
        Specified by:
        author_ in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        author_ in class FoSink
      • date

        public void date()
        Specified by:
        date in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        date in class FoSink
      • date

        public void date​(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        date in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        date in class FoSink
      • date_

        public void date_()
        Specified by:
        date_ in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        date_ in class FoSink
      • body

        public void body()
        Specified by:
        body in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        body in class FoSink
      • body

        public void body​(org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        body in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        body in class FoSink
      • body_

        public void body_()
        Specified by:
        body_ in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        body_ in class FoSink
      • setDocumentTitle

        public void setDocumentTitle​(java.lang.String title)
        Sets the title of the current document. This is used as a chapter title in the page header.
        Parameters:
        title - the title of the current document.
      • setDocumentName

        public void setDocumentName​(java.lang.String name)
        Sets the name of the current source document, relative to the source root. Used to resolve links to other source documents.
        Parameters:
        name - the name for the current document.
      • setDocumentModel

        public void setDocumentModel​(org.apache.maven.doxia.document.DocumentModel model)
        Sets the DocumentModel to be used by this sink. The DocumentModel provides all the meta-information required to render a document, eg settings for the cover page, table of contents, etc.
        By default, a TOC will be added at the beginning of the document.
        Parameters:
        model - the DocumentModel.
        See Also:
        setDocumentModel(DocumentModel, int), TOC_START
      • setDocumentModel

        public void setDocumentModel​(org.apache.maven.doxia.document.DocumentModel model,
                                     int tocPos)
        Sets the DocumentModel to be used by this sink. The DocumentModel provides all the meta-information required to render a document, eg settings for the cover page, table of contents, etc.
        Parameters:
        model - the DocumentModel, could be null.
        tocPos - should be one of these values: TOC_NONE, TOC_START and TOC_END.
        Since:
        1.1.2
      • figureGraphics

        public void figureGraphics​(java.lang.String name)
        Specified by:
        figureGraphics in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        figureGraphics in class FoSink
      • figureGraphics

        public void figureGraphics​(java.lang.String src,
                                   org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        figureGraphics in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        figureGraphics in class FoSink
      • anchor

        public void anchor​(java.lang.String name)
        Specified by:
        anchor in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        anchor in class FoSink
      • anchor

        public void anchor​(java.lang.String name,
                           org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        anchor in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        anchor in class FoSink
      • link

        public void link​(java.lang.String name)
        Specified by:
        link in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        link in class FoSink
      • link

        public void link​(java.lang.String name,
                         org.apache.maven.doxia.sink.SinkEventAttributes attributes)
        Specified by:
        link in interface org.apache.maven.doxia.sink.Sink
        Overrides:
        link in class FoSink
      • writeStartTag

        protected void writeStartTag​(javax.swing.text.html.HTML.Tag tag,
                                     java.lang.String attributeId)
        Writes a start tag, prepending EOL.
        Overrides:
        writeStartTag in class FoSink
        Parameters:
        tag - The tag.
        attributeId - An id identifying the attribute set.
      • writeStartTag

        protected void writeStartTag​(javax.swing.text.html.HTML.Tag tag,
                                     java.lang.String id,
                                     java.lang.String name)
        Writes a start tag, prepending EOL.
        Overrides:
        writeStartTag in class FoSink
        Parameters:
        tag - The tag.
        id - An id to add.
        name - The name (value) of the id.
      • writeEndTag

        protected void writeEndTag​(javax.swing.text.html.HTML.Tag t)
        Overrides:
        writeEndTag in class FoSink
        Parameters:
        t - a HTML.Tag object.
      • writeEmptyTag

        protected void writeEmptyTag​(javax.swing.text.html.HTML.Tag tag,
                                     java.lang.String attributeId)
        Writes a simple tag, appending EOL.
        Overrides:
        writeEmptyTag in class FoSink
        Parameters:
        tag - The tag name.
        attributeId - An id identifying the attribute set.
      • write

        protected void write​(java.lang.String text)
        Writes a text, swallowing any exceptions.
        Overrides:
        write in class FoSink
      • writeln

        protected void writeln​(java.lang.String text)
        Writes a text, appending EOL.
        Overrides:
        writeln in class FoSink
        Parameters:
        text - The text to write.
      • content

        protected void content​(java.lang.String text)
        Writes content, escaping special characters.
        Overrides:
        content in class FoSink
        Parameters:
        text - The text to write.
      • newline

        protected void newline()
        Writes EOL.
      • startPageSequence

        protected void startPageSequence​(java.lang.String headerText,
                                         java.lang.String footerText)
        Starts a page sequence, depending on the current chapter.
        Parameters:
        headerText - The text to write in the header, if null, nothing is written.
        footerText - The text to write in the footer, if null, nothing is written.
      • getHeaderText

        protected java.lang.String getHeaderText()
        Returns the text to write in the header of each page.
        Returns:
        String
      • getFooterText

        protected java.lang.String getFooterText()
        Returns the text to write in the footer of each page.
        Returns:
        String
      • getChapterString

        protected java.lang.String getChapterString()
        Returns the current chapter number as a string. By default does nothing, gets overridden by AggregateSink.
        Overrides:
        getChapterString in class FoSink
        Returns:
        an empty String.
      • regionBefore

        protected void regionBefore​(java.lang.String headerText)
        Writes a 'xsl-region-before' block.
        Overrides:
        regionBefore in class FoSink
        Parameters:
        headerText - The text to write in the header, if null, nothing is written.
      • regionAfter

        protected void regionAfter​(java.lang.String footerText)
        Writes a 'xsl-region-after' block. By default does nothing, gets overridden by AggregateSink.
        Overrides:
        regionAfter in class FoSink
        Parameters:
        footerText - The text to write in the footer, if null, nothing is written.
      • chapterHeading

        protected void chapterHeading​(java.lang.String headerText,
                                      boolean chapterNumber)
        Writes a chapter heading. By default does nothing, gets overridden by AggregateSink.
        Overrides:
        chapterHeading in class FoSink
        Parameters:
        headerText - The text to write in the header, if null, the current document title is written.
        chapterNumber - True if the chapter number should be written in front of the text.
      • toc

        public void toc()
        Writes a table of contents. The DocumentModel has to contain a DocumentTOC for this to work.
      • pdfBookmarks

        protected void pdfBookmarks()
        Writes a fo:bookmark-tree. The DocumentModel has to contain a DocumentTOC for this to work.
        Overrides:
        pdfBookmarks in class FoSink
      • coverPage

        public void coverPage()
        Writes a cover page. The DocumentModel has to contain a DocumentMeta for this to work.