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 Constructor Description ColoredHtmlTextBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringappendColor(java.lang.String text)static ColoredHtmlTextBuildercreateColoredHtmlTextBuilderPreferLightHtml()Creates and instance of builder which outputs light html if full html was not appended.booleanisColorSupported()protected java.lang.StringprependColor(java.lang.String text)TsetColor(java.awt.Color color)Set color of the text which will be added later.voidsetText(java.lang.CharSequence text)Replace current text with the given onejava.lang.StringtoString()-
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: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
protected java.lang.String appendColor(java.lang.String text)
- Overrides:
appendColorin classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
prependColor
protected java.lang.String prependColor(java.lang.String text)
- Overrides:
prependColorin classAbstractTextBuilder<T extends ColoredHtmlTextBuilder>
-
setText
public void setText(java.lang.CharSequence text)
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
public java.lang.String 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
public static ColoredHtmlTextBuilder createColoredHtmlTextBuilderPreferLightHtml()
Creates and instance of builder which outputs light html if full html was not appended.- Returns:
- builder
-
-