public class MoreTextBuilderImpl extends Object implements MoreTextBuilder
MoreTextBuilder
;.TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
Constructor and Description |
---|
MoreTextBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
int |
getColumnWidth() |
String |
getMoreText()
Retrieves the more text from the more text property.
|
MoreTextMode |
getMoreTextMode()
Retrieves the more text mode from the more text mode property.
|
String[] |
getText()
Retrieves the text from the text property.
|
void |
setColumnWidth(int aColumnWidth) |
void |
setMoreText(String aMoreText)
Sets the more text for the more text property.
|
void |
setMoreTextMode(MoreTextMode aMoreTextMode)
Sets the more text mode for the more text mode property.
|
void |
setText(String... aText)
Sets the text for the text property.
|
protected static String[] |
toMore(String[] aText,
int aLength,
String aMore,
MoreTextMode aMoreTextMode)
To more.
|
protected static String |
toMore(String aText,
int aLength,
String aMore,
MoreTextMode aMoreTextMode)
the text is "mored" depending on the provided
MoreTextMode . |
protected static String |
toMoreCenter(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right and from
right to left one by one to reach the given length.
|
protected static String |
toMoreLeft(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right to reach the
given length.
|
protected static String |
toMoreRight(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right to reach the
given length.
|
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...) |
MoreTextBuilder |
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
toString, withMoreText, withMoreTextMode
getText
setText, setText
withText
public String getMoreText()
getMoreText
in interface MoreTextBuilder
public void setMoreText(String aMoreText)
setMoreText
in interface MoreTextBuilder
aMoreText
- The more text to be stored by the more text mode
property.public int getColumnWidth()
getColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor
public void setColumnWidth(int aColumnWidth)
setColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
public MoreTextBuilder withColumnWidth(int aColumnWidth)
withColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<MoreTextBuilder>
withColumnWidth
in interface MoreTextBuilder
public MoreTextMode getMoreTextMode()
getMoreTextMode
in interface MoreTextBuilder
public void setMoreTextMode(MoreTextMode aMoreTextMode)
setMoreTextMode
in interface MoreTextBuilder
aMoreTextMode
- The more text mode to be stored by the more text
mode property.public String[] toStrings()
String
s being build by the builder upon the settings of the
attributes.toStrings
in interface MoreTextBuilder
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<MoreTextBuilder>
aText
- The text to be processed.String
arrayprotected static String[] toMore(String[] aText, int aLength, String aMore, MoreTextMode aMoreTextMode)
aText
- the a textaLength
- the a lengthaMore
- the a moreaMoreTextMode
- the a more text modeprotected static String toMore(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode)
MoreTextMode
.
In case it is MoreTextMode.NONE
, then the text is returned
untouched. In case it is MoreTextMode.LEFT
, then the text is
"mored" by the toMoreLeft(String, int, String)
method. In case
it is MoreTextMode.RIGHT
, then the text is "mored" by the
toMoreRight(String, int, String)
method.aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.aMoreTextMode
- The MoreTextMode
specifying on how to
truncate the text.protected static String toMoreLeft(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.protected static String toMoreRight(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.protected static String toMoreCenter(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.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 © 2018. All rights reserved.