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 Constructor Description ColoredRichTextBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
appendColor(java.lang.String text)
void
compress(int textLength)
Compress current text to the given length.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.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, isPlainTextEmpty, prepend, prependWithNoWrap, 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
-
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
protected java.lang.String appendColor(java.lang.String text)
- Overrides:
appendColor
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
prependColor
protected java.lang.String prependColor(java.lang.String text)
- Overrides:
prependColor
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
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 ColoredRichTextBuilder>
- Overrides:
setText
in classAbstractTextBuilder<T extends ColoredRichTextBuilder>
- Parameters:
text
- text
-
toString
public java.lang.String 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
-
-