Add a heading to the table @param text the heading text
(String text)
| 85 | * @param text the heading text |
| 86 | */ |
| 87 | public void addHeading(String text) { |
| 88 | if (text.length() > mHeaderWidth) { |
| 89 | throw new IllegalArgumentException("Header text too wide, expected: " + mHeaderWidth + " got: " + text.length()); |
| 90 | } |
| 91 | addSeparator(); |
| 92 | mTable.append(String.format("|" + widthString(mSpacing) + widthString(mHeaderWidth) + widthString(mSpacing) + "|%n", "", text, "")); |
| 93 | for (int width : mWidths) { |
| 94 | mTable.append("+").append(StringUtils.repeat("=", width + mSpacing * 2)); |
| 95 | } |
| 96 | mTable.append("+"); |
| 97 | mTable.append(StringUtils.LS); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Add a row to the table |