org.apache.maven.doxia.module.fo
Class FoAggregateSink

java.lang.Object
  extended by org.apache.maven.doxia.sink.AbstractSink
      extended by org.apache.maven.doxia.sink.SinkAdapter
          extended by org.apache.maven.doxia.sink.AbstractXmlSink
              extended by org.apache.maven.doxia.module.fo.FoSink
                  extended by org.apache.maven.doxia.module.fo.FoAggregateSink
All Implemented Interfaces:
LogEnabled, Markup, XmlMarkup, FoMarkup, 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
Version:
$Id: FoAggregateSink.java 1091053 2011-04-11 12:55:07Z ltheussl $
Author:
ltheussl

Field Summary
static int TOC_END
          Table Of Content at the end of the document.
static int TOC_NONE
          No Table Of Content.
static int TOC_START
          Table Of Content at the start of the document.
 
Fields inherited from class org.apache.maven.doxia.module.fo.FoSink
warnMessages
 
Fields inherited from interface org.apache.maven.doxia.module.fo.FoMarkup
BASIC_LINK_TAG, BLOCK_TAG, BOOKMARK_TAG, BOOKMARK_TITLE_TAG, BOOKMARK_TREE_TAG, FLOW_TAG, FO_NAMESPACE, INLINE_TAG, LAYOUT_MASTER_SET_TAG, LEADER_TAG, LIST_BLOCK_TAG, LIST_ITEM_BODY_TAG, LIST_ITEM_LABEL_TAG, LIST_ITEM_TAG, PAGE_NUMBER_CITATION_TAG, PAGE_NUMBER_TAG, PAGE_SEQUENCE_TAG, REGION_AFTER_TAG, REGION_BEFORE_TAG, REGION_BODY_TAG, ROOT_TAG, SIMPLE_PAGE_MASTER_TAG, STATIC_CONTENT_TAG, TABLE_AND_CAPTION_TAG, TABLE_BODY_TAG, TABLE_CAPTION_TAG, TABLE_CELL_TAG, TABLE_COLUMN_TAG, TABLE_ROW_TAG, TABLE_TAG
 
Fields inherited from interface org.apache.maven.doxia.markup.XmlMarkup
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE
 
Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR
 
Fields inherited from interface org.apache.maven.doxia.sink.Sink
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, ROLE, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5
 
Constructor Summary
FoAggregateSink(Writer writer)
          Constructor.
 
Method Summary
 void anchor(String name)
          
 void anchor(String name, SinkEventAttributes attributes)
          
 void author_()
          
 void author()
          
 void author(SinkEventAttributes attributes)
          
 void body_()
          
 void body()
          
 void body(SinkEventAttributes attributes)
          
protected  void chapterHeading(String headerText, boolean chapterNumber)
          Writes a chapter heading. Writes a chapter heading.
protected  void content(String text)
          Writes content, escaping special characters. Writes content, escaping special characters.
 void coverPage()
          Writes a cover page.
 void date_()
          
 void date()
          
 void date(SinkEventAttributes attributes)
          
 void figureGraphics(String name)
          
 void figureGraphics(String src, SinkEventAttributes attributes)
          
protected  String getChapterString()
          Returns the current chapter number as a string. Returns the current chapter number as a string.
protected  String getFooterText()
          Returns the text to write in the footer of each page.
protected  String getHeaderText()
          Returns the text to write in the header of each page.
 void head_()
          
 void head()
          
 void head(SinkEventAttributes attributes)
          
 void link(String name)
          
 void link(String name, SinkEventAttributes attributes)
          
protected  void newline()
          Writes EOL.
protected  void pdfBookmarks()
          Writes a fo:bookmark-tree. Writes a fo:bookmark-tree.
protected  void regionAfter(String footerText)
          Writes a 'xsl-region-after' block. Writes a 'xsl-region-after' block.
protected  void regionBefore(String headerText)
          Writes a 'xsl-region-before' block. Writes a 'xsl-region-before' block.
 void setDocumentModel(DocumentModel model)
          Sets the DocumentModel to be used by this sink.
 void setDocumentModel(DocumentModel model, int tocPos)
          Sets the DocumentModel to be used by this sink.
 void setDocumentName(String name)
          Sets the name of the current source document, relative to the source root.
 void setDocumentTitle(String title)
          Sets the title of the current document.
