public class TextBlockBuilderImpl extends Object implements TextBlockBuilder
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B extends HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B>>, HorizAlignTextModeAccessor.HorizAlignTextModeMutator, HorizAlignTextModeAccessor.HorizAlignTextModeProperty
Modifier and Type | Field and Description |
---|---|
protected static String |
NO_SINGLE_LINE_CHARS |
Constructor and Description |
---|
TextBlockBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
int |
getColumnWidth() |
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 |
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.
|
protected static String |
toNonBreakingLine(String aText)
Creates a single line by replacing all new lines, line feeds and
tabulators from the given
String by full stops or spaces
(heuristic) so that it is displayed in one single line. |
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...) |
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...) |
protected static String[] |
toTextBlock(String aText,
int aLength)
|
protected static String[] |
toTextBlock(String aText,
int aLength,
HorizAlignTextMode aHorizAlignTextMode)
|
protected static String[] |
toTextBlock(String aText,
int aLength,
HorizAlignTextMode aHorizAlignTextMode,
SplitTextMode aLineSplitMode)
|
protected static String[] |
toTextBlock(String aText,
int aLength,
SplitTextMode aLineSplitMode)
|
TextBlockBuilder |
withColumnWidth(int aColumnWidth) |
B |
withText(Collection<String> aText)
With text.
|
B |
withText(String... aText)
With text.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
withHorizAlignTextMode, withSplitTextMode
getText
setText, setText
withText
toString
protected static final String NO_SINGLE_LINE_CHARS
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()
getSplitTextMode
in interface TextBlockBuilder
public void setSplitTextMode(SplitTextMode aSplitTextMode)
setSplitTextMode
in interface TextBlockBuilder
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
arrayprotected static String[] toTextBlock(String aText, int aLength, SplitTextMode aLineSplitMode)
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).aLength
- The maximum length of a line returned in the
String
array.aLineSplitMode
- 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.protected static String[] toTextBlock(String aText, int aLength, HorizAlignTextMode aHorizAlignTextMode)
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).aLength
- 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.protected static String[] toTextBlock(String aText, int aLength, HorizAlignTextMode aHorizAlignTextMode, SplitTextMode aLineSplitMode)
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).aLength
- 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.aLineSplitMode
- 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.protected static String toNonBreakingLine(String aText)
String
by full stops or spaces
(heuristic) so that it is displayed in one single line.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<Text<B extends Text<B>>>
aText
- the a 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 © 2017. All rights reserved.