Don't consider header width if not printed.
This commit is contained in:
parent
2bb681466c
commit
bcacbff096
|
@ -66,10 +66,10 @@ public class RestTable {
|
|||
}
|
||||
|
||||
public static RestResponse buildTextPlainResponse(Table table, RestRequest request, RestChannel channel) {
|
||||
int[] width = buildWidths(table, request);
|
||||
boolean verbose = request.paramAsBoolean("v", true);
|
||||
int[] width = buildWidths(table, request, verbose);
|
||||
Set<String> displayHeaders = buildDisplayHeaders(table, request);
|
||||
|
||||
boolean verbose = request.paramAsBoolean("v", true);
|
||||
StringBuilder out = new StringBuilder();
|
||||
if (verbose) {
|
||||
// print the headers
|
||||
|
@ -113,8 +113,10 @@ public class RestTable {
|
|||
return display;
|
||||
}
|
||||
|
||||
private static int[] buildWidths(Table table, RestRequest request) {
|
||||
private static int[] buildWidths(Table table, RestRequest request, boolean verbose) {
|
||||
int[] width = new int[table.getHeaders().size()];
|
||||
|
||||
if (verbose) {
|
||||
for (int col = 0; col < width.length; col++) {
|
||||
String v = renderValue(request, table.getHeaders().get(col).value);
|
||||
int vWidth = v == null ? 0 : v.length();
|
||||
|
@ -122,6 +124,7 @@ public class RestTable {
|
|||
width[col] = vWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (List<Table.Cell> row : table.getRows()) {
|
||||
for (int col = 0; col < width.length; col++) {
|
||||
|
|
Loading…
Reference in New Issue