Package com.nomagic.text.builders
Class ColoredHtmlTextBuilder<T extends ColoredHtmlTextBuilder>
java.lang.Object
com.nomagic.text.builders.AbstractTextBuilder<T>
com.nomagic.text.builders.HtmlTextBuilder<T>
com.nomagic.text.builders.ColoredHtmlTextBuilder<T>
- All Implemented Interfaces:
TextBuilder<T>
@OpenApiAll
public class ColoredHtmlTextBuilder<T extends ColoredHtmlTextBuilder>
extends HtmlTextBuilder<T>
A builder used for html text building. Plain or rich text fragments will be transformed to html text. Colored fragments are supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringappendColor(String text) static ColoredHtmlTextBuilderCreates and instance of builder which outputs light html if full html was not appended.booleanprotected StringprependColor(String text) Set color of the text which will be added later.voidsetText(CharSequence text) Replace current text with the given onetoString()Methods inherited from class com.nomagic.text.builders.HtmlTextBuilder
appendWithNoWrap, createHtmlTextBuilderPreferLightHtml, preferLightHtml, prependWithNoWrap, replaceSpaceToNbsp, toAppendableText, toPlainTextMethods inherited from class com.nomagic.text.builders.AbstractTextBuilder
append, appendToText, isTextAdded, prepend, prependToText, replaceText, textLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.nomagic.text.builders.TextBuilder
append, appendWithSpace, appendWithSpace, compress, isPlainTextEmpty, prepend, setText
-
Constructor Details
-
ColoredHtmlTextBuilder
public ColoredHtmlTextBuilder()
-
-
Method Details
-
setColor
Description copied from interface:TextBuilderSet color of the text which will be added later. Not every implementation supports that, so color can be ignored.- Parameters:
color- color to set. Null is used to reset previously set color- Returns:
- this builder
-
appendColor
- Overrides:
appendColorin classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
prependColor
- Overrides:
prependColorin classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
setText
Description copied from interface:TextBuilderReplace current text with the given one- Specified by:
setTextin interfaceTextBuilder<T extends ColoredHtmlTextBuilder>- Overrides:
setTextin classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>- Parameters:
text- text
-
toString
- Specified by:
toStringin interfaceTextBuilder<T extends ColoredHtmlTextBuilder>- Overrides:
toStringin classHtmlTextBuilder<T extends ColoredHtmlTextBuilder>- Returns:
- result string
-
isColorSupported
public boolean isColorSupported()- Returns:
- true if builder supports color
-
createColoredHtmlTextBuilderPreferLightHtml
Creates and instance of builder which outputs light html if full html was not appended.- Returns:
- builder
-