Package com.nomagic.text.builders
Class RawTextBuilder<T extends RawTextBuilder>
- java.lang.Object
 - 
- com.nomagic.text.builders.RawTextBuilder<T>
 
 
- 
- All Implemented Interfaces:
 TextBuilder<T>
@OpenApiAll public class RawTextBuilder<T extends RawTextBuilder> extends java.lang.Object implements TextBuilder<T>
Builds a text without any transformation - input text is appended to the output text. Builder does not support colored fragments directly - result text does not have colors. However colors are be supported ifappendTo(TextBuilder)is used and proper builder is passed. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRawTextBuilder.TextFragment 
- 
Field Summary
Fields Modifier and Type Field Description private java.awt.Colorcolorprivate java.util.List<RawTextBuilder.TextFragment>text 
- 
Constructor Summary
Constructors Constructor Description RawTextBuilder() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tappend(java.lang.CharSequence text)Append given textvoidappendTo(TextBuilder builder)Appends text from this builder to the given one.booleanisColorSupported()booleanisTextAdded()Tprepend(java.lang.CharSequence text)Add given text to the beginning.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.StringtoPlainText()java.lang.StringtoString()- 
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, compress, isPlainTextEmpty, prepend, prependWithNoWrap, setText 
 - 
 
 - 
 
- 
- 
Field Detail
- 
text
private final java.util.List<RawTextBuilder.TextFragment> text
 
- 
color
@CheckForNull private java.awt.Color color
 
 - 
 
- 
Method Detail
- 
append
public T append(java.lang.CharSequence text)
Description copied from interface:TextBuilderAppend given text- Specified by:
 appendin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
 text- text to append- Returns:
 - this builder
 
 
- 
prepend
public T prepend(java.lang.CharSequence text)
Description copied from interface:TextBuilderAdd given text to the beginning.- Specified by:
 prependin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
 text- text to append- Returns:
 - this builder
 
 
- 
toString
public java.lang.String toString()
- Specified by:
 toStringin interfaceTextBuilder<T extends RawTextBuilder>- Overrides:
 toStringin classjava.lang.Object- Returns:
 - result string
 
 
- 
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 RawTextBuilder>- Parameters:
 text- text
 
- 
toPlainText
public java.lang.String toPlainText()
- Specified by:
 toPlainTextin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
 - result string as plain text
 
 
- 
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.- Specified by:
 setColorin interfaceTextBuilder<T extends RawTextBuilder>- Parameters:
 color- color to set. Null is used to reset previously set color- Returns:
 - this builder
 
 
- 
isColorSupported
public boolean isColorSupported()
- Specified by:
 isColorSupportedin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
 - true if builder supports color
 
 
- 
appendTo
public void appendTo(TextBuilder builder)
Appends text from this builder to the given one.- Parameters:
 builder- given builder
 
- 
isTextAdded
public boolean isTextAdded()
- Specified by:
 isTextAddedin interfaceTextBuilder<T extends RawTextBuilder>- Returns:
 - true if at least one text fragment was added (even if fragment is empty)
 
 
 - 
 
 -