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.
-
-
Field Summary
Fields Modifier and Type Field Description private com.nomagic.text.builders.ColorBuildercolorBuilder
-
Constructor Summary
Constructors Constructor Description ColoredRichTextBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringappendColor(java.lang.String text)voidcompress(int textLength)Compress current text to the given length.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.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: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
-
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
protected java.lang.String appendColor(java.lang.String text)
- Overrides:
appendColorin classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
prependColor
protected java.lang.String prependColor(java.lang.String text)
- Overrides:
prependColorin classAbstractTextBuilder<T extends ColoredRichTextBuilder>
-
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 ColoredRichTextBuilder>- Overrides:
setTextin classAbstractTextBuilder<T extends ColoredRichTextBuilder>- Parameters:
text- text
-
toString
public java.lang.String 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
-
-