de.betabeans.scroogexhtml.translator
Class CustomTranslator

java.lang.Object
  extended by de.betabeans.scroogexhtml.translator.CustomTranslator
All Implemented Interfaces:
Translator
Direct Known Subclasses:
HTMLTranslator, XHTMLTranslator

public abstract class CustomTranslator
extends java.lang.Object
implements Translator

Generic Translator.

Version:
1.0
Author:
Michael Justin

Constructor Summary
CustomTranslator()
           
 
Method Summary
 java.lang.String buildLangAttribute(java.lang.String language)
          Build the lang attribute.
protected  java.lang.String buildSpanTag(java.lang.String s, java.lang.String language, java.lang.StringBuffer fontStyleCSS)
          Build the <span> tag.
 java.lang.String getDocType()
          Set the document tpye property of the translator.
 byte getFontSizeUnit()
          Return the font size unit.
 java.lang.String getParagraph(java.lang.String additionalStyle)
          Build the opening tag for a paragraph element.
 java.lang.String getParagraph(java.lang.String additionalStyle, java.lang.String additionalParams)
          Build the opening tag for a paragraph element.
 java.lang.String getParagraphStyle(ParagraphProperties pp)
          Build the CSS definition for the given paragraph properties.
 java.lang.String getStyleParam(java.lang.String additionalStyle)
          Builds a "style" parameter.
protected  void setDocType(java.lang.String dt)
          Set the document tpye property of the translator.
 void setFontSizeUnit(byte newValue)
          Set the font size unit.
 void setFormatter(Formatter f)
          Set the formatter.
 void setParOpen(java.lang.String tagAndClass, java.lang.String defaultStyle)
          Sets the parOpen attribute of the CustomTranslator object.
 
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.translator.Translator
encode, formatElement, getCloseEmptyElement, getRootElement, isTransitional, isXMLTranslatorClass, supportsElement
 

Constructor Detail

CustomTranslator

public CustomTranslator()
Method Detail

setDocType

protected final void setDocType(java.lang.String dt)
Set the document tpye property of the translator.

Parameters:
dt - String The W3C document type.
See Also:
getDocType()

getDocType

public final java.lang.String getDocType()
Set the document tpye property of the translator.

Specified by:
getDocType in interface Translator
Returns:
String The W3C document type.
See Also:
setDocType(java.lang.String)

setParOpen

public final void setParOpen(java.lang.String tagAndClass,
                             java.lang.String defaultStyle)
Sets the parOpen attribute of the CustomTranslator object.

Specified by:
setParOpen in interface Translator
Parameters:
tagAndClass - The new parOpen value
defaultStyle - The new parOpen value

getParagraph

public final java.lang.String getParagraph(java.lang.String additionalStyle)
Build the opening tag for a paragraph element. Optionally add CSS style definitions.

Specified by:
getParagraph in interface Translator
Parameters:
additionalStyle - Additional CSS style definitions.
Returns:
The opening tag.

getParagraph

public final java.lang.String getParagraph(java.lang.String additionalStyle,
                                           java.lang.String additionalParams)
Build the opening tag for a paragraph element. Optionally add CSS style definitions.

Parameters:
additionalStyle - Additional CSS style definitions.
additionalParams - Additional parameter definitions.
Returns:
The opening tag.

getStyleParam

public final java.lang.String getStyleParam(java.lang.String additionalStyle)
Builds a "style" parameter. The result includes the style stored in the field 'parStyle' and the optional style passed as parameter 'additionalStyle'.

Specified by:
getStyleParam in interface Translator
Parameters:
additionalStyle - Optional additional style definition.
Returns:
The styleParam value

buildLangAttribute

public final java.lang.String buildLangAttribute(java.lang.String language)
Build the lang attribute.

Specified by:
buildLangAttribute in interface Translator
Parameters:
language - String
Returns:
String

buildSpanTag

protected final java.lang.String buildSpanTag(java.lang.String s,
                                              java.lang.String language,
                                              java.lang.StringBuffer fontStyleCSS)
Build the <span> tag.

Parameters:
s - text with formatting tags
language - the language code
fontStyleCSS - the optional CSS style
Returns:
the complete SPAN tag

getFontSizeUnit

public final byte getFontSizeUnit()
Return the font size unit.

Specified by:
getFontSizeUnit in interface Translator
Returns:
byte
See Also:
setFontSizeUnit(byte)

setFontSizeUnit

public final void setFontSizeUnit(byte newValue)
Set the font size unit.

Specified by:
setFontSizeUnit in interface Translator
Parameters:
newValue - byte
See Also:
getFontSizeUnit()

getParagraphStyle

public java.lang.String getParagraphStyle(ParagraphProperties pp)
Build the CSS definition for the given paragraph properties.

Specified by:
getParagraphStyle in interface Translator
Parameters:
pp - The paragraph property definition.
Returns:
The string which contains the CSS definition.

setFormatter

public final void setFormatter(Formatter f)
Set the formatter.

Specified by:
setFormatter in interface Translator
Parameters:
f - Formatter


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