You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2007/08/20 15:07:24 UTC
svn commit: r567680 - in
/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo:
FoConfiguration.java FoSink.java
Author: ltheussl
Date: Mon Aug 20 06:07:23 2007
New Revision: 567680
URL: http://svn.apache.org/viewvc?rev=567680&view=rev
Log:
Javadocs. Use new constants in Sink interface.
Modified:
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
Modified: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java?rev=567680&r1=567679&r2=567680&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java (original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java Mon Aug 20 06:07:23 2007
@@ -42,10 +42,13 @@
// TODO: add constructor to override default configuration
- /** Constructor. */
+ /**
+ * Constructor.
+ */
public FoConfiguration()
{
this.config = new XMLConfiguration();
+
// necessary because some attributes contain commas:
config.setDelimiterParsingDisabled( true );
@@ -62,7 +65,9 @@
reset();
}
- /** Builds a list of attributes.
+ /**
+ * Builds a list of attributes.
+ *
* @param attributeId A unique id to identify the set of attributes.
* This should correspond to the name of an attribute-set
* defined in the configuration file.
@@ -83,6 +88,13 @@
return buffer.toString();
}
+ /**
+ * Adds an attribute to the current StringBuffer.
+ *
+ * @param attributeId A unique id to identify the set of attributes.
+ * This should correspond to the name of an attribute-set
+ * defined in the configuration file.
+ */
private void addAttributes( String attributeId )
{
int index = sets.indexOf( attributeId );
@@ -112,6 +124,9 @@
}
}
+ /**
+ * Re-initialize the StringBuffer.
+ */
private void reset()
{
this.buffer = new StringBuffer( 512 );
Modified: maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=567680&r1=567679&r2=567680&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java (original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java Mon Aug 20 06:07:23 2007
@@ -74,7 +74,9 @@
/** In fragment mode, some text has to be ignored (title...). */
private boolean ignoreText;
- /** Constructor.
+ /**
+ * Constructor.
+ *
* @param writer The writer for writing the result.
*/
public FoSink( Writer writer )
@@ -82,7 +84,9 @@
this( writer, false );
}
- /** Constructor.
+ /**
+ * Constructor.
+ *
* @param writer The writer for writing the result.
* @param fragment Indicates if the document is only a fragment.
*/
@@ -93,7 +97,9 @@
this.fragmentDocument = fragment;
}
- /** Returns the configuration object of this sink.
+ /**
+ * Returns the configuration object of this sink.
+ *
* @return The configuration object of this sink.
*/
public FoConfiguration getFoConfiguration()
@@ -242,7 +248,7 @@
/** {@inheritDoc} */
public void sectionTitle1()
{
- onSectionTitle( 1 );
+ onSectionTitle( Sink.SECTION_LEVEL_1 );
}
/** {@inheritDoc} */
@@ -268,7 +274,7 @@
/** {@inheritDoc} */
public void sectionTitle2()
{
- onSectionTitle( 2 );
+ onSectionTitle( Sink.SECTION_LEVEL_2 );
}
/** {@inheritDoc} */
@@ -293,7 +299,7 @@
/** {@inheritDoc} */
public void sectionTitle3()
{
- onSectionTitle( 3 );
+ onSectionTitle( Sink.SECTION_LEVEL_3 );
}
/** {@inheritDoc} */
@@ -317,7 +323,7 @@
/** {@inheritDoc} */
public void sectionTitle4()
{
- onSectionTitle( 4 );
+ onSectionTitle( Sink.SECTION_LEVEL_4 );
}
/** {@inheritDoc} */
@@ -341,7 +347,7 @@
/** {@inheritDoc} */
public void sectionTitle5()
{
- onSectionTitle( 5 );
+ onSectionTitle( Sink.SECTION_LEVEL_5 );
}
/** {@inheritDoc} */
@@ -363,31 +369,35 @@
writeStartTag( "block", "body.text" );
}
- /** Starts a section title. */
+ /**
+ * Starts a section title.
+ *
+ * @param depth The section level.
+ */
private void onSectionTitle( int depth )
{
- StringBuffer title = new StringBuffer( 10 );
+ StringBuffer title = new StringBuffer( 16 );
newline();
- if ( depth == 1 )
+ if ( depth == Sink.SECTION_LEVEL_1 )
{
writeStartTag( "block", "body.h1" );
title.append( section ).append( " " );
}
- else if ( depth == 2 )
+ else if ( depth == Sink.SECTION_LEVEL_2 )
{
writeStartTag( "block", "body.h2" );
title.append( section ).append( "." );
title.append( subsection ).append( " " );
}
- else if ( depth == 3 )
+ else if ( depth == Sink.SECTION_LEVEL_3 )
{
writeStartTag( "block", "body.h3" );
title.append( section ).append( "." );
title.append( subsection ).append( "." );
title.append( subsubsection ).append( " " );
}
- else if ( depth == 4 )
+ else if ( depth == Sink.SECTION_LEVEL_4 )
{
writeStartTag( "block", "body.h4" );
}
@@ -710,7 +720,9 @@
tableCell( true );
}
- /** Writes a table cell.
+ /**
+ * Writes a table cell.
+ *
* @param headerRow Currently not used.
*/
private void tableCell( boolean headerRow )
@@ -911,7 +923,7 @@
}
catch ( IOException e )
{
- // TODO
+ // TODO: log
}
}
@@ -924,11 +936,13 @@
}
catch ( IOException e )
{
- // TODO
+ // TODO: log
}
}
- /** Writes the beginning of a FO document in aggregate mode. */
+ /**
+ * Writes the beginning of a FO document in aggregate mode.
+ */
public void beginDocument()
{
writeln( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
@@ -956,8 +970,8 @@
writeEndTag( "layout-master-set" );
}
- /** Writes the end of a FO document in aggregate mode,
- * flushes and closes the stream.
+ /**
+ * Writes the end of a FO document in aggregate mode, flushes and closes the stream.
*/
public void endDocument()
{
@@ -970,6 +984,12 @@
//
// ----------------------------------------------------------------------
+ /**
+ * Writes a start tag, prepending EOL.
+ *
+ * @param tag The tag name.
+ * @param attributeId An id identifying the attribute set.
+ */
private void writeStartTag( String tag, String attributeId )
{
String attribs = config.getAttributeSet( attributeId );
@@ -977,23 +997,46 @@
write( "<fo:" + tag + attribs + ">" );
}
+ /**
+ * Writes a start tag, prepending EOL.
+ *
+ * @param tag The tag name.
+ * @param id An id to add.
+ * @param name The name (value) of the id.
+ */
private void writeStartTag( String tag, String id, String name )
{
newline();
write( "<fo:" + tag + " " + id + "=\"" + name + "\">" );
}
+ /**
+ * Writes an end tag, appending EOL.
+ *
+ * @param tag The tag name.
+ */
private void writeEndTag( String tag )
{
writeln( "</fo:" + tag + ">" );
}
+ /**
+ * Writes a simple tag, appending EOL.
+ *
+ * @param tag The tag name.
+ * @param attributeId An id identifying the attribute set.
+ */
private void writeEmptyTag( String tag, String attributeId )
{
String attribs = config.getAttributeSet( attributeId );
writeln( "<fo:" + tag + attribs + "/>" );
}
+ /**
+ * Writes a text, swallowing any exceptions.
+ *
+ * @param text The text to write.
+ */
private void write( String text )
{
try
@@ -1002,21 +1045,32 @@
}
catch ( IOException e )
{
- // TODO
+ // TODO: log
}
}
+ /**
+ * Writes a text, appending EOL.
+ *
+ * @param text The text to write.
+ */
private void writeln( String text )
{
write( text );
newline();
}
+ /**
+ * Writes content, escaping special characters.
+ *
+ * @param text The text to write.
+ */
private void content( String text )
{
write( escaped( text, verbatim ) );
}
+ /** Writes EOL. */
private void newline()
{
write( EOL );
@@ -1024,6 +1078,7 @@
/**
* Escapes special characters so that the text can be included in a fo file.
+ *
* @param text The text to process.
* @param verb In verbatim mode, white space and newlines are escaped.
* @return The text with special characters escaped.
@@ -1075,6 +1130,7 @@
return buffer.toString();
}
+ /** Starts a page sequence. */
private void startPageSequence()
{
if ( chapter == 0 )