de.betabeans.scroogexhtml.dom
Class Document

java.lang.Object
  extended by de.betabeans.scroogexhtml.dom.Document
All Implemented Interfaces:
DocumentNode, java.io.Serializable

public final class Document
extends java.lang.Object
implements DocumentNode, java.io.Serializable

ScroogeXHTML uses a Document object to store the complete content of the RTF file internally before it is converted. Every Document is a sequence of Paragraphobjects, which are sequences of FormattedTextobjects.

Author:
Michael Justin
See Also:
Paragraph, FormattedText, Serialized Form

Constructor Summary
Document(ScroogeXHTMLBase aconverter)
          Constructor for the Document object.
 
Method Summary
 void add()
          Add a paragraph to the document.
 void add(char c)
          Add a character to the current text object of the current paragraph.
 void add(java.lang.String text)
          Add a string to the current text object of the current paragraph.
 void addEncoded(java.lang.String s)
          Adds a string to the current paragraph.
 java.lang.StringBuffer buildHtml()
          Convert all paragraph objects to HTML/XHTML.
 java.lang.StringBuffer buildPlainText()
          Build plain text.
 ScroogeXHTMLBase getConverter()
          Gets the converter attribute.
 java.lang.String getEmptyParagraph()
          Returns the HTML code for an empty paragraph.
 Paragraph getPar()
          get the current paragraph.
protected  Paragraph nextPar(Paragraph paragraph)
          Find the next paragraph in the document.
protected  Paragraph prevPar(Paragraph paragraph)
          Find the previous paragraph in the document.
 void setParProperties(ParagraphProperties pp)
          Set the current paragraph properties.
 void setTextProperties(CharacterProperties cp)
          Set the current text element properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.betabeans.scroogexhtml.dom.DocumentNode
toString
 

Constructor Detail

Document

public Document(ScroogeXHTMLBase aconverter)
Constructor for the Document object. Add a start paragraph.

Parameters:
aconverter - The converter object (owner).
Method Detail

setParProperties

public void setParProperties(ParagraphProperties pp)
Set the current paragraph properties.

Parameters:
pp - The new parProperties value

setTextProperties

public void setTextProperties(CharacterProperties cp)
Set the current text element properties.

Parameters:
cp - The new textProperties value

getPar

public Paragraph getPar()
get the current paragraph.

Returns:
the current paragraph

getConverter

public ScroogeXHTMLBase getConverter()
Gets the converter attribute.

Returns:
The converter value

getEmptyParagraph

public java.lang.String getEmptyParagraph()
Returns the HTML code for an empty paragraph.

Returns:
The emptyParagraph value

add

public void add(java.lang.String text)
Add a string to the current text object of the current paragraph.

Specified by:
add in interface DocumentNode
Parameters:
text - the String to be added

add

public void add(char c)
Add a character to the current text object of the current paragraph.

Specified by:
add in interface DocumentNode
Parameters:
c - the character to be added

prevPar

protected Paragraph prevPar(Paragraph paragraph)
Find the previous paragraph in the document.

Parameters:
paragraph - the current paragraph
Returns:
the previous paragraph or null

nextPar

protected Paragraph nextPar(Paragraph paragraph)
Find the next paragraph in the document.

Parameters:
paragraph - the current paragraph
Returns:
the next paragraph or null

buildHtml

public java.lang.StringBuffer buildHtml()
Convert all paragraph objects to HTML/XHTML. This method will delete all empty paragraphs at the end of the document first. Then it collects all paragraphs using their toStringmethod.

Returns:
Generated HTML code for the document.

addEncoded

public void addEncoded(java.lang.String s)
Adds a string to the current paragraph. The string is already encoded (for example " "). To exclude the string from the standard encoding method, the flag 'isEncoded' of the text element is set to true.

Parameters:
s - The string to be added to the document

add

public void add()
Add a paragraph to the document.


buildPlainText

public java.lang.StringBuffer buildPlainText()
Build plain text.

Returns:
StringBuffer


Copyright (c) 1998-2006 BetaSoft Michael Justin. All Rights Reserved.