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.
-
-
Field Summary
Fields Modifier and Type Field Description private com.nomagic.text.builders.ColorBuilder
colorBuilder
-
Constructor Summary
Constructors Constructor Description ColoredHtmlTextBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
appendColor(java.lang.String text)
static ColoredHtmlTextBuilder
createColoredHtmlTextBuilderPreferLightHtml()
Creates and instance of builder which outputs light html if full html was not appended.boolean
isColorSupported()
protected java.lang.String
prependColor(java.lang.String text)
T
setColor(java.awt.Color color)
Set color of the text which will be added later.void
setText(java.lang.CharSequence text)
Replace current text with the given onejava.lang.String
toString()
-
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, compress, isPlainTextEmpty, prepend, setText
-
-
-
-
Method Detail
-
setColor
public T setColor(@CheckForNull java.awt.Color color)
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
protected java.lang.String appendColor(java.lang.String text)
- Overrides:
appendColor
in classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
prependColor
protected java.lang.String prependColor(java.lang.String text)
- Overrides:
prependColor
in classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
setText
public void setText(java.lang.CharSequence text)
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
public java.lang.String 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
public static ColoredHtmlTextBuilder createColoredHtmlTextBuilderPreferLightHtml()
Creates and instance of builder which outputs light html if full html was not appended.- Returns:
- builder
-
-