|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object SimpleTagSupport hirondelle.web4j.ui.tag.TagHelper hirondelle.web4j.ui.translate.Tooltips
public final class Tooltips
Custom tag for translating TITLE, ALT and submit-button VALUE attributes in markup.
By using this custom tag once in a template JSP, it is often possible to translate all of the TITLE, ALT, and submit-button VALUE attributes appearing in an entire application.
The VALUE attribute is translated only for SUBMIT controls. (This VALUE attribute isn't really a tooltip, of course : it is rendered as the button text. For this custom tag, the distinction is not very important.)
The TITLE attribute applies to a large number of HTML tags, and the ALT attribute applies to several tags. In both cases, these items generate pop-up "tool tips", which are visible to the end user. If the application is multilingual, then they require translation.
This custom tag accepts HTML markup for its body, and will do a search and
replace on its content, replacing the values of all TITLE, ALT and
submit-button VALUE attributes (that have visible content) with translated values.
The translations are provided by the configured implementations of
Translator
and LocaleSource
.
Constructor Summary | |
---|---|
Tooltips()
|
Method Summary | |
---|---|
protected String |
getEmittedText(String aOriginalBody)
Scan the body of this tag, and translate the values of all TITLE, ALT, and submit-button VALUE attributes. |
void |
setEscapeChars(boolean aValue)
Control the escaping of special characters. |
Methods inherited from class hirondelle.web4j.ui.tag.TagHelper |
---|
checkForContent, crossCheckAttributes, doTag, getPageContext, getPageName, getRequest, getResponse |
Methods inherited from class SimpleTagSupport |
---|
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Tooltips()
Method Detail |
---|
public void setEscapeChars(boolean aValue)
By default, this tag will escape any special characters appearing in the
TITLE or ALT attribute, using EscapeChars.forHTML(String)
.
To override this default behaviour, set this value to false.
protected String getEmittedText(String aOriginalBody)
Uses the configured Translator
and LocaleSource
.
In addition, this method uses EscapeChars.forHTML(String)
to ensure that
any special characters are escaped. This behavior can be overridden using setEscapeChars(boolean)
.
getEmittedText
in class TagHelper
aOriginalBody
- is the evaluated body of this tag. If there is no body, or
if the body is present but empty, then it is null.
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |