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 CmsDecoratorConfiguration to process the text decorations.

Since:
6.1.3
  • Constructor Details

  • 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 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 String doDecoration(String html, String encoding) throws 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:
      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

      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
      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 interface I_CmsHtmlNodeVisitor
      Overrides:
      visitTag in class CmsHtmlParser
      Parameters:
      tag - the tag that is visited.
      See Also:
      • NodeVisitor.visitTag(org.htmlparser.Tag)