org.opencms.jsp.decorator
Class CmsHtmlDecorator

java.lang.Object
  extended byorg.htmlparser.visitors.NodeVisitor
      extended byorg.opencms.util.CmsHtmlParser
          extended byorg.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 CmsDecoratorConfiguration to process the text decorations.

Since:
6.1.3
Version:
$Revision: 1.6 $
Author:
Michael Emmerich

Field Summary
 
Fields inherited from class org.opencms.util.CmsHtmlParser
m_echo, m_noAutoCloseTags, m_result, TAG_ARRAY, TAG_LIST
 
Constructor Summary
CmsHtmlDecorator(CmsDecoratorConfiguration config)
          Constructor, creates a new CmsHtmlDecorator with a given configuration.
CmsHtmlDecorator(CmsObject cms)
          Constructor, creates a new, empty CmsHtmlDecorator.
 
Method Summary
 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 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
 
Methods inherited from class org.htmlparser.visitors.NodeVisitor
beginParsing, finishedParsing, shouldRecurseChildren, shouldRecurseSelf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsHtmlDecorator

public CmsHtmlDecorator(CmsDecoratorConfiguration config)
Constructor, creates a new CmsHtmlDecorator with a given configuration.

Parameters:
config - the configuration to be used

CmsHtmlDecorator

public CmsHtmlDecorator(CmsObject cms)
Constructor, creates a new, empty CmsHtmlDecorator.

Parameters:
cms - the CmsObject
Method Detail

splitAsList

public static java.util.List 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 split
delimiters - the delimiters to split at
trim - flag to indicate if leading and trailing whitespaces should be omitted
includeDelimiters - 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 decorations
encoding - 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 interface I_CmsHtmlNodeVisitor
Overrides:
visitStringNode in class CmsHtmlParser
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 interface I_CmsHtmlNodeVisitor
Overrides:
visitTag in class CmsHtmlParser
See Also:
NodeVisitor.visitTag(org.htmlparser.Tag)