public final class NiceTable extends Object
| Constructor and Description |
|---|
NiceTable(int numberOfColumns)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(String title)
Adds a header.
|
void |
addHeader(String title,
char mark,
AbstractTabularComponent.Alignment orientation)
Adds a header row to the table.
|
void |
addLine(char fill)
allows the addition of lines.
|
void |
addRow(String[] data)
Adds a string row.
|
protected int |
getColumnWidth(int columnIndex)
Returns the global column width at index columnIndex.
|
protected AbstractTabularComponent.Alignment |
getOrientation(int columnIndex)
Returns the orientation of a column.
|
protected int |
getTotalWidth()
Returns the total width of the table.
|
String |
toString()
the main method doing the work.
|
protected void |
updateColumnWidth(int index,
int newSize)
Performs an update on the column lengths.
|
public NiceTable(int numberOfColumns)
numberOfColumns - the number of columns to display.public void addHeader(String title)
title - the text to display within the headerpublic void addHeader(String title, char mark, AbstractTabularComponent.Alignment orientation)
addHeader("hello",'.',NiceTable.LEFT)
would produce a row like
... hello ..........................
{rows in here.}
title - the string to display as a headermark - the mark to use for the rest of the columnorientation - the orientation of the header column.public void addRow(String[] data)
data - the array of data.public void addLine(char fill)
fill - any character with which to draw the line.public String toString()
protected int getColumnWidth(int columnIndex)
columnIndex - the index of the column for which to fetch the width.protected void updateColumnWidth(int index,
int newSize)
index - the index of the columnnewSize - the new size of the columnprotected AbstractTabularComponent.Alignment getOrientation(int columnIndex)
columnIndex - integerprotected int getTotalWidth()
Copyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.