* scope (or authority) declared in 'titles', in the same order. It will
* also contains a "Description" column if there is some.
*/
int column = 0;
synchronized (lock) {
final TableWriter table = new TableWriter(out, TableWriter.SINGLE_VERTICAL_LINE);
table.setMultiLinesCells(true);
table.writeHorizontalSeparator();
/*
* Writes all column headers.
*/
for (final Object element : titles.keySet()) {
if (hide[column++]) {
continue;
}
final String title;
if (element == null) {
title = "Identifier"; // TODO: localize
} else if (element instanceof String) {
title = (String) element;
} else {
title = "Alias " + element; // TODO: localize
}
table.write(title);
table.nextColumn();
}
if (descriptions != null) {
table.write("Description"); // TODO: localize
}
table.writeHorizontalSeparator();
/*
* Writes all row.
*/
int counter = 0;
for (final String[] aliases : names) {
for (column=0; column<hide.length; column++) {
if (hide[column]) {
continue;
}
if (column < aliases.length) {
final String alias = aliases[column];
if (alias != null) {
table.write(alias);
}
}
table.nextColumn();
}
if (descriptions != null) {
final String remarks = descriptions[counter++];
if (remarks != null) {
table.write(remarks);
}
}
table.nextLine();
}
table.writeHorizontalSeparator();
table.flush();
}
}