public class HorizAlignTextBuilderImpl extends Object implements HorizAlignTextBuilder
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
HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B extends HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<B>>, HorizAlignTextModeAccessor.HorizAlignTextModeMutator, HorizAlignTextModeAccessor.HorizAlignTextModeProperty
Constructor and Description |
---|
HorizAlignTextBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 |
setText(String... aText)
Sets the text for the text property.
|
protected static String[] |
toAlign(String[] aText,
int aLength,
char aFillChar,
HorizAlignTextMode aHorizAlignTextMode) |
protected static String |
toAlign(String aText,
int aLength,
char aFillChar,
HorizAlignTextMode aHorizAlignTextMode)
Fills a text up on by appending the given char to the left and the right
till the given length is reached.
|
protected static String |
toAlignBlock(String aText,
int aLength,
char aFillChar)
Fills a text up on by adding the given char to occurrences of the given
char round robin till given length is reached (block mode).
|
protected static String |
toAlignCenter(String aText,
int aLength,
char aFillChar)
Fills a text up on by appending the given char to the left and the right
till the given length is reached (align center).
|
protected static String |
toAlignLeft(String aText,
int aLength,
char aFillChar)
Fills a text up on by appending the given char to the right till the
given length is reached (align left).
|
protected static String |
toAlignRight(String aText,
int aLength,
char aFillChar)
Fills a text up by prepending the given char to the left till the given
length is reached (align right).
|
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...) |
HorizAlignTextBuilder |
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
withFillChar, withHorizAlignTextMode
getText
setText, setText
withText
public HorizAlignTextBuilder withColumnWidth(int aColumnWidth)
withColumnWidth
in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<HorizAlignTextBuilder>
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)
HorizAlignTextModeAccessor.HorizAlignTextModeMutator
setHorizAlignTextMode
in interface HorizAlignTextModeAccessor.HorizAlignTextModeMutator
aHorizAlignTextMode
- The horizontal align text mode to be
stored by the font style property.public HorizAlignTextMode getHorizAlignTextMode()
HorizAlignTextModeAccessor
getHorizAlignTextMode
in interface HorizAlignTextModeAccessor
public char getFillChar()
HorizAlignTextBuilder
getFillChar
in interface HorizAlignTextBuilder
public void setFillChar(char aFillChar)
HorizAlignTextBuilder
setFillChar
in interface HorizAlignTextBuilder
aFillChar
- The fill char to be stored by the align text mode
property.public String[] toStrings()
Text
String
s being build by the builder upon the settings of the
attributes.toStrings
in interface Text<HorizAlignTextBuilder>
String
arraypublic String[] toStrings(String... aText)
Text
Text.withText(String...)
followed by Text.toStrings()
.
Implementation requirements: This method must not(!) be implemented by
calling Text.withText(String...)
followed by Text.toStrings()
(do
not change the text property) as this would not be thread safe!toStrings
in interface Text<HorizAlignTextBuilder>
aText
- The text to be processed.String
arrayprotected static String toAlign(String aText, int aLength, char aFillChar, HorizAlignTextMode aHorizAlignTextMode)
aText
- The text to be filled up or aligned.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled up with the given char till the width is
reached or the String
untouched in case no
HorizAlignTextMode
parameter has been provided..protected static String toAlignLeft(String aText, int aLength, char aFillChar)
aText
- The text to be filled up.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled up on the right hand side with the given
char.protected static String toAlignRight(String aText, int aLength, char aFillChar)
aText
- The text to be filled up.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled up on the left hand side with the given
char.protected static String toAlignCenter(String aText, int aLength, char aFillChar)
aText
- The text to be filled up.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled up on the left and right hand side with
the given char.protected static String toAlignBlock(String aText, int aLength, char aFillChar)
aText
- The text to be filled up.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled up in block mode with the given char.protected static String[] toAlign(String[] aText, int aLength, char aFillChar, HorizAlignTextMode aHorizAlignTextMode)
except applied to
{@link String} arrays.
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()
public String toString(String... aText)
Text
Text.withText(String...)
followed by Text.toString()
.
Implementation requirements: This method must not(!) be implemented by
calling Text.withText(String...)
followed by Text.toString()
(do
not change the text property) as this would not be thread safe!Copyright © 2016. All rights reserved.