org.refcodes.mixin.ColumnWidthAccessor
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<TextBlockBuilder>
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
, FillCharAccessor
, FillCharAccessor.FillCharBuilder<TextBlockBuilder>
, FillCharAccessor.FillCharMutator
, FillCharAccessor.FillCharProperty
, HorizAlignTextModeAccessor
, HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<TextBlockBuilder>
, HorizAlignTextModeAccessor.HorizAlignTextModeMutator
, HorizAlignTextModeAccessor.HorizAlignTextModeProperty
, Text<TextBlockBuilder>
, TextAccessor
, TextAccessor.TextBuilder<TextBlockBuilder>
, TextAccessor.TextMutator
, TextAccessor.TextProperty
, TextAccessor.TextProvider
public class TextBlockBuilder extends Object implements FillCharAccessor.FillCharProperty, FillCharAccessor.FillCharBuilder<TextBlockBuilder>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<TextBlockBuilder>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty, Text<TextBlockBuilder>, HorizAlignTextModeAccessor.HorizAlignTextModeProperty, HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<TextBlockBuilder>
HorizAlignTextMode
or the SplitTextMode
can be configured as
well as the desired column width (as of setColumnWidth(int)
).org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
FillCharAccessor.FillCharBuilder<B extends FillCharAccessor.FillCharBuilder<B>>, FillCharAccessor.FillCharMutator, FillCharAccessor.FillCharProperty
HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B extends HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B>>, HorizAlignTextModeAccessor.HorizAlignTextModeMutator, HorizAlignTextModeAccessor.HorizAlignTextModeProperty
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
Modifier and Type | Field | Description |
---|---|---|
static String |
LINE_BREAKS |
Characters indicating a line break when found inside a
String . |
Constructor | Description |
---|---|
TextBlockBuilder() |
Modifier and Type | Method | Description |
---|---|---|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
SplitTextMode aSplitTextMode,
char aFillChar) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
SplitTextMode aSplitTextMode,
char aFillChar,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
SplitTextMode aSplitTextMode) |
|
static String[] |
asTextBlock(String[] aText,
int aColumnWidth,
SplitTextMode aSplitTextMode,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
SplitTextMode aSplitTextMode,
char aFillChar) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
HorizAlignTextMode aHorizAlignTextMode,
SplitTextMode aSplitTextMode,
char aFillChar,
boolean hasAnsiEscapeCodes) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
SplitTextMode aSplitTextMode) |
|
static String[] |
asTextBlock(String aText,
int aColumnWidth,
SplitTextMode aSplitTextMode,
boolean hasAnsiEscapeCodes) |
|
int |
getColumnWidth() |
|
char |
getFillChar() |
Retrieves the fill char from the fill char property.
|
HorizAlignTextMode |
getHorizAlignTextMode() |
Retrieves the horizontal align text mode from the horizontal align text
mode property.
|
SplitTextMode |
getSplitTextMode() |
Retrieves the split text mode from the split text mode property.
|
String[] |
getText() |
Retrieves the text from the text property.
|
void |
setColumnWidth(int aColumnWidth) |
|
void |
setFillChar(char aFillChar) |
Sets the fill char for the fill char property.
|
void |
setHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode) |
Sets the horizontal align text mode for the horizontal align text
mode property.
|
void |
setSplitTextMode(SplitTextMode aSplitTextMode) |
Sets the split text mode for the split text mode property.
|
void |
setText(String... aText) |
Sets the text for the text property.
|
String |
toString() |
The
String being build by the builder upon the settings of
the attributes. |
String |
toString(String... aText) |
Race condition safe shortcut for using
Text.withText(String...)
followed by TextAccessor.TextProvider.toString() . |
String[] |
toStrings() |
The
String s being build by the builder upon the settings of
the attributes. |
String[] |
toStrings(String... aText) |
Race condition safe shortcut for using
Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings() . |
TextBlockBuilder |
withColumnWidth(int aColumnWidth) |
|
TextBlockBuilder |
withFillChar(char aFillChar) |
Sets the fill char for the fill char property.
|
TextBlockBuilder |
withHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode) |
Sets the align text mode for the align text mode property.
|
TextBlockBuilder |
withSplitTextMode(SplitTextMode aSplitTextMode) |
Sets the split text mode for the split text mode property.
|
B |
withText(String... aText) |
With text.
|
B |
withText(Collection<String> aText) |
With text.
|
letColumnWidth
letFillChar
letHorizAlignTextMode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getText
withText
setText, setText
letText, letText
toString
public char getFillChar()
getFillChar
in interface FillCharAccessor
public void setFillChar(char aFillChar)
setFillChar
in interface FillCharAccessor.FillCharMutator
aFillChar
- The fill char to be stored by the fill char
property.public TextBlockBuilder withColumnWidth(int aColumnWidth)
withColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<TextBlockBuilder>
public void setColumnWidth(int aColumnWidth)
setColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
public int getColumnWidth()
getColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor
public void setHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
setHorizAlignTextMode
in interface HorizAlignTextModeAccessor.HorizAlignTextModeMutator
aHorizAlignTextMode
- The horizontal align text mode to be
stored by the font style property.public HorizAlignTextMode getHorizAlignTextMode()
getHorizAlignTextMode
in interface HorizAlignTextModeAccessor
public SplitTextMode getSplitTextMode()
public void setSplitTextMode(SplitTextMode aSplitTextMode)
aSplitTextMode
- The split text mode to be stored by the align text
mode property.public String[] toStrings()
String
s being build by the builder upon the settings of
the attributes.toStrings
in interface TextAccessor.TextProvider
String
arraypublic String[] toStrings(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
. Implementation requirements: This
method must not(!) be implemented by calling Text.withText(String...)
followed by TextAccessor.TextProvider.toStrings()
(do not change the text property) as
this would not be thread safe!toStrings
in interface Text<TextBlockBuilder>
aText
- The text to be processed.String
arraypublic TextBlockBuilder withHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
withHorizAlignTextMode
in interface HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<TextBlockBuilder>
aHorizAlignTextMode
- The align text mode to be stored by the align
text mode property.public TextBlockBuilder withFillChar(char aFillChar)
withFillChar
in interface FillCharAccessor.FillCharBuilder<TextBlockBuilder>
aFillChar
- The fill char to be stored by the fill char
property.public TextBlockBuilder withSplitTextMode(SplitTextMode aSplitTextMode)
aSplitTextMode
- The split text mode to be stored by the align text
mode property.public static String[] asTextBlock(String aText, int aColumnWidth, SplitTextMode aSplitTextMode)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, SplitTextMode aSplitTextMode, char aFillChar)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).aFillChar
- The fill char to be used when filling up the
String
.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, SplitTextMode aSplitTextMode)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, SplitTextMode aSplitTextMode, char aFillChar)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned. It is assumed that the text does not contain any ANSI escape
codes, else use the according method with the ANSI escape code flag.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).aFillChar
- The fill char to be used when filling up the
String
.String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, boolean hasAnsiEscapeCodes)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, SplitTextMode aSplitTextMode, boolean hasAnsiEscapeCodes)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, boolean hasAnsiEscapeCodes)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, SplitTextMode aSplitTextMode, char aFillChar, boolean hasAnsiEscapeCodes)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).aFillChar
- The fill char to be used when filling up the
String
.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, boolean hasAnsiEscapeCodes)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, SplitTextMode aSplitTextMode, boolean hasAnsiEscapeCodes)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, boolean hasAnsiEscapeCodes)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public static String[] asTextBlock(String[] aText, int aColumnWidth, HorizAlignTextMode aHorizAlignTextMode, SplitTextMode aSplitTextMode, char aFillChar, boolean hasAnsiEscapeCodes)
String
array into subString
instances with the
maximum given length. The array of the resulting String
instances
is returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aColumnWidth
- The maximum length of a line returned in the
String
array.aHorizAlignTextMode
- The HorizAlignTextMode
specifies on
how a line is to be aligned in the result.aSplitTextMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( SplitTextMode.AT_END_OF_LINE
), preferably reckoning
the spaces (SplitTextMode.AT_SPACE
) or exactly reckoning a
given width (SplitTextMode.AT_FIXED_WIDTH
).aFillChar
- The fill char to be used when filling up the
String
.hasAnsiEscapeCodes
- Whether to take any (non printable) ANSI escape
codes into account which would, when not being considered, cause
wrong results.String
array with the subString
instances.public String[] getText()
getText
in interface TextAccessor
public void setText(String... aText)
setText
in interface TextAccessor.TextMutator
aText
- The text to be stored by the text property.public B withText(String... aText)
public B withText(Collection<String> aText)
withText
in interface TextAccessor.TextBuilder<B extends Text<B>>
aText
- the textpublic String toString()
String
being build by the builder upon the settings of
the attributes. In case more then one line has been set as input and
the functionality of the builder is applied to each line in separate,
then this method returns all of them lines concatenated with a line
break between each of them (implementation depended).toString
in interface TextAccessor.TextProvider
toString
in class Object
String
public String toString(String... aText)
Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
. Implementation requirements: This method
must not(!) be implemented by calling Text.withText(String...)
followed by TextAccessor.TextProvider.toString()
(do not change the text property) as this
would not be thread safe!Copyright © 2021. All rights reserved.