protected  void startPageSequence(String headerText, String footerText)
          Starts a page sequence, depending on the current chapter.
 void title_()
          
 void title()
          
 void title(SinkEventAttributes attributes)
          
 void toc()
          Writes a table of contents.
protected  void write(String text)
           Writes a text, swallowing any exceptions. Writes a text, swallowing any exceptions.
protected  void writeEmptyTag(HTML.Tag tag, String attributeId)
          Writes a simple tag, appending EOL. Writes a simple tag, appending EOL.
protected  void writeEndTag(HTML.Tag t)
           Writes an end tag, appending EOL.
protected  void writeln(String text)
          Writes a text, appending EOL. Writes a text, appending EOL.
protected  void writeStartTag(HTML.Tag tag, String attributeId)
          Writes a start tag, prepending EOL. Writes a start tag, prepending EOL.
protected  void writeStartTag(HTML.Tag tag, String id, String name)
          Writes a start tag, prepending EOL. Writes a start tag, prepending EOL.
 
Methods inherited from class org.apache.maven.doxia.module.fo.FoSink
anchor_, beginDocument, bold_, bold, close, comment, definedTerm_, definedTerm, definedTerm, definition_, definition, definition, definitionList_, definitionList, definitionList, definitionListItem_, definitionListItem, definitionListItem, endDocument, escaped, figure_, figure, figure, figureCaption_, figureCaption, figureCaption, flush, getFoConfiguration, horizontalRule, horizontalRule, init, isFigure, italic_, italic, lineBreak, lineBreak, link_, list_, list, list, listItem_, listItem, listItem, load, logMessage, monospaced_, monospaced, nonBreakingSpace, numberedList_, numberedList, numberedList, numberedListItem_, numberedListItem, numberedListItem, pageBreak, paragraph_, paragraph, paragraph, rawText, resetSectionCounter, section_, section, section1_, section1, section2_, section2, section3_, section3, section4_, section4, section5_, section5, sectionTitle_, sectionTitle_, sectionTitle, sectionTitle, sectionTitle1_, sectionTitle1, sectionTitle2_, sectionTitle2, sectionTitle3_, sectionTitle3, sectionTitle4_, sectionTitle4, sectionTitle5_, sectionTitle5, startPageSequence, table_, table, table, tableCaption_, tableCaption, tableCaption, tableCell_, tableCell, tableCell, tableCell, tableHeaderCell_, tableHeaderCell, tableHeaderCell, tableHeaderCell, tableRow_, tableRow, tableRow, tableRows_, tableRows, text, text, unknown, verbatim_, verbatim, verbatim, writeEmptyTag, writeStartTag, writeStartTag
 
Methods inherited from class org.apache.maven.doxia.sink.AbstractXmlSink
getNameSpace, setNameSpace, writeEOL, writeSimpleTag, writeSimpleTag, writeStartTag, writeStartTag
 
Methods inherited from class org.apache.maven.doxia.sink.AbstractSink
enableLogging, getLog, unifyEOLs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOC_NONE

public static int TOC_NONE
No Table Of Content.

See Also:
setDocumentModel(DocumentModel, int)

TOC_START

public static int TOC_START
Table Of Content at the start of the document.

See Also:
setDocumentModel(DocumentModel, int)

TOC_END

public static int TOC_END
Table Of Content at the end of the document.

See Also:
setDocumentModel(DocumentModel, int)
Constructor Detail

FoAggregateSink

public FoAggregateSink(Writer writer)
Constructor.

Parameters:
writer - The writer for writing the result.
Method Detail

head

public void head()

Specified by:
head in interface Sink
Overrides:
head in class FoSink

head

public void head(SinkEventAttributes attributes)

Specified by:
head in interface Sink
Overrides:
head in class FoSink

head_

public void head_()

Specified by:
head_ in interface Sink
Overrides:
head_ in class FoSink

title

public void title()

Specified by:
title in interface Sink
Overrides:
title in class FoSink

title

public void title(SinkEventAttributes attributes)

Specified by:
title in interface Sink
Overrides:
title in class FoSink

title_

public void title_()

Specified by:
title_ in interface Sink
Overrides:
title_ in class FoSink

author

public void author()

Specified by:
author in interface Sink
Overrides:
author in class FoSink

author

public void author(SinkEventAttributes attributes)

Specified by:
author in interface Sink
Overrides:
author in class FoSink

author_

public void author_()

Specified by:
author_ in interface Sink
Overrides:
author_ in class FoSink

date

public void date()

Specified by:
date in interface Sink
Overrides:
date in class FoSink

date

public void date(SinkEventAttributes attributes)

Specified by:
date in interface Sink
Overrides:
date in class FoSink

date_

public void date_()

Specified by:
date_ in interface Sink
Overrides:
date_ in class FoSink

body

public void body()

Specified by:
body in interface Sink
Overrides:
body in class FoSink

body

public void body(SinkEventAttributes attributes)

Specified by:
body in interface Sink
Overrides:
body in class FoSink

body_

public void body_()

Specified by:
body_ in interface Sink
Overrides:
body_ in class FoSink

setDocumentTitle

public void setDocumentTitle(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(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(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, String), TOC_START

setDocumentModel

public void setDocumentModel(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(String name)

Specified by:
figureGraphics in interface Sink
Overrides:
figureGraphics in class FoSink

figureGraphics

public void figureGraphics(String src,
                           SinkEventAttributes attributes)

Specified by:
figureGraphics in interface Sink
Overrides:
figureGraphics in class FoSink

anchor

public void anchor(String name)

Specified by:
anchor in interface Sink
Overrides:
anchor in class FoSink

anchor

public void anchor(String name,
                   SinkEventAttributes attributes)

Specified by:
anchor in interface Sink
Overrides:
anchor in class FoSink

link

public void link(String name)

Specified by:
link in interface Sink
Overrides:
link in class FoSink

link

public void link(String name,
                 SinkEventAttributes attributes)

Specified by:
link in interface Sink
Overrides:
link in class FoSink

writeStartTag

protected void writeStartTag(HTML.Tag tag,
                             String attributeId)
Writes a start tag, prepending EOL. 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(HTML.Tag tag,
                             String id,
                             String name)
Writes a start tag, prepending EOL. 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(HTML.Tag t)
Writes an end tag, appending EOL.

Overrides:
writeEndTag in class FoSink

writeEmptyTag

protected void writeEmptyTag(HTML.Tag tag,
                             String attributeId)
Writes a simple tag, appending EOL. 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(String text)
Writes a text, swallowing any exceptions. Writes a text, swallowing any exceptions.

Overrides:
write in class FoSink

writeln

protected void writeln(String text)
Writes a text, appending EOL. Writes a text, appending EOL.

Overrides:
writeln in class FoSink
Parameters:
text - The text to write.

content

protected void content(String text)
Writes content, escaping special characters. 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(String headerText,
                                 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 String getHeaderText()
Returns the text to write in the header of each page.

Returns:
String

getFooterText

protected String getFooterText()
Returns the text to write in the footer of each page.

Returns:
String

getChapterString

protected String getChapterString()
Returns the current chapter number as a string. By default does nothing, gets overridden by AggregateSink. Returns the current chapter number as a string.

Overrides:
getChapterString in class FoSink
Returns:
an empty String.

regionBefore

protected void regionBefore(String headerText)
Writes a 'xsl-region-before' block. 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(String footerText)
Writes a 'xsl-region-after' block. By default does nothing, gets overridden by AggregateSink. Writes a 'xsl-region-after' block.

Overrides:
regionAfter in class FoSink
Parameters:
footerText - The text to write in the footer, if null, nothing is written.

chapterHeading

protected void chapterHeading(String headerText,
                              boolean chapterNumber)
Writes a chapter heading. By default does nothing, gets overridden by AggregateSink. Writes a chapter heading.

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. By default does nothing, gets overridden by AggregateSink. 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.



Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.