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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
appendColor
(String text) static ColoredHtmlTextBuilder
Creates and instance of builder which outputs light html if full html was not appended.boolean
protected String
prependColor
(String text) Set color of the text which will be added later.void
setText
(CharSequence text) Replace current text with the given onetoString()
Methods inherited from class com.nomagic.text.builders.HtmlTextBuilder
appendWithNoWrap, createHtmlTextBuilderPreferLightHtml, preferLightHtml, prependWithNoWrap, replaceSpaceToNbsp, toAppendableText, toPlainText
Methods inherited from class com.nomagic.text.builders.AbstractTextBuilder
append, appendToText, isTextAdded, prepend, prependToText, replaceText, 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, appendWithSpace, appendWithSpace, compress, isPlainTextEmpty, prepend, setText
-
Constructor Details
-
ColoredHtmlTextBuilder
public ColoredHtmlTextBuilder()
-
-
Method Details
-
setColor
Description copied from interface:TextBuilder
Set 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:
appendColor
in classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
prependColor
- Overrides:
prependColor
in classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
setText
Description copied from interface:TextBuilder
Replace current text with the given one- Specified by:
setText
in interfaceTextBuilder<T extends ColoredHtmlTextBuilder>
- Overrides:
setText
in classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
- Parameters:
text
- text
-
toString
- Specified by:
toString
in interfaceTextBuilder<T extends ColoredHtmlTextBuilder>
- Overrides:
toString
in 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
-