public class TemplateVisitor extends Object implements DomVisitor
Constructor and Description |
---|
TemplateVisitor(String i18nPrefix) |
Modifier and Type | Method and Description |
---|---|
protected String |
getElementKey(Element element) |
Map<String,String> |
getI18nValues() |
protected String |
getOrGenerateTranslationKey(Element element)
Gets a translation key associated with the given element.
|
boolean |
hasAttribute(Element element,
String attributeName)
Called to determine if an element has an attribute defined.
|
boolean |
isTextOnly(Element element)
Returns true if the given element has some text and no element children.
|
void |
setI18nPrefix(String i18nPrefix) |
boolean |
visit(Element element)
Visits an element in the dom, returns true if the visitor should
continue visiting down the dom.
|
protected void |
visitAttribute(String i18nKeyPrefix,
Element element,
String attributeName)
Records the translation key/value for an attribute.
|
protected void |
visitElement(String i18nKeyPrefix,
Element element)
Records the translation key/value for an element.
|
public TemplateVisitor(String i18nPrefix)
public boolean visit(Element element)
DomVisitor
visit
in interface DomVisitor
element
- the root element to visitprotected void visitElement(String i18nKeyPrefix, Element element)
i18nKeyPrefix
- element
- protected void visitAttribute(String i18nKeyPrefix, Element element, String attributeName)
i18nKeyPrefix
- element
- attributeName
- protected String getOrGenerateTranslationKey(Element element)
element
- public boolean isTextOnly(Element element)
element
- public boolean hasAttribute(Element element, String attributeName)
element
- attributeName
- public void setI18nPrefix(String i18nPrefix)
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.