Package com.nomagic.text.builders
Class ColoredRichTextBuilder<T extends ColoredRichTextBuilder>
java.lang.Object
com.nomagic.text.builders.AbstractTextBuilder<T>
com.nomagic.text.builders.RichTextBuilder<T>
com.nomagic.text.builders.ColoredRichTextBuilder<T>
- All Implemented Interfaces:
TextBuilder<T>
@OpenApiAll
public class ColoredRichTextBuilder<T extends ColoredRichTextBuilder>
extends RichTextBuilder<T>
A builder used for rich text building. Colored fragments are supported.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
appendColor
(String text) void
compress
(int textLength) Compress current text to the given length.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.RichTextBuilder
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, appendWithNoWrap, appendWithSpace, appendWithSpace, isPlainTextEmpty, prepend, prependWithNoWrap, setText
-
Constructor Details
-
ColoredRichTextBuilder
public ColoredRichTextBuilder()
-
-
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
-
compress
public void compress(int textLength) Description copied from interface:TextBuilder
Compress current text to the given length. This function is not supported in every implementation, so it can be ignored.- Specified by:
compress
in interfaceTextBuilder<T extends ColoredRichTextBuilder>
- Overrides:
compress
in classRichTextBuilder<T extends ColoredRichTextBuilder>
- Parameters:
textLength
- text length
-
appendColor
- Overrides:
appendColor
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
prependColor
- Overrides:
prependColor
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
setText
Description copied from interface:TextBuilder
Replace current text with the given one- Specified by:
setText
in interfaceTextBuilder<T extends ColoredRichTextBuilder>
- Overrides:
setText
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
- Parameters:
text
- text
-
toString
- Specified by:
toString
in interfaceTextBuilder<T extends ColoredRichTextBuilder>
- Overrides:
toString
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
- Returns:
- result string
-
isColorSupported
public boolean isColorSupported()- Returns:
- true if builder supports color
-