public class TextBorderBuilderImpl extends Object implements TextBorderBuilder
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty, TextAccessor.TextProvider
org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeBuilder<B extends org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeBuilder<B>>, org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeMutator, org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeProperty
TableStyleAccessor.TableStyleBuilder<B extends TableStyleAccessor.TableStyleBuilder<?>>, TableStyleAccessor.TableStyleMutator, TableStyleAccessor.TableStyleProperty
Constructor and Description |
---|
TextBorderBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
char |
getBorderChar()
Retrieves the border char from the border char property.
|
int |
getBorderWidth()
Retrieves the border width from the border width property.
|
org.refcodes.graphical.BoxBorderMode |
getBoxBorderMode() |
TableStyle |
getTableStyle()
Gets the currently set
TableStyle being used. |
String[] |
getText()
Retrieves the text from the text property.
|
void |
setBorderChar(char aBorderChar)
Sets the border char for the border char property.
|
void |
setBorderWidth(int aBorderWidth)
Sets the border width for the border width property.
|
void |
setBoxBorderMode(org.refcodes.graphical.BoxBorderMode aBoxBorderMode) |
void |
setTableStyle(TableStyle aTableStyle)
Sets the
TableStyle to be used. |
void |
setText(String... aText)
Sets the text for the text property.
|
protected static String[] |
toAsciiBorder(String[] aText)
Adds a predefined "single-line" border to the provided text.
|
protected static String[] |
toBorder(String[] aText,
char aTopLeftBorderChar,
char aTopRightBorderChar,
char aBottomLeftBorderChar,
char aBottomRightBorderChar,
char aTopBorderChar,
char aRightBorderChar,
char aBottomBorderChar,
char aLeftBorderChar,
org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
Adds a predefined border according border to the provided text.
|
protected static String[] |
toBorder(String[] aText,
int aBorderWidth,
char aBorderChar,
org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
Adds the according border with the given char and the provided width to
the provided text.
|
protected static String[] |
toBottomBorder(String[] aText,
int aBorderWidth,
char aBorderChar)
Adds the according border with the given char and the provided width to
the provided text.
|
protected static String[] |
toDoubleBorder(String[] aText)
Adds a predefined "double-line" border to the provided text.
|
protected static String[] |
toLeftBorder(String[] aText,
int aBorderWidth,
char aBorderChar)
Adds the according border with the given char and the provided witdh to
the provided text.
|
protected static String |
toLine(int aLength,
char aFillChar)
Returns a
String with the given length and containing only the
provided fill character. |
protected static String[] |
toRightBorder(String[] aText,
int aBorderWidth,
char aBorderChar)
Adds the according border with the given char and the provided width to
the provided text.
|
protected static String[] |
toSingleBorder(String[] aText)
Adds a predefined "single-line" border to the provided text.
|
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[] |
toTopBorder(String[] aText,
int aBorderWidth,
char aBorderChar)
Adds the according border with the given char and the provided width to
the provided text.
|
TextBorderBuilder |
withBoxBorderMode(org.refcodes.graphical.BoxBorderMode aBoxBorderMode) |
TextBorderBuilder |
withTableStyle(TableStyle aTableStyle)
Sets the rows
TableStyle to use returns this builder as of
the Builder-Pattern. |
B |
withText(Collection<String> aText)
With text.
|
B |
withText(String... aText)
With text.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
withBorderChar, withBorderWidth
getText
setText, setText
withText
toString
public org.refcodes.graphical.BoxBorderMode getBoxBorderMode()
getBoxBorderMode
in interface org.refcodes.graphical.BoxBorderModeAccessor
public void setBoxBorderMode(org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
setBoxBorderMode
in interface org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeMutator
public TextBorderBuilder withBoxBorderMode(org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
withBoxBorderMode
in interface org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeBuilder<TextBorderBuilder>
public TableStyle getTableStyle()
TableStyle
being used.getTableStyle
in interface TableStyleAccessor
TableStyle
s.public void setTableStyle(TableStyle aTableStyle)
TableStyle
to be used.setTableStyle
in interface TableStyleAccessor.TableStyleMutator
aTableStyle
- The TableStyle
to be stored by the
TableStyle
property.public TextBorderBuilder withTableStyle(TableStyle aTableStyle)
TableStyle
to use returns this builder as of
the Builder-Pattern.withTableStyle
in interface TableStyleAccessor.TableStyleBuilder<TextBorderBuilder>
aTableStyle
- The TableStyle
to be used when printing a
row or the header.TableBuilder
instance to continue configuration.public char getBorderChar()
getBorderChar
in interface TextBorderBuilder
public void setBorderChar(char aBorderChar)
setBorderChar
in interface TextBorderBuilder
aBorderChar
- The border char to be stored by the text align mode
property.public int getBorderWidth()
getBorderWidth
in interface TextBorderBuilder
public void setBorderWidth(int aBorderWidth)
setBorderWidth
in interface TextBorderBuilder
aBorderWidth
- The border width to be stored by the text align mode
property.public String[] toStrings()
String
s being build by the builder upon the settings of the
attributes.toStrings
in interface TextAccessor.TextProvider
toStrings
in interface TextBorderBuilder
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<TextBorderBuilder>
aText
- The text to be processed.String
arrayprotected static String[] toLeftBorder(String[] aText, int aBorderWidth, char aBorderChar)
aText
- The text to which the border is to be applied.aBorderWidth
- The width of the border to be drawn.aBorderChar
- The character of the border to be drawn.protected static String[] toRightBorder(String[] aText, int aBorderWidth, char aBorderChar)
aText
- The text to which the border is to be applied.aBorderWidth
- The width of the border to be drawn.aBorderChar
- The character of the border to be drawn.protected static String[] toTopBorder(String[] aText, int aBorderWidth, char aBorderChar)
aText
- The text to which the border is to be applied.aBorderWidth
- The width of the border to be drawn.aBorderChar
- The character of the border to be drawn.protected static String[] toBottomBorder(String[] aText, int aBorderWidth, char aBorderChar)
aText
- The text to which the border is to be applied.aBorderWidth
- The width of the border to be drawn.aBorderChar
- The character of the border to be drawn.protected static String[] toBorder(String[] aText, int aBorderWidth, char aBorderChar, org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
aText
- The text to which the border is to be applied.aBorderWidth
- The width of the border to be drawn.aBorderChar
- The character of the border to be drawn.aBoxBorderMode
- the box border modeprotected static String[] toBorder(String[] aText, char aTopLeftBorderChar, char aTopRightBorderChar, char aBottomLeftBorderChar, char aBottomRightBorderChar, char aTopBorderChar, char aRightBorderChar, char aBottomBorderChar, char aLeftBorderChar, org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
aText
- The text to which the border is to be applied.aTopLeftBorderChar
- The top left border's character.aTopRightBorderChar
- The top right border's character.aBottomLeftBorderChar
- The bottom left border's character.aBottomRightBorderChar
- The bottom right border's character.aTopBorderChar
- the top border charaRightBorderChar
- the right border charaBottomBorderChar
- the bottom border charaLeftBorderChar
- the left border charaBoxBorderMode
- the box border modeprotected static String[] toSingleBorder(String[] aText)
aText
- The text to which the border is to be applied.protected static String[] toDoubleBorder(String[] aText)
aText
- The text to which the border is to be applied.protected static String[] toAsciiBorder(String[] aText)
aText
- The text to which the border is to be applied.protected static String toLine(int aLength, char aFillChar)
String
with the given length and containing only the
provided fill character.aLength
- The length to be reached.aFillChar
- The char to be used for filling upString
filled with the fill character till the
provided 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 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.