Class TablePrinter.PrintConfig
java.lang.Object
fc.io.TablePrinter.PrintConfig
- Enclosing class:
TablePrinter
Configuration object containing for table printing object.
Some methods in this class return this object for method
chaining convenience.
Note: Alas ! TablePrinter does not support cellspans across columns or rows. That would make things too complicated for this implementation.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new PrintConfig with the following default options. -
Method Summary
Modifier and TypeMethodDescriptionString[]Gets the header row for the table if set.headerEveryPage(boolean show) Specifies that page heading (if set) on each separate page.Sets the alignment of each cell.setAutoFit(boolean autofit) Sets each cell to expand to the size needed for the maximum sized cell in that column.Sets the string (typically a single character) that makes up a horizontal cell border.Sets the string (typically a single character) that makes up a vertical cell border.setCellCorner(String str) Sets the string (typically a single character) that makes up a cell corner.setCellPadding(int width) Specifies the cell padding for each cell.Sets the string (typically a single character) that makes up the cellpadding.setCellSpacing(int width) Specifies the cell spacing between cells.Sets the string (typically a single character) that makes up the cellspacing.setCellWidth(int width) Sets the width of each cell.setCellWidthForColumn(int column, int width) Sets the cell width of the the specified column.setCellWrap(boolean wrap) Cell wrapping is on by default and the contents of any column that exceed the width are wrapped within each cell (using the current platforms line seperator for newlines within the cell).voidOptionally sets the header row for the tablesetPageSize(int lines) Sets the number of lines on each page.setPrintBorders(boolean print) Specifies whether table and cell borders are printed.toString()Prints a short description of this object.
-
Constructor Details
-
PrintConfig
public PrintConfig()Constructs a new PrintConfig with the following default options.- cell corner: the + character
- horizontal cell border: the - character
- vertical cell border, the | character
- width of each column: 20 chars
- horizontal alignment of each cell:
HAlign.LEFT - The character used for cellpadding and cellspacing is a blank space.
-
-
Method Details
-
setHeader
-
getHeader
-
setPageSize
Sets the number of lines on each page. A page is a logical unit that typically shows some number of lines on the screen without the need to scroll the page. This value is useful in conjunction with other page specific settings likeinvalid reference
showPageHeading()- Parameters:
lines- number of lines on the page, specify a zero or negative quantity for a single page. (number of lines not including lines occupied by the table header itself, if the header is printed).
-
headerEveryPage
Specifies that page heading (if set) on each separate page. This may be ignored if no heading has been set. true by default, although headers will still not be printed until thesetPageSize(int)method is invoked. -
setAlign
Sets the alignment of each cell. By default:left -
setCellCorner
Sets the string (typically a single character) that makes up a cell corner. Defaults to + -
setCellBorderHorizontal
Sets the string (typically a single character) that makes up a horizontal cell border. Defaults to - -
setCellBorderVertical
Sets the string (typically a single character) that makes up a vertical cell border. Defaults to | -
setCellPaddingGlyph
Sets the string (typically a single character) that makes up the cellpadding. Defaults to " " -
setCellSpacingGlyph
Sets the string (typically a single character) that makes up the cellspacing. Defaults to " " -
setCellWidth
Sets the width of each cell. Defaults to 20. This width is common to all cells.- Parameters:
width- the width of each cell
-
setCellWidthForColumn
Sets the cell width of the the specified column. cells are numbered starting from 0- Parameters:
column- the cell numberwidth- the desired character width
-
setCellWrap
Cell wrapping is on by default and the contents of any column that exceed the width are wrapped within each cell (using the current platforms line seperator for newlines within the cell).- Parameters:
wrap- true To turn cell wrapping on, false to turn cell wrapping off and show fixed width contents only.
-
setAutoFit
Sets each cell to expand to the size needed for the maximum sized cell in that column. By default, this is false. Setting this to true automatically turns off cell wrapping.Note: using autofit may result in slower performance because the table almost always has to be rendered in two passes.
- Parameters:
autofit- true to turn autofit on, false otherwise.
-
setPrintBorders
Specifies whether table and cell borders are printed. By default this is true.- Parameters:
print- true to print borders, false otherwise
-
setCellSpacing
Specifies the cell spacing between cells. This is useful for tables with no borders. By default, this value is zero. -
setCellPadding
Specifies the cell padding for each cell. This is useful for tables with no borders. By default, this value is zero. -
toString
-