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 TappendWithNoWrap(java.lang.CharSequence text)Append text from the given builder.static HtmlTextBuildercreateHtmlTextBuilderPreferLightHtml()Creates and instance of builder which outputs light html if full html was not appended.protected voidpreferLightHtml(HtmlTextBuilder builder)TprependWithNoWrap(java.lang.CharSequence plainText)Add text to the beginning.java.lang.StringreplaceSpaceToNbsp(java.lang.String text)protected java.lang.StringtoAppendableText(java.lang.String text)java.lang.StringtoPlainText()java.lang.StringtoString()-
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:
toAppendableTextin classAbstractTextBuilder<T extends HtmlTextBuilder>
-
prependWithNoWrap
public T prependWithNoWrap(java.lang.CharSequence plainText)
Description copied from interface:TextBuilderAdd 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:TextBuilderAppend 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:
toStringin interfaceTextBuilder<T extends HtmlTextBuilder>- Overrides:
toStringin 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)
-
-