de.betabeans.scroogexhtml.converter
Class DOMWriter

java.lang.Object
  extended by de.betabeans.scroogexhtml.converter.DOMWriter
All Implemented Interfaces:
Writer

public final class DOMWriter
extends java.lang.Object
implements Writer

The converter uses the ScroogeXHTMLWriter to store the current RTF state, character properties and paragraph properties, and to build the Document.

If a paragraph property changes, the writer appends a new Paragraphobject at the logical end of the Document object.

If a character property changes, the writer appends a new FormattedTextobject at the logical end of the current Paragraph object.

Author:
Michael Justin
See Also:
Document, Paragraph, FormattedText, Document

Constructor Summary
DOMWriter(ScroogeXHTMLBase aconverter)
          Constructor for the ScroogeXHTMLWriter object.
 
Method Summary
protected  void applyParagraphProperties()
          Apply the current paragraph properties to the current paragraph object.
 void applyTextProperties()
          Apply the current text properties to the current text object.
 CharacterProperties getCharacterProperties()
           
 java.lang.String getDefaultFontName()
          Gets the defaultFontName.
 Document getDocument()
          Gets the document.
 java.lang.StringBuffer getHtml()
          Convert the Document to (X)HTML.
 ParagraphProperties getParagraphProperties()
           
 java.lang.StringBuffer getPlainText()
          Convert the document to plain text.
 boolean isNumberingStyle()
          Gets the writerNumbered attribute.
 void popCharacterProperties(CharacterProperties newCharProps)
           
 void popParagraphProperties(ParagraphProperties newValue)
           
 void resetCharacterAttributes()
          Set all character attributes to the default values.
 void resetParagraphAttributes()
          reset all paragraph attributes to the default values.
 void setAlignment(int newValue)
          Set the "alignment" attribute of the current paragraph.
 void setBGColor(java.lang.String newValue)
          Set the "bgcolor" attribute of the current text.
 void setBold(boolean newValue)
          Set the "bold" attribute of the current text.
 void setDefaultFontName(java.lang.String newValue)
          Sets the defaultFontName.
 void setFirstIndent(int newValue)
          Set the "firstindent" attribute of the current paragraph.
 void setFontCharSet(int newValue)
          Set the "characterset" attribute of the current text.
 void setFontColor(java.lang.String newValue)
          Set the "fontcolor" attribute of the current text.
 void setFontName(java.lang.String newValue)
          Set the "fontname" attribute of the current text.
 void setFontSize(int newValue)
          Set the "fontsize" attribute of the current text.
 void setHLColor(java.lang.String newValue)
          Set the "hlcolor" attribute of the current text.
 void setItalic(boolean newValue)
          Set the "italic" attribute of the current text.
 void setLanguage(java.lang.String newValue)
          Set the "language" attribute of the current text.
 void setLeftIndent(int newValue)
          Set the "leftindent" attribute of the current paragraph.
 void setNumbered(boolean newValue)
          Set the "bullet" attribute of the current paragraph.
 void setNumberingLevel(int newValue)
          Set the "numberinglevel" attribute of the current paragraph.
 void setNumberingStyle(boolean n)
          Sets the writerNumbered state.
 void setRightIndent(int newValue)
          Set the "rightindent" attribute of the current paragraph.
 void setRightToLeftChar(boolean newValue)
          Set the "rtl" attribute of the current text.
 void setRightToLeftPar(boolean newValue)
          Set the "rtl" attribute of the current paragraph.
 void setStrike(boolean newValue)
          Set the "strike" attribute of the current text.
 void setSubscript(boolean newValue)
          Set the "subscript" attribute of the current text.
 void setSuperscript(boolean newValue)
          Set the "superscript" attribute of the current text.
 void setUnderline(boolean newValue)
          Set the "underline" attribute of the current text.
 void writeChar(char ch)
          Append a character to the Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMWriter

public DOMWriter(ScroogeXHTMLBase aconverter)
Constructor for the ScroogeXHTMLWriter object.

Parameters:
aconverter - The converter (owner) of this writer.
Method Detail

getCharacterProperties

public CharacterProperties getCharacterProperties()
Specified by:
getCharacterProperties in interface Writer

getParagraphProperties

public ParagraphProperties getParagraphProperties()
Specified by:
getParagraphProperties in interface Writer

setNumberingStyle

public void setNumberingStyle(boolean n)
Sets the writerNumbered state.

Specified by:
setNumberingStyle in interface Writer
Parameters:
n - The new writerNumbered value

applyTextProperties

public void applyTextProperties()
Apply the current text properties to the current text object.

Specified by:
applyTextProperties in interface Writer

applyParagraphProperties

protected void applyParagraphProperties()
Apply the current paragraph properties to the current paragraph object.


isNumberingStyle

public boolean isNumberingStyle()
Gets the writerNumbered attribute.

Specified by:
isNumberingStyle in interface Writer
Returns:
The writerNumbered value

getDocument

public Document getDocument()
Gets the document.

Specified by:
getDocument in interface Writer
Returns:
The document value

setDefaultFontName

public void setDefaultFontName(java.lang.String newValue)
Sets the defaultFontName.

Specified by:
setDefaultFontName in interface Writer
Parameters:
newValue - The new defaultFontName value

getDefaultFontName

public java.lang.String getDefaultFontName()
Gets the defaultFontName.

Specified by:
getDefaultFontName in interface Writer
Returns:
The defaultFontName value

getHtml

public java.lang.StringBuffer getHtml()
Convert the Document to (X)HTML.

Specified by:
getHtml in interface Writer
Returns:
the converted (X)HTML code

getPlainText

public java.lang.StringBuffer getPlainText()
Convert the document to plain text.

Specified by:
getPlainText in interface Writer
Returns:
StringBuffer the converted text.

writeChar

public void writeChar(char ch)
Append a character to the Document. If it is a "new line" character, a new paragraph object will be created. The new paragraph inherits the properties of the previous paragraph. The "form feed" and "null byte" characters are illegal and filtered out. The "tab" character will be replaced by a string which is defined in the getTabString method. This string is already HTML-encoded.

Specified by:
writeChar in interface Writer
Parameters:
ch - a character

resetParagraphAttributes

public void resetParagraphAttributes()
reset all paragraph attributes to the default values.

Specified by:
resetParagraphAttributes in interface Writer

resetCharacterAttributes

public void resetCharacterAttributes()
Set all character attributes to the default values.

Specified by:
resetCharacterAttributes in interface Writer

setBold

public void setBold(boolean newValue)
Set the "bold" attribute of the current text.

Specified by:
setBold in interface Writer
Parameters:
newValue - The new bold value

setRightToLeftChar

public void setRightToLeftChar(boolean newValue)
Set the "rtl" attribute of the current text.

Specified by:
setRightToLeftChar in interface Writer
Parameters:
newValue - boolean

setLanguage

public void setLanguage(java.lang.String newValue)
Set the "language" attribute of the current text.

Specified by:
setLanguage in interface Writer
Parameters:
newValue - The new language property

setItalic

public void setItalic(boolean newValue)
Set the "italic" attribute of the current text.

Specified by:
setItalic in interface Writer
Parameters:
newValue - The new italic value

setStrike

public void setStrike(boolean newValue)
Set the "strike" attribute of the current text.

Specified by:
setStrike in interface Writer
Parameters:
newValue - The new strike value

setUnderline

public void setUnderline(boolean newValue)
Set the "underline" attribute of the current text.

Specified by:
setUnderline in interface Writer
Parameters:
newValue - The new underline value

setFontName

public void setFontName(java.lang.String newValue)
Set the "fontname" attribute of the current text.

Specified by:
setFontName in interface Writer
Parameters:
newValue - The new fontName value

setFontCharSet

public void setFontCharSet(int newValue)
Set the "characterset" attribute of the current text.

Specified by:
setFontCharSet in interface Writer
Parameters:
newValue - The new fontCharSet value

setFontColor

public void setFontColor(java.lang.String newValue)
Set the "fontcolor" attribute of the current text.

Specified by:
setFontColor in interface Writer
Parameters:
newValue - The new fontColor value

setBGColor

public void setBGColor(java.lang.String newValue)
Set the "bgcolor" attribute of the current text.

Specified by:
setBGColor in interface Writer
Parameters:
newValue - The new bGColor value

setHLColor

public void setHLColor(java.lang.String newValue)
Set the "hlcolor" attribute of the current text.

Specified by:
setHLColor in interface Writer
Parameters:
newValue - The new hLColor value

setFontSize

public void setFontSize(int newValue)
Set the "fontsize" attribute of the current text.

Specified by:
setFontSize in interface Writer
Parameters:
newValue - The new fontSize value

setSubscript

public void setSubscript(boolean newValue)
Set the "subscript" attribute of the current text.

Specified by:
setSubscript in interface Writer
Parameters:
newValue - The new subscript value

setSuperscript

public void setSuperscript(boolean newValue)
Set the "superscript" attribute of the current text.

Specified by:
setSuperscript in interface Writer
Parameters:
newValue - The new superscript value

setRightToLeftPar

public void setRightToLeftPar(boolean newValue)
Set the "rtl" attribute of the current paragraph.

Specified by:
setRightToLeftPar in interface Writer
Parameters:
newValue - boolean

setNumberingLevel

public void setNumberingLevel(int newValue)
Set the "numberinglevel" attribute of the current paragraph.

Specified by:
setNumberingLevel in interface Writer
Parameters:
newValue - The new numberingLevel value

setAlignment

public void setAlignment(int newValue)
Set the "alignment" attribute of the current paragraph.

Specified by:
setAlignment in interface Writer
Parameters:
newValue - The new alignment value

setNumbered

public void setNumbered(boolean newValue)
Set the "bullet" attribute of the current paragraph.

Specified by:
setNumbered in interface Writer
Parameters:
newValue - The new bullet value

setLeftIndent

public void setLeftIndent(int newValue)
Set the "leftindent" attribute of the current paragraph.

Specified by:
setLeftIndent in interface Writer
Parameters:
newValue - The new leftIndent value

setRightIndent

public void setRightIndent(int newValue)
Set the "rightindent" attribute of the current paragraph.

Specified by:
setRightIndent in interface Writer
Parameters:
newValue - The new rightIndent value

setFirstIndent

public void setFirstIndent(int newValue)
Set the "firstindent" attribute of the current paragraph.

Specified by:
setFirstIndent in interface Writer
Parameters:
newValue - The new firstIndent value

popCharacterProperties

public void popCharacterProperties(CharacterProperties newCharProps)
Specified by:
popCharacterProperties in interface Writer

popParagraphProperties

public void popParagraphProperties(ParagraphProperties newValue)
Specified by:
popParagraphProperties in interface Writer


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