|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.nocrala.tools.texttablefmt.ShownBorders
public class ShownBorders
A ShownBorders define which borders and internal separators are rendered.
A ShownBorders does not control the specific characters (tiles) that will be used to render those borders; a BorderStyle is used to define those ones.
You can use predefined styles or custom styles.
Below all predefined ShownBorders are listed with examples. For simplicity and clarity, all these examples use the style BorderStyle.CLASSIC, but they work with any BorderStyle:
ShownBorders.ALL
+---------+----------+----------+-------+ |Country |Population|Area (km2)|Density| +---------+----------+----------+-------+ |Chile |17 000 000| 1 250 000| 13.60| +---------+----------+----------+-------+ |Argentina|50 000 000| 3 000 000| 16.67| +---------+----------+----------+-------+ |Brasil |80 000 000| 5 000 000| 16.00| +---------+----------+----------+-------+
ShownBorders.NONE
Country PopulationArea (km2)Density Chile 17 000 000 1 250 000 13.60 Argentina50 000 000 3 000 000 16.67 Brasil 80 000 000 5 000 000 16.00
Default: ShownBorders.SURROUND_HEADER_AND_COLUMNS
+---------+----------+----------+-------+ |Country |Population|Area (km2)|Density| +---------+----------+----------+-------+ |Chile |17 000 000| 1 250 000| 13.60| |Argentina|50 000 000| 3 000 000| 16.67| |Brasil |80 000 000| 5 000 000| 16.00| +---------+----------+----------+-------+
ShownBorders.SURROUND_HEADER_FOOTER_AND_COLUMNS
+---------+-----------+----------+-------+ |Country | Population|Area (km2)|Density| +---------+-----------+----------+-------+ |Chile | 17 000 000| 1 250 000| 13.60| |Argentina| 50 000 000| 3 000 000| 16.67| |Brasil | 80 000 000| 5 000 000| 16.00| +---------+-----------+----------+-------+ |Total |147 000 000| 9 250 000| 15.89| +---------+-----------+----------+-------+
ShownBorders.SURROUND
+------------------------------------+ |Country PopulationArea (km2)Density| |Chile 17 000 000 1 250 000 13.60| |Argentina50 000 000 3 000 000 16.67| |Brasil 80 000 000 5 000 000 16.00| +------------------------------------+
ShownBorders.HEADER_AND_COLUMNS
Country |Population|Area (km2)|Density ---------+----------+----------+------- Chile |17 000 000| 1 250 000| 13.60 Argentina|50 000 000| 3 000 000| 16.67 Brasil |80 000 000| 5 000 000| 16.00
ShownBorders.HEADER_FOOTER_AND_COLUMNS
Country |Population|Area (km2)|Density ---------+----------+----------+------- Chile |17 000 000| 1 250 000| 13.60 Argentina|50 000 000| 3 000 000| 16.67 ---------+----------+----------+------- Brasil |80 000 000| 5 000 000| 16.00
ShownBorders.HEADER_AND_FOOTER
Country PopulationArea (km2)Density ------------------------------------ Chile 17 000 000 1 250 000 13.60 Argentina50 000 000 3 000 000 16.67 ------------------------------------ Brasil 80 000 000 5 000 000 16.00
ShownBorders.HEADER_AND_FIRST_COLLUMN
Country |PopulationArea (km2)Density ---------+--------------------------- Chile |17 000 000 1 250 000 13.60 Argentina|50 000 000 3 000 000 16.67 Brasil |80 000 000 5 000 000 16.00
ShownBorders.HEADER_FIRST_AND_LAST_COLLUMN
Country |PopulationArea (km2)|Density ---------+--------------------+------- Chile |17 000 000 1 250 000| 13.60 Argentina|50 000 000 3 000 000| 16.67 Brasil |80 000 000 5 000 000| 16.00
ShownBorders.HEADER_FOOTER_AND_FIRST_COLLUMN
Country |PopulationArea (km2)Density ---------+--------------------------- Chile |17 000 000 1 250 000 13.60 Argentina|50 000 000 3 000 000 16.67 ---------+--------------------------- Brasil |80 000 000 5 000 000 16.00
ShownBorders.HEADER_FOOTER_FIRST_AND_LAST_COLLUMN
Country |PopulationArea (km2)|Density ---------+--------------------+------- Chile |17 000 000 1 250 000| 13.60 Argentina|50 000 000 3 000 000| 16.67 ---------+--------------------+------- Brasil |80 000 000 5 000 000| 16.00
In combination with a BorderStyle you can render cleaner tables, like in the following examples:
ShownBorders.HEADER_FOOTER_AND_COLUMNS, BorderStyle.HORIZONTAL_ONLY
Country Population Area (km2) Density --------- ---------- ---------- ------- Chile 17 000 000 1 250 000 13.60 Argentina 50 000 000 3 000 000 16.67 --------- ---------- ---------- ------- Brasil 80 000 000 5 000 000 16.00
ShownBorders.HEADER_ONLY, BorderStyle.HORIZONTAL_ONLY
Country Population Area (km2) Density --------- ---------- ---------- ------- Chile 17 000 000 1 250 000 13.60 Argentina 50 000 000 3 000 000 16.67 Brasil 80 000 000 5 000 000 16.00
If no predefined style fits your needs, you can use a...
You can separately control the rendering of the following borders and separators, using a custom style:
+- top border --------+----------+----------+----------+ | | | | | left | center | right border | separators | border | | | | | +- header separator --+----------+----------+----------+ | | | | | | | | | | +- middle separators -+----------+----------+----------+ | | | | | | | | | | +- footer separator --+----------+----------+----------+ | | | | | | left | right | | separator | separator | | | | | | +- bottom border -----+----------+----------+----------+
For vertical separators, there is a single left border, left separator, right separator and right border. All separator inside them are considered center separators. Similarly, for horizontal separator there can be many middle separators.
For example, you can use:
new ShownBorders("t.t.t.t.t.")
to generate a table like:
+-------------------+----------------- |Country Population|Area (km2)Density +-------------------+----------------- |Chile 17 000 000| 1 250 000 13.60 |Argentina50 000 000| 3 000 000 16.67 +-------------------+----------------- |Brasil 80 000 000| 5 000 000 16.00
Use any combination of 't'
and '.'
that fits your needs.
Field Summary | |
---|---|
static ShownBorders |
ALL
Render all borders and separators. |
static ShownBorders |
HEADER_AND_COLUMNS
Render the header separator, and the left, center and right separators. |
static ShownBorders |
HEADER_AND_FIRST_COLLUMN
Render the header separator and the left separator. |
static ShownBorders |
HEADER_AND_FOOTER
Render the header and footer separators. |
static ShownBorders |
HEADER_FIRST_AND_LAST_COLLUMN
Render the header separator, and the left and right separator. |
static ShownBorders |
HEADER_FOOTER_AND_COLUMNS
Render header and footer separators, and the left, center and right separators. |
static ShownBorders |
HEADER_FOOTER_AND_FIRST_COLLUMN
Render the header and footer separator, and the left separator. |
static ShownBorders |
HEADER_FOOTER_FIRST_AND_LAST_COLLUMN
Render the header and footer separator, and the left and right separators. |
static ShownBorders |
HEADER_ONLY
Render only the header separator. |
static ShownBorders |
NONE
Renders no border nor separator. |
static ShownBorders |
SURROUND
Render borders only. |
static ShownBorders |
SURROUND_HEADER_AND_COLUMNS
Render all the borders, the header separator, and the left, center and right separators. |
static ShownBorders |
SURROUND_HEADER_FOOTER_AND_COLUMNS
Render all the borders, the header and footer separators, and the left, center and right separators. |
Constructor Summary | |
---|---|
ShownBorders(boolean headerSeparator,
boolean middleSeparator,
boolean footerSeparator,
boolean leftSeparator,
boolean centerSeparator,
boolean rightSeparator,
boolean topBorder,
boolean bottomBorder,
boolean leftBorder,
boolean rightBorder)
Creates a custom border style. |
|
ShownBorders(java.lang.String separatorsAndBordersToRender)
Creates a custom border style using a 10-character String. |
Method Summary |
---|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ShownBorders NONE
public static final ShownBorders HEADER_ONLY
public static final ShownBorders HEADER_AND_FOOTER
public static final ShownBorders HEADER_FOOTER_AND_COLUMNS
public static final ShownBorders HEADER_AND_FIRST_COLLUMN
public static final ShownBorders HEADER_FIRST_AND_LAST_COLLUMN
public static final ShownBorders HEADER_FOOTER_AND_FIRST_COLLUMN
public static final ShownBorders HEADER_FOOTER_FIRST_AND_LAST_COLLUMN
public static final ShownBorders HEADER_AND_COLUMNS
public static final ShownBorders SURROUND_HEADER_AND_COLUMNS
public static final ShownBorders SURROUND_HEADER_FOOTER_AND_COLUMNS
public static final ShownBorders SURROUND
public static final ShownBorders ALL
Constructor Detail |
---|
public ShownBorders(boolean headerSeparator, boolean middleSeparator, boolean footerSeparator, boolean leftSeparator, boolean centerSeparator, boolean rightSeparator, boolean topBorder, boolean bottomBorder, boolean leftBorder, boolean rightBorder)
headerSeparator
- middleSeparator
- footerSeparator
- leftSeparator
- centerSeparator
- rightSeparator
- topBorder
- bottomBorder
- leftBorder
- rightBorder
- public ShownBorders(java.lang.String separatorsAndBordersToRender)
separatorsAndBordersToRender
- A ten character string. Every character whose value is 't' represents a true value for the following borders or separators, in the following order:
For example, a "......tttt" String will represent a borders-only style,
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |