public class TextBorderBuilderImpl extends Object implements TextBorderBuilder
TextAccessor.TextBuilder<B extends TextAccessor.TextBuilder<B>>, TextAccessor.TextMutator, TextAccessor.TextProperty
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 table style 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 table style 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 table style to use returns this builder as of the builder
pattern.
|
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
withBorderChar, withBorderWidth
getText
setText, setText
withText
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()
TableStyleAccessor
getTableStyle
in interface TableStyleAccessor
public void setTableStyle(TableStyle aTableStyle)
TableStyleAccessor.TableStyleMutator
setTableStyle
in interface TableStyleAccessor.TableStyleMutator
aTableStyle
- The table style to be stored by the table style
property.public TextBorderBuilder withTableStyle(TableStyle aTableStyle)
TableStyleAccessor.TableStyleBuilder
withTableStyle
in interface TableStyleAccessor.TableStyleBuilder<TextBorderBuilder>
aTableStyle
- The table style to be used when printing a row or
the header.TableBuilder
instance to continue configuration.public char getBorderChar()
TextBorderBuilder
getBorderChar
in interface TextBorderBuilder
public void setBorderChar(char aBorderChar)
TextBorderBuilder
setBorderChar
in interface TextBorderBuilder
aBorderChar
- The border char to be stored by the text align mode
property.public int getBorderWidth()
TextBorderBuilder
getBorderWidth
in interface TextBorderBuilder
public void setBorderWidth(int aBorderWidth)
TextBorderBuilder
setBorderWidth
in interface TextBorderBuilder
aBorderWidth
- The border width to be stored by the text align mode
property.public String[] toStrings()
TextBorderBuilder
String
s being build by the builder upon the settings of the
attributes.toStrings
in interface Text<TextBorderBuilder>
toStrings
in interface TextBorderBuilder
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<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.aBorderChar
- The character of the border to be drawn.aBorderWidth
- The width 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.aBorderChar
- The character of the border to be drawn.aBorderWidth
- The width 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.aBorderChar
- The character of the border to be drawn.aBorderWidth
- The width 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.aBorderChar
- The character of the border to be drawn.aBorderWidth
- The width 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.aBorderChar
- The character of the border to be drawn.aBorderWidth
- The width of the border to be drawn.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)
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.aHorizontalBorderChar
- The horizontal lines' border character.aVerticalBorderChar
- The vertical lines' border character.protected 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()
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.