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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringappendColor(String text) voidcompress(int textLength) Compress current text to the given length.booleanprotected StringprependColor(String text) Set the 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.RichTextBuilder
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, appendWithNoWrap, appendWithSpace, appendWithSpace, isPlainTextEmpty, prepend, prependWithNoWrap, setText
-
Constructor Details
-
ColoredRichTextBuilder
public ColoredRichTextBuilder()
-
-
Method Details
-
setColor
Description copied from interface:TextBuilderSet the 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:TextBuilderCompress current text to the given length. This function is not supported in every implementation, so it can be ignored.- Specified by:
compressin interfaceTextBuilder<T extends ColoredRichTextBuilder>- Overrides:
compressin classRichTextBuilder<T extends ColoredRichTextBuilder>- Parameters:
textLength- text length
-
appendColor
- Overrides:
appendColorin classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
prependColor
- Overrides:
prependColorin classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
setText
Description copied from interface:TextBuilderReplace current text with the given one- Specified by:
setTextin interfaceTextBuilder<T extends ColoredRichTextBuilder>- Overrides:
setTextin classAbstractTextBuilder<T extends ColoredRichTextBuilder>- Parameters:
text- text
-
toString
- Specified by:
toStringin interfaceTextBuilder<T extends ColoredRichTextBuilder>- Overrides:
toStringin classAbstractTextBuilder<T extends ColoredRichTextBuilder>- Returns:
- result string
-
isColorSupported
public boolean isColorSupported()- Returns:
- true if builder supports color
-