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); });
length -= cells.get(i).getContext().getPaddingLeft(); length -= cells.get(i).getContext().getPaddingRight(); if(cells.get(i).getContext().getTargetTranslator()!=null){ if(cells.get(i).getContext().getTargetTranslator().getCombinedTranslator()!=null){ text = cells.get(i).getContext().getTargetTranslator().getCombinedTranslator().translate(text); else if(cells.get(i).getContext().getHtmlElementTranslator()!=null){ text = cells.get(i).getContext().getHtmlElementTranslator().translateHtmlElements(text); else if(cells.get(i).getContext().getCharTranslator()!=null){ text = cells.get(i).getContext().getCharTranslator().translateCharacters(text); cells.get(i).getContext().getTextAlignment().getMapping(), TextFormat.NONE.getMapping(), null, null, null, 0, 0, null, 0, 0, null) sb.insert(0, new StrBuilder().appendPadding(cells.get(i).getContext().getPaddingLeft(), cells.get(i).getContext().getPaddingLeftChar())); sb.appendPadding(cells.get(i).getContext().getPaddingRight(), cells.get(i).getContext().getPaddingRightChar()); for(int k=0; k<cells.get(i).getContext().getPaddingTop(); k++){ ((ArrayList<StrBuilder>)csb).add(0, new StrBuilder().appendPadding(realWidth, cells.get(i).getContext().getPaddingTopChar())); for(int k=0; k<cells.get(i).getContext().getPaddingBottom(); k++){ ((ArrayList<StrBuilder>)csb).add(new StrBuilder().appendPadding(realWidth, cells.get(i).getContext().getPaddingBottomChar()));
int lineWidth = line.length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight(); if(lineWidth > resultWidths[i]) { int maxWidth = (maxWidths.length>i)?maxWidths[i]:0;
/** * Creates a new cell with content and context * @param content cell content, can be null indicating column spans * @param ctx cell context, default context created if null */ public AT_Cell(Object content, AT_CellContext ctx){ if(ctx==null){ this.ctx = new AT_CellContext(); } else{ this.ctx = ctx; } this.content = content; }
length -= cells.get(i).getContext().getPaddingLeft(); length -= cells.get(i).getContext().getPaddingRight(); if(cells.get(i).getContext().getTargetTranslator()!=null){ if(cells.get(i).getContext().getTargetTranslator().getCombinedTranslator()!=null){ text = cells.get(i).getContext().getTargetTranslator().getCombinedTranslator().translate(text); else if(cells.get(i).getContext().getHtmlElementTranslator()!=null){ text = cells.get(i).getContext().getHtmlElementTranslator().translateHtmlElements(text); else if(cells.get(i).getContext().getCharTranslator()!=null){ text = cells.get(i).getContext().getCharTranslator().translateCharacters(text); cells.get(i).getContext().getTextAlignment().getMapping(), TextFormat.NONE.getMapping(), null, null, null, 0, 0, null, 0, 0, null) sb.insert(0, new StrBuilder().appendPadding(cells.get(i).getContext().getPaddingLeft(), cells.get(i).getContext().getPaddingLeftChar())); sb.appendPadding(cells.get(i).getContext().getPaddingRight(), cells.get(i).getContext().getPaddingRightChar()); for(int k=0; k<cells.get(i).getContext().getPaddingTop(); k++){ ((ArrayList<StrBuilder>)csb).add(0, new StrBuilder().appendPadding(realWidth, cells.get(i).getContext().getPaddingTopChar())); for(int k=0; k<cells.get(i).getContext().getPaddingBottom(); k++){ ((ArrayList<StrBuilder>)csb).add(new StrBuilder().appendPadding(realWidth, cells.get(i).getContext().getPaddingBottomChar()));
int lineWidth = line.length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight(); if(lineWidth > resultWidths[i]) { int maxWidth = (maxWidths.length>i)?maxWidths[i]:0;
/** * Creates a new cell with content and context * @param content cell content, can be null indicating column spans * @param ctx cell context, default context created if null */ public AT_Cell(Object content, AT_CellContext ctx){ if(ctx==null){ this.ctx = new AT_CellContext(); } else{ this.ctx = ctx; } this.content = content; }
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); } }
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString()); for(int k=0; k<ar.length; k++){ int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight(); if(count>ret[i]){ ret[i] = count;
/** * 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; }
String[] ar = StringUtils.split(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString()); for(int k=0; k<ar.length; k++){ int count = ar[k].length() + cells.get(i).getContext().getPaddingLeft() + cells.get(i).getContext().getPaddingRight(); if(count>ret[i]){ ret[i] = count;
/** * 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)); }