Module tvbrowser
Package util.ui.html

Class HTMLTextHelper


  • public class HTMLTextHelper
    extends java.lang.Object
    This is a Helper-Class for converting Text to HMTL
    Since:
    2.1
    Author:
    bodum
    • Constructor Summary

      Constructors 
      Constructor Description
      HTMLTextHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String checkTextForTextFormatingTags​(java.lang.String text)
      Checks a text for containing html text formating and div tags and adds missing html tag at start and end of the text.
      static java.lang.String convertHtmlToText​(java.lang.String html)
      Replaces HTML German umlauts and the HTML formatting tags with a Java String.
      static java.lang.String convertTextToHtml​(java.lang.String text)
      Convert Text to HTML.
      static java.lang.String convertTextToHtml​(java.lang.String text, boolean createLinks)
      Convert Text to HTML.
      static java.lang.String getCssRgbColorEntry​(java.awt.Color c)
      Creates a rgb color entry for css format.
      static java.lang.String getLink​(int pos, javax.swing.JEditorPane html)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTMLTextHelper

        public HTMLTextHelper()
    • Method Detail

      • convertTextToHtml

        public static java.lang.String convertTextToHtml​(java.lang.String text)
        Convert Text to HTML. > and < will be converted to &gt; and &lt; \n will be <br> Links in the text will be made clickable.
        Parameters:
        text - text to display
        Returns:
        Result
        Since:
        2.7
      • convertTextToHtml

        public static java.lang.String convertTextToHtml​(java.lang.String text,
                                                         boolean createLinks)
        Convert Text to HTML. > and < will be converted to &gt; and &lt; \n will be <br> If createLinks is true, it will try to find links and make them clickable
        Parameters:
        text - text to display
        createLinks - if true, it will create links
        Returns:
        Result
      • convertHtmlToText

        public static java.lang.String convertHtmlToText​(java.lang.String html)
        Replaces HTML German umlauts and the HTML formatting tags with a Java String.
        Parameters:
        html - The HTML text to replace.
        Returns:
        The text with the replaced Strings.
        Since:
        2.7
      • getCssRgbColorEntry

        public static java.lang.String getCssRgbColorEntry​(java.awt.Color c)
        Creates a rgb color entry for css format.

        Parameters:
        c - The color to get the css entry for
        Returns:
        The css entry color.
        Since:
        3.1
      • getLink

        public static java.lang.String getLink​(int pos,
                                               javax.swing.JEditorPane html)
      • checkTextForTextFormatingTags

        public static java.lang.String checkTextForTextFormatingTags​(java.lang.String text)
        Checks a text for containing html text formating and div tags and adds missing html tag at start and end of the text.

        Parameters:
        text - The text to check.
        Returns:
        A text with html tags at start and end if text contains text formating tags, a plain text otherwise.
        Since:
        4.1