headerRow.getCells().get(6).getContext().setTextAlignment(TextAlignment.RIGHT); headerRow.getCells().get(7).getContext().setTextAlignment(TextAlignment.RIGHT); headerRow.getCells().get(8).getContext().setTextAlignment(TextAlignment.RIGHT); headerRow.getCells().get(9).getContext().setTextAlignment(TextAlignment.RIGHT); row.getCells().get(6).getContext().setTextAlignment(TextAlignment.RIGHT); row.getCells().get(7).getContext().setTextAlignment(TextAlignment.RIGHT); row.getCells().get(8).getContext().setTextAlignment(TextAlignment.RIGHT); row.getCells().get(9).getContext().setTextAlignment(TextAlignment.RIGHT); });
public static void addRowGeneratedTable(Object... columns) { if (generatedTable == null) { initializeTable(); } generatedTable.addRule(); AT_Row row = generatedTable.addRow(columns); if (columns[0] != null) { row.getCells().get(0).getContext().setTextAlignment(TextAlignment.CENTER); } if (columns[2] != null) { row.getCells().get(2).getContext().setTextAlignment(TextAlignment.CENTER); } }
/** * Sets the text alignment for all cells in the row. * @param textAlignment new text alignment * @throws NullPointerException if the argument was null * @return this to allow chaining * @throws {@link NullPointerException} if the argument was null */ public AT_Row setTextAlignment(TextAlignment textAlignment){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setTextAlignment(textAlignment); } } return this; }
/** * Sets the text alignment for all cells in the row. * @param textAlignment new text alignment * @throws NullPointerException if the argument was null * @return this to allow chaining * @throws {@link NullPointerException} if the argument was null */ public AT_Row setTextAlignment(TextAlignment textAlignment){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setTextAlignment(textAlignment); } } return this; }
private static void printGenericTable(String title, List<String> messages) { AsciiTable table = new AsciiTable(); table.addRule(); table.addRow(null, title + ": " + messages.size()).getCells().get(1).getContext().setTextAlignment(TextAlignment.CENTER); table.addRule(); int count = 1; for (String mess : messages) { table.addRow("#" + count, mess).getCells().get(0).getContext().setTextAlignment(TextAlignment.CENTER); table.addRule(); count ++; } table.getContext().setGrid(A7_Grids.minusBarPlusEquals()); table.getRenderer().setCWC(new CWC_LongestWordMin(new int[]{5, 101})); table.renderAsCollection().forEach(SDLogger::info); }
private static void initializeTable() { generatedTable = new AsciiTable(); generatedTable.addRule(); AT_Row header = generatedTable.addRow(Constants.TABLE_POSTFIX_COLUMN, Constants.TABLE_FILE_COLUMN, Constants.TABLE_RESULT_COLUMN); header.getCells().forEach(c -> c.getContext().setTextAlignment(TextAlignment.CENTER)); }