- java.lang.Object
-
- org.refcodes.textual.VertAlignTextBuilder
-
- All Implemented Interfaces:
org.refcodes.mixin.EscapeCodesStatusAccessor
,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<VertAlignTextBuilder>
,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator
,org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty
,org.refcodes.mixin.RowHeightAccessor
,org.refcodes.mixin.RowHeightAccessor.RowHeightBuilder<VertAlignTextBuilder>
,org.refcodes.mixin.RowHeightAccessor.RowHeightMutator
,org.refcodes.mixin.RowHeightAccessor.RowHeightProperty
,Text<VertAlignTextBuilder>
,TextAccessor
,TextAccessor.TextBuilder<Text<VertAlignTextBuilder>>
,TextAccessor.TextMutator
,TextAccessor.TextProperty
,TextAccessor.TextProvider
,VertAlignTextModeAccessor
,VertAlignTextModeAccessor.VertAlignTextModeBuilder<VertAlignTextBuilder>
,VertAlignTextModeAccessor.VertAlignTextModeMutator
,VertAlignTextModeAccessor.VertAlignTextModeProperty
public class VertAlignTextBuilder extends Object implements org.refcodes.mixin.RowHeightAccessor.RowHeightBuilder<VertAlignTextBuilder>, org.refcodes.mixin.RowHeightAccessor.RowHeightProperty, Text<VertAlignTextBuilder>, VertAlignTextModeAccessor.VertAlignTextModeProperty, VertAlignTextModeAccessor.VertAlignTextModeBuilder<VertAlignTextBuilder>, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<VertAlignTextBuilder>
Fills a text up on by appending the given char to the left or to the the right or inbetween till the given length is reached. How the text is aligned depends on the setting of theVertAlignTextMode
attribute.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor
org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<B extends org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<B>>, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator, org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.RowHeightAccessor
org.refcodes.mixin.RowHeightAccessor.RowHeightBuilder<B extends org.refcodes.mixin.RowHeightAccessor.RowHeightBuilder<B>>, org.refcodes.mixin.RowHeightAccessor.RowHeightMutator, org.refcodes.mixin.RowHeightAccessor.RowHeightProperty
-
Nested classes/interfaces inherited from interface org.refcodes.textual.TextAccessor
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
-
Nested classes/interfaces inherited from interface org.refcodes.textual.VertAlignTextModeAccessor
VertAlignTextModeAccessor.VertAlignTextModeBuilder<B extends VertAlignTextModeAccessor.VertAlignTextModeBuilder<B>>, VertAlignTextModeAccessor.VertAlignTextModeMutator, VertAlignTextModeAccessor.VertAlignTextModeProperty
-
-
Constructor Summary
Constructors Constructor Description VertAlignTextBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String[]
asAligned(String[] aTextBlock, int aHeight, char aFillChar, VertAlignTextMode aVertAlignTextMode)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified, .static String[]
asAligned(String[] aTextBlock, int aHeight, char aFillChar, VertAlignTextMode aVertAlignTextMode, boolean isEscCodesEnabled)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified, .static String[]
asAligned(String[] aTextBlock, int aHeight, VertAlignTextMode aVertAlignTextMode)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified.static String[]
asAligned(String[] aTextBlock, int aHeight, VertAlignTextMode aVertAlignTextMode, boolean isEscCodesEnabled)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified.VertAlignTextBuilder
build()
This is a convenience method for easily instantiating the according builder.char
getFillChar()
Retrieves the fill char from the fill char property.int
getRowHeight()
String[]
getText()
Retrieves the text from the text property.VertAlignTextMode
getVertAlignTextMode()
Retrieves the vertical align text mode from the vertical align text mode property.boolean
isEscapeCodesEnabled()
void
setEscapeCodesEnabled(boolean isEscCodesEnabled)
void
setFillChar(char aFillChar)
Sets the fill char for the fill char property.void
setRowHeight(int aRowHeight)
void
setText(String... aText)
Sets the text for the text property.void
setVertAlignTextMode(VertAlignTextMode aVertAlignTextMode)
Sets the vertical align text mode for the vertical align text mode property.String
toString()
TheString
being build by the builder upon the settings of the attributes.String
toString(String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
.String[]
toStrings()
TheString
s being build by the builder upon the settings of the attributes.String[]
toStrings(String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
.VertAlignTextBuilder
withEscapeCodesEnabled(boolean isEscCodesEnabled)
VertAlignTextBuilder
withFillChar(char aFillChar)
Sets the fill char for the fill char property.VertAlignTextBuilder
withRowHeight(int aRowHeight)
B
withText(String... aText)
With text.B
withText(Collection<String> aText)
With text.VertAlignTextBuilder
withVertAlignTextMode(VertAlignTextMode aVertAlignTextMode)
Sets the align text mode for the align text mode property.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusProperty
letEscapeCodesEnabled
-
Methods inherited from interface org.refcodes.mixin.RowHeightAccessor.RowHeightProperty
letRowHeight
-
Methods inherited from interface org.refcodes.textual.TextAccessor
getText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextBuilder
withText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextMutator
setText, setText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProperty
letText, letText
-
Methods inherited from interface org.refcodes.textual.TextAccessor.TextProvider
toString
-
Methods inherited from interface org.refcodes.textual.VertAlignTextModeAccessor.VertAlignTextModeProperty
letVertAlignTextMode
-
-
-
-
Method Detail
-
build
public VertAlignTextBuilder build()
This is a convenience method for easily instantiating the according builder.- Returns:
- an instance (using a default implementation) of this builder
-
getFillChar
public char getFillChar()
Retrieves the fill char from the fill char property.- Returns:
- The fill char stored by the fill char property.
-
getRowHeight
public int getRowHeight()
- Specified by:
getRowHeight
in interfaceorg.refcodes.mixin.RowHeightAccessor
-
getVertAlignTextMode
public VertAlignTextMode getVertAlignTextMode()
Retrieves the vertical align text mode from the vertical align text mode property.- Specified by:
getVertAlignTextMode
in interfaceVertAlignTextModeAccessor
- Returns:
- The vertical align text mode stored by the vertical align text mode property.
-
isEscapeCodesEnabled
public boolean isEscapeCodesEnabled()
- Specified by:
isEscapeCodesEnabled
in interfaceorg.refcodes.mixin.EscapeCodesStatusAccessor
-
setEscapeCodesEnabled
public void setEscapeCodesEnabled(boolean isEscCodesEnabled)
- Specified by:
setEscapeCodesEnabled
in interfaceorg.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator
-
setFillChar
public void setFillChar(char aFillChar)
Sets the fill char for the fill char property.- Parameters:
aFillChar
- The fill char to be stored by the align text mode property.
-
setRowHeight
public void setRowHeight(int aRowHeight)
- Specified by:
setRowHeight
in interfaceorg.refcodes.mixin.RowHeightAccessor.RowHeightMutator
-
setVertAlignTextMode
public void setVertAlignTextMode(VertAlignTextMode aVertAlignTextMode)
Sets the vertical align text mode for the vertical align text mode property.- Specified by:
setVertAlignTextMode
in interfaceVertAlignTextModeAccessor.VertAlignTextModeMutator
- Parameters:
aVertAlignTextMode
- The vertical align text mode to be stored by the font style property.
-
toStrings
public String[] toStrings()
TheString
s being build by the builder upon the settings of the attributes.- Specified by:
toStrings
in interfaceTextAccessor.TextProvider
- Returns:
- The according resulting
String
array
-
toStrings
public String[] toStrings(String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toStrings()
(do not change the text property) as this would not be thread safe!- Specified by:
toStrings
in interfaceText<VertAlignTextBuilder>
- Parameters:
aText
- The text to be processed.- Returns:
- The according resulting
String
array
-
withEscapeCodesEnabled
public VertAlignTextBuilder withEscapeCodesEnabled(boolean isEscCodesEnabled)
- Specified by:
withEscapeCodesEnabled
in interfaceorg.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<VertAlignTextBuilder>
-
withFillChar
public VertAlignTextBuilder withFillChar(char aFillChar)
Sets the fill char for the fill char property.- Parameters:
aFillChar
- The fill char to be stored by the align text mode property.- Returns:
- The builder for applying multiple build operations.
-
withRowHeight
public VertAlignTextBuilder withRowHeight(int aRowHeight)
- Specified by:
withRowHeight
in interfaceorg.refcodes.mixin.RowHeightAccessor.RowHeightBuilder<VertAlignTextBuilder>
-
withVertAlignTextMode
public VertAlignTextBuilder withVertAlignTextMode(VertAlignTextMode aVertAlignTextMode)
Sets the align text mode for the align text mode property.- Specified by:
withVertAlignTextMode
in interfaceVertAlignTextModeAccessor.VertAlignTextModeBuilder<VertAlignTextBuilder>
- Parameters:
aVertAlignTextMode
- The align text mode to be stored by the align text mode property.- Returns:
- The builder for applying multiple build operations.
-
asAligned
public static String[] asAligned(String[] aTextBlock, int aHeight, char aFillChar, VertAlignTextMode aVertAlignTextMode)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified, . When filling up, the provided fill char is used.- Parameters:
aTextBlock
- The text block to be filled up / truncated.aHeight
- The height of the resulting text block.aFillChar
- the fill char to use when filling up.aVertAlignTextMode
- The mode on how to fill up the text block. The mode can beVertAlignTextMode.BOTTOM
,VertAlignTextMode.MIDDLE
orVertAlignTextMode.TOP
- Returns:
- The text block filled up / truncated to the required height.
-
asAligned
public static String[] asAligned(String[] aTextBlock, int aHeight, VertAlignTextMode aVertAlignTextMode)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified. When filling up, a space (" ") character as fill char is used.- Parameters:
aTextBlock
- The text block to be filled up / truncated.aHeight
- The height of the resulting text block.aVertAlignTextMode
- The mode on how to fill up the text block. The mode can beVertAlignTextMode.BOTTOM
,VertAlignTextMode.MIDDLE
orVertAlignTextMode.TOP
- Returns:
- The text block filled up / truncated to the required height.
-
asAligned
public static String[] asAligned(String[] aTextBlock, int aHeight, VertAlignTextMode aVertAlignTextMode, boolean isEscCodesEnabled)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified. When filling up, a space (" ") character as fill char is used.- Parameters:
aTextBlock
- The text block to be filled up / truncated.aHeight
- The height of the resulting text block.aVertAlignTextMode
- The mode on how to fill up the text block. The mode can beVertAlignTextMode.BOTTOM
,VertAlignTextMode.MIDDLE
orVertAlignTextMode.TOP
isEscCodesEnabled
- True in case ANSI escape codes are to be regarded when calculating text lengths (they do not count).- Returns:
- The text block filled up / truncated to the required height.
-
asAligned
public static String[] asAligned(String[] aTextBlock, int aHeight, char aFillChar, VertAlignTextMode aVertAlignTextMode, boolean isEscCodesEnabled)
Fills up or truncates a given text block to the provided height; filling up or truncating depends on theVertAlignTextMode
specified, . When filling up, the provided fill char is used.- Parameters:
aTextBlock
- The text block to be filled up / truncated.aHeight
- The height of the resulting text block.aFillChar
- the fill char to use when filling up.aVertAlignTextMode
- The mode on how to fill up the text block. The mode can beVertAlignTextMode.BOTTOM
,VertAlignTextMode.MIDDLE
orVertAlignTextMode.TOP
isEscCodesEnabled
- True in case ANSI escape codes are to be regarded when calculating text lengths (they do not count).- Returns:
- The text block filled up / truncated to the required height.
-
getText
public String[] getText()
Retrieves the text from the text property.- Specified by:
getText
in interfaceTextAccessor
- Returns:
- The text stored by the text property.
-
setText
public void setText(String... aText)
Sets the text for the text property.- Specified by:
setText
in interfaceTextAccessor.TextMutator
- Parameters:
aText
- The text to be stored by the text property.
-
withText
public B withText(String... aText)
With text.
-
withText
public B withText(Collection<String> aText)
With text.- Specified by:
withText
in interfaceTextAccessor.TextBuilder<B extends Text<B>>
- Parameters:
aText
- the text- Returns:
- the b
-
toString
public String toString()
TheString
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).- Specified by:
toString
in interfaceTextAccessor.TextProvider
- Overrides:
toString
in classObject
- Returns:
- The according resulting
String
-
toString
public String toString(String... aText)
Race condition safe shortcut for usingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
. Implementation requirements: This method must not(!) be implemented by callingText.withText(String...)
followed byTextAccessor.TextProvider.toString()
(do not change the text property) as this would not be thread safe!
-
-