Package com.nomagic.text.builders
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 Summary
Constructors Constructor Description HtmlTextBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
appendWithNoWrap(java.lang.CharSequence text)
Append text from the given builder.static HtmlTextBuilder
createHtmlTextBuilderPreferLightHtml()
Creates and instance of builder which outputs light html if full html was not appended.protected void
preferLightHtml(HtmlTextBuilder builder)
T
prependWithNoWrap(java.lang.CharSequence plainText)
Add text to the beginning.java.lang.String
replaceSpaceToNbsp(java.lang.String text)
protected java.lang.String
toAppendableText(java.lang.String text)
java.lang.String
toPlainText()
java.lang.String
toString()
-
Methods inherited from class com.nomagic.text.builders.AbstractTextBuilder
append, appendColor, appendToText, isTextAdded, prepend, prependColor, prependToText, replaceText, setText, textLength
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.nomagic.text.builders.TextBuilder
append, compress, isColorSupported, isPlainTextEmpty, prepend, setColor, setText
-
-
-
-
Method Detail
-
toAppendableText
protected java.lang.String toAppendableText(java.lang.String text)
- Overrides:
toAppendableText
in classAbstractTextBuilder<T extends HtmlTextBuilder>
-
prependWithNoWrap
public T prependWithNoWrap(java.lang.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(java.lang.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 java.lang.String replaceSpaceToNbsp(java.lang.String text)
-
toPlainText
public java.lang.String toPlainText()
- Returns:
- result string as plain text
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfaceTextBuilder<T extends HtmlTextBuilder>
- Overrides:
toString
in classAbstractTextBuilder<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)
-
-