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
public class CmsHtmlDecorator extends CmsHtmlParser
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
Constructors Constructor Description CmsHtmlDecorator(CmsObject cms)
Constructor, creates a new, empty CmsHtmlDecorator.CmsHtmlDecorator(CmsObject cms, I_CmsDecoratorConfiguration config)
Constructor, creates a new CmsHtmlDecorator with a given configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
doDecoration(java.lang.String html, java.lang.String encoding)
Processes a HTML string and adds text decorations according to the decoration configuration.void
resetDecorationDefinitions()
Resets the first occurance flags of all decoration objects.static java.util.List<java.lang.String>
splitAsList(java.lang.String source, java.lang.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
-
-
-
-
Constructor Detail
-
CmsHtmlDecorator
public CmsHtmlDecorator(CmsObject cms) throws CmsException
Constructor, creates a new, empty CmsHtmlDecorator.- Parameters:
cms
- the CmsObject- Throws:
CmsException
- if something goes wrong
-
CmsHtmlDecorator
public CmsHtmlDecorator(CmsObject cms, I_CmsDecoratorConfiguration config)
Constructor, creates a new CmsHtmlDecorator with a given configuration.- Parameters:
cms
- the CmsObjectconfig
- the configuration to be used
-
-
Method Detail
-
splitAsList
public static java.util.List<java.lang.String> splitAsList(java.lang.String source, java.lang.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
public java.lang.String doDecoration(java.lang.String html, java.lang.String encoding) throws java.lang.Exception
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:
java.lang.Exception
- if something goes wrong
-
resetDecorationDefinitions
public void 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
public void visitStringNode(org.htmlparser.Text text)
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
public void visitTag(org.htmlparser.Tag tag)
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)
-
-