|
|||||||||
| Home >> All >> org >> devtools >> webtrans >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.devtools.webtrans.util
Class SimpleTranslatorManager

java.lang.Objectorg.devtools.webtrans.util.SimpleTranslatorManager
- All Implemented Interfaces:
- org.devtools.webtrans.TranslatorManager
- public class SimpleTranslatorManager
- extends java.lang.Object
- implements org.devtools.webtrans.TranslatorManager
- extends java.lang.Object
Translates a WebContent into HTML by applying a number of
Translators. Each Translator can insert, delete, and replace text
in the original content. The changes are gathered together,
merged, and applied to the document at the end of the process.
(This is done so that each Translator module works with the real,
original document and does not accidentally interpret partial
changes to the document to be original content.)
In addition, TranslatorManager hides any literal areas
from the Translators, so that it cannot be considered or changed.
(A literal area is any text enclosed in the LITERAL symbols).
Thus, any text between these characters will come straight through
the translation process and be served right to the browser (except
of course for the LITERAL symbols themselves, which will be removed
unless escaped. See below.) Presumably the content author will
type raw HTML into the literal areas. FIXME: Would have liked to
implement this as a Translator rather than a special
behavior.
Each LITERAL_ESCAPE symbol in the document will appear to
the Translators as LITERAL symbols, and will not denote a literal
area. The content author must type LITERAL_ESCAPE symbols into the
content anywhere they wish a character to appear that is one of the
reserved LITERAL symbols, even if it appears in a literal area.
TranslatorManager will attempt to interpret any unescaped LITERAL
symbols as literal area control instructions.
| Field Summary | |
private org.devtools.util.debug.Debugger |
D
|
private java.util.Vector |
modules
The modules that the document will be passed through when processed during a translate() call. |
private org.devtools.webtrans.TranslatorServices |
srv
Some site services |
| Constructor Summary | |
SimpleTranslatorManager()
Constructs a new TranslatorManager that is initially empty. |
|
| Method Summary | |
void |
addTranslator(org.devtools.webtrans.Translator t)
Adds a translator to the list. |
java.lang.String |
getUsage()
Returns an HTML-formatted display of the usage for each translator in this translator manager. |
void |
init(org.devtools.webtrans.TranslatorServices srv)
Initializes the manager |
private java.lang.String |
showMessages(org.devtools.webtrans.TranslatorLog log)
Formats up the messages in the Translation log politely. |
java.lang.String |
translate(org.devtools.webtrans.WebContent content,
java.util.Properties query)
Translates the given content into HTML. |
private java.lang.String |
translateF(org.devtools.webtrans.WebContent content,
java.util.Properties query,
org.devtools.webtrans.TranslatorLog log)
Translates the given content into HTML. |
java.lang.String |
translateWithDetails(org.devtools.webtrans.WebContent content,
java.util.Properties query)
Translates the given content into HTML. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
modules
private java.util.Vector modules
- The modules that the document will be passed through when
processed during a translate() call. Everything in here should
conform to the TranslatorInterface.
srv
private org.devtools.webtrans.TranslatorServices srv
- Some site services
D
private org.devtools.util.debug.Debugger D
| Constructor Detail |
SimpleTranslatorManager
public SimpleTranslatorManager()
- Constructs a new TranslatorManager that is initially empty.
Without any Translators, the translate() method will simply
return the given document. You must add Translators to the
FlexTranslator (using addTranslator, etc) in order to get it to
do something interesting.
| Method Detail |
init
public void init(org.devtools.webtrans.TranslatorServices srv)
- Initializes the manager
- Specified by:
initin interfaceorg.devtools.webtrans.TranslatorManager
addTranslator
public void addTranslator(org.devtools.webtrans.Translator t)
- Adds a translator to the list. Since in some cases Translators
may interfere, the order in which the translators were added to
the document is the deciding factor (last-added translators get
precedence in applying their changes over earlier ones.)
- Specified by:
addTranslatorin interfaceorg.devtools.webtrans.TranslatorManager
translate
public java.lang.String translate(org.devtools.webtrans.WebContent content, java.util.Properties query)
- Translates the given content into HTML. FIXME: Should
eventually handle other content types, maybe?
- Specified by:
translatein interfaceorg.devtools.webtrans.TranslatorManager
translateF
private java.lang.String translateF(org.devtools.webtrans.WebContent content, java.util.Properties query, org.devtools.webtrans.TranslatorLog log)
- Translates the given content into HTML. FIXME: Should
eventually handle other content types, maybe?
translateWithDetails
public java.lang.String translateWithDetails(org.devtools.webtrans.WebContent content, java.util.Properties query)
- Translates the given content into HTML. Additiionally, the
translation should have (somewhere) an indication of the
warnings and details that each Translator might have
returned.
Since this method is usually called for the purposes of showing the page author a preview of the content they have just created, the message output should probably not obscure the actual appearance of the page.
- Specified by:
translateWithDetailsin interfaceorg.devtools.webtrans.TranslatorManager
getUsage
public java.lang.String getUsage()
- Returns an HTML-formatted display of the usage for each
translator in this translator manager. Each translator will be
an item in a list.
- Specified by:
getUsagein interfaceorg.devtools.webtrans.TranslatorManager
showMessages
private java.lang.String showMessages(org.devtools.webtrans.TranslatorLog log)
- Formats up the messages in the Translation log politely.
|
|||||||||
| Home >> All >> org >> devtools >> webtrans >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.devtools.webtrans.util.SimpleTranslatorManager