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

java.lang.Objectorg.devtools.wiki.translators.WidgetTranslator
- All Implemented Interfaces:
- org.devtools.webtrans.Translator
- Direct Known Subclasses:
- AuthorStampTranslator, ChangelogEntryTranslator, ContentTranslator, DateTranslator, DeleteTranslator, FormEntryTranslator, ParamEchoTranslator, RecentChangesTranslator, ResolvingPutterTranslator, SearchChangelogTranslator, SearchTranslator, SelfLinkTranslator, UniqueTranslator, UsageTranslator
- public abstract class WidgetTranslator
- extends java.lang.Object
- implements org.devtools.webtrans.Translator
- extends java.lang.Object
An abstract base class for widget translators. Searches for text
of the form [widget param=value:value param=value...]
and replaces it with whatever text is returned from its
handleWidget method.
Subclasses should override the handleWidget method to do something
useful with the widget.
This widget also obtains a reference to the services object so that
your subclass doesn't have to.
| Field Summary | |
private org.devtools.util.debug.Debugger |
D
|
protected org.devtools.webtrans.TranslatorServices |
srv
The site's translation services |
static java.lang.String |
START_WIDGET
|
static java.lang.String |
STOP_WIDGET
|
private java.lang.String |
widgetLabel
The widget to detect. |
| Constructor Summary | |
WidgetTranslator(java.lang.String widgetLabel)
Constructs a new WidgetTranslator that replaces widgets with the given initial label. |
|
| Method Summary | |
abstract java.lang.String |
getName()
Returns the name of the translator. |
abstract java.lang.String |
getUsage()
Returns some HTML representing a description of what text this translator processes. |
java.lang.String |
handleWidget(org.devtools.util.MultiProperties options,
org.devtools.webtrans.TranslatorLog log)
Called by the translate method when a widget with the appropriate label is found. |
void |
init(org.devtools.webtrans.TranslatorServices srv)
This method stores a reference to the given Services in the srv member. |
void |
translate(org.devtools.webtrans.StringChanges c,
org.devtools.webtrans.WebContent content,
org.devtools.webtrans.TranslatorLog log,
java.util.Properties query)
FIXME: These little abortive continues are a little hacky. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
START_WIDGET
public static final java.lang.String START_WIDGET
- See Also:
- Constant Field Values
STOP_WIDGET
public static final java.lang.String STOP_WIDGET
- See Also:
- Constant Field Values
widgetLabel
private java.lang.String widgetLabel
- The widget to detect.
srv
protected org.devtools.webtrans.TranslatorServices srv
- The site's translation services
D
private org.devtools.util.debug.Debugger D
| Constructor Detail |
WidgetTranslator
public WidgetTranslator(java.lang.String widgetLabel)
- Constructs a new WidgetTranslator that replaces widgets with
the given initial label.
| Method Detail |
init
public void init(org.devtools.webtrans.TranslatorServices srv)
- This method stores a reference to the given Services in the srv
member. Otherwise, does nothing.
- Specified by:
initin interfaceorg.devtools.webtrans.Translator
handleWidget
public java.lang.String handleWidget(org.devtools.util.MultiProperties options, org.devtools.webtrans.TranslatorLog log)
- Called by the translate method when a widget with the
appropriate label is found. This method should be overridden
to do something interesting with the options given to the
widget, and should return a String representing what the widget
should be replaced with.
The default implementation simply removes the widget.
translate
public void translate(org.devtools.webtrans.StringChanges c, org.devtools.webtrans.WebContent content, org.devtools.webtrans.TranslatorLog log, java.util.Properties query)
- FIXME: These little abortive continues are a little hacky.
Maybe something more robust?
- Specified by:
translatein interfaceorg.devtools.webtrans.Translator
getName
public abstract java.lang.String getName()
- Returns the name of the translator. This should be something
descriptive and human-readable that uniquely indicates what the
translator does. This name will be included in error logging
if this translator has a conflict with another one, throws an
exception, etc.
- Specified by:
getNamein interfaceorg.devtools.webtrans.Translator
getUsage
public abstract java.lang.String getUsage()
- Returns some HTML representing a description of what text this
translator processes. This will be shown to the user so that
they can determine how to write their documents. (If this
translator has no usage or if you wish it to be invisible to
the user, return null. This Translator will not be included in
the usage list.)
- Specified by:
getUsagein interfaceorg.devtools.webtrans.Translator
|
|||||||||
| Home >> All >> org >> devtools >> wiki >> [ translators overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.devtools.wiki.translators.WidgetTranslator