Class HtmlTextBuilder<T extends HtmlTextBuilder>

java.lang.Object
com.nomagic.text.builders.AbstractTextBuilder<T>
com.nomagic.text.builders.HtmlTextBuilder<T>
All Implemented Interfaces:
TextBuilder<T>
Direct Known Subclasses:
ColoredHtmlTextBuilder

@OpenApiAll public class HtmlTextBuilder<T extends HtmlTextBuilder> extends AbstractTextBuilder<T>
A builder used for html text building. Plain or rich text fragments will be transformed to html text. Colored fragments are not supported.
  • Constructor Details

    • HtmlTextBuilder

      public HtmlTextBuilder()
  • Method Details

    • toAppendableText

      protected String toAppendableText(String text)
      Overrides:
      toAppendableText in class AbstractTextBuilder<T extends HtmlTextBuilder>
    • prependWithNoWrap

      public T prependWithNoWrap(CharSequence plainText)
      Description copied from interface: TextBuilder
      Add text to the beginning. Added text will not be wrapped if builder supports that.
      Parameters:
      plainText - text to prepend
      Returns:
      this builder
    • appendWithNoWrap

      public T appendWithNoWrap(CharSequence text)
      Description copied from interface: TextBuilder
      Append text from the given builder. Added text will not be wrapped if builder supports that.
      Parameters:
      text - text to prepend
      Returns:
      this builder
    • replaceSpaceToNbsp

      public String replaceSpaceToNbsp(String text)
    • toPlainText

      public String toPlainText()
      Returns:
      result string as plain text
    • toString

      public String toString()
      Specified by:
      toString in interface TextBuilder<T extends HtmlTextBuilder>
      Overrides:
      toString in class AbstractTextBuilder<T extends HtmlTextBuilder>
      Returns:
      result string
    • createHtmlTextBuilderPreferLightHtml

      public static HtmlTextBuilder createHtmlTextBuilderPreferLightHtml()
      Creates and instance of builder which outputs light html if full html was not appended.
      Returns:
      builder
    • preferLightHtml

      protected void preferLightHtml(HtmlTextBuilder builder)