public class MoreTextBuilderImpl extends Object implements 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) |
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)
Sets the text for the text property.
|
B |
withText(String... aText)
Sets the text for the text property.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
toString, withMoreText, withMoreTextMode
getText
setText, setText
withText
public String getMoreText()
MoreTextBuilder
getMoreText
in interface MoreTextBuilder
public void setMoreText(String aMoreText)
MoreTextBuilder
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>
public MoreTextMode getMoreTextMode()
MoreTextBuilder
getMoreTextMode
in interface MoreTextBuilder
public void setMoreTextMode(MoreTextMode aMoreTextMode)
MoreTextBuilder
setMoreTextMode
in interface MoreTextBuilder
aMoreTextMode
- The more text mode to be stored by the more text
mode property.public String[] toStrings()
MoreTextBuilder
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
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)
protected 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()
TextAccessor
getText
in interface TextAccessor
public void setText(String... aText)
TextAccessor.TextMutator
setText
in interface TextAccessor.TextMutator
aText
- The text to be stored by the text property.public B withText(String... aText)
TextAccessor.TextBuilder
public B withText(Collection<String> aText)
TextAccessor.TextBuilder
withText
in interface TextAccessor.TextBuilder<Text<B extends Text<B>>>
aText
- The text to be stored by the text property.public String toString()
String
being build by the builder upon the settings of the
attributes. The string array is returned as a single String
with
the operating system's end of line marker (CR on on Windows and CR LF on
*nix operating systems) as determined by
SystemUtility.getLineBreak()
toString
in interface TextAccessor.TextProvider
toString
in class Object
String
public String toString(String... aText)
Text
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 © 2016. All rights reserved.