|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
CSVTablePrinter | An interface for creating a CSV formatted table. |
TableBuilder | A class which can be used to construct tables of information to be displayed in a terminal. |
TablePrinter | An interface for incrementally configuring a table serializer. |
TableSerializer | An interface for serializing tables. |
TabSeparatedTablePrinter | An interface for creating a tab-separated formatted table. |
TextTablePrinter | An interface for creating a text based table. |
Provides support for construction and display of tables in text based
applications. Applications construct tables using the TableBuilder
class and display them using on of the TablePrinter
implementations. At the moment two types of table output are supported:
CSVTablePrinter
- displays a table in comma-separated
value format
TabSeparatedTablePrinter
- displays a table in tab separated
format
TextTablePrinter
- displays a table in a human-readable
format. Using this implementation it is possible to configure
constraints on column widths. The implementation will take care of
wrapping table cells where required.
TableBuilder builder = new TableBuilder(); builder.appendHeading("Name"); builder.appendHeading("Age"); builder.addSortKey(0); builder.startRow(); builder.appendCell("Bob"); builder.appendCell(11); builder.startRow(); builder.appendCell("Alice"); builder.appendCell(22); builder.startRow(); builder.appendCell("Charlie"); builder.appendCell(33); TextTablePrinter printer = new TextTablePrinter(System.out); printer.setColumnSeparator(":"); builder.print(printer);Which will display the following table:
Name : Age --------:---- Alice : 22 Bob : 11 Charlie : 33
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |