Package org.opencms.jsp.decorator
Class CmsHtmlDecorator
java.lang.Object
org.htmlparser.visitors.NodeVisitor
org.opencms.util.CmsHtmlParser
org.opencms.jsp.decorator.CmsHtmlDecorator
- All Implemented Interfaces:
I_CmsHtmlNodeVisitor
The CmsHtmlDecorator is the main object for processing the text decorations.
It uses the information of a
to process the
text decorations.CmsDecoratorConfiguration
- Since:
- 6.1.3
-
Field Summary
Fields inherited from class org.opencms.util.CmsHtmlParser
m_echo, m_noAutoCloseTags, m_result, TAG_ARRAY, TAG_LIST
-
Constructor Summary
ConstructorDescriptionConstructor, creates a new, empty CmsHtmlDecorator.CmsHtmlDecorator
(CmsObject cms, I_CmsDecoratorConfiguration config) Constructor, creates a new CmsHtmlDecorator with a given configuration. -
Method Summary
Modifier and TypeMethodDescriptiondoDecoration
(String html, String encoding) Processes a HTML string and adds text decorations according to the decoration configuration.void
Resets the first occurance flags of all decoration objects.splitAsList
(String source, String[] delimiters, boolean trim, boolean includeDelimiters) Splits a String into substrings along the provided delimiter list and returns the result as a List of Substrings.void
visitStringNode
(org.htmlparser.Text text) Visitor method (callback) invoked when a remark Tag (HTML comment) is encountered.void
visitTag
(org.htmlparser.Tag tag) Visitor method (callback) invoked when a starting Tag (HTML comment) is encountered.Methods inherited from class org.opencms.util.CmsHtmlParser
collapse, configureNoAutoCorrectionTags, getConfiguration, getNoAutoCloseTags, getResult, getTagHtml, process, setConfiguration, setNoAutoCloseTags, visitEndTag, visitRemarkNode
Methods inherited from class org.htmlparser.visitors.NodeVisitor
beginParsing, finishedParsing, shouldRecurseChildren, shouldRecurseSelf
-
Constructor Details
-
CmsHtmlDecorator
Constructor, creates a new, empty CmsHtmlDecorator.- Parameters:
cms
- the CmsObject- Throws:
CmsException
- if something goes wrong
-
CmsHtmlDecorator
Constructor, creates a new CmsHtmlDecorator with a given configuration.- Parameters:
cms
- the CmsObjectconfig
- the configuration to be used
-
-
Method Details
-
splitAsList
public static List<String> splitAsList(String source, String[] delimiters, boolean trim, boolean includeDelimiters) Splits a String into substrings along the provided delimiter list and returns the result as a List of Substrings.- Parameters:
source
- the String to splitdelimiters
- the delimiters to split attrim
- flag to indicate if leading and trailing whitespaces should be omittedincludeDelimiters
- flag to indicate if the delimiters should be included as well- Returns:
- the List of splitted Substrings
-
doDecoration
Processes a HTML string and adds text decorations according to the decoration configuration.- Parameters:
html
- a string holding the HTML code that should be added with text decorationsencoding
- the encoding to be used- Returns:
- a HTML string with the decorations added.
- Throws:
Exception
- if something goes wrong
-
resetDecorationDefinitions
Resets the first occurance flags of all decoration objects.This is nescessary if decoration objects should be used for processing more than once. *
-
visitStringNode
Description copied from interface:I_CmsHtmlNodeVisitor
Visitor method (callback) invoked when a remark Tag (HTML comment) is encountered.- Specified by:
visitStringNode
in interfaceI_CmsHtmlNodeVisitor
- Overrides:
visitStringNode
in classCmsHtmlParser
- Parameters:
text
- the text that is visited.- See Also:
-
NodeVisitor.visitStringNode(org.htmlparser.Text)
-
visitTag
Description copied from interface:I_CmsHtmlNodeVisitor
Visitor method (callback) invoked when a starting Tag (HTML comment) is encountered.- Specified by:
visitTag
in interfaceI_CmsHtmlNodeVisitor
- Overrides:
visitTag
in classCmsHtmlParser
- Parameters:
tag
- the tag that is visited.- See Also:
-
NodeVisitor.visitTag(org.htmlparser.Tag)
-