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); });
if(cells.get(i).getContent()!=null){ String[] lines = String_To_ConditionalBreak.convert(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString()); 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 row with content with given cell context and a normal row style. * @param content the content for the row, each member of the array represents the content for a cell in the row, must not be null but can contain null members * @return a new row with content * @throws {@link NullPointerException} if content was null */ public static AT_Row createContentRow(Object[] content, TableRowStyle style){ Validate.notNull(content); Validate.notNull(style); Validate.validState(style!=TableRowStyle.UNKNOWN); LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>(); for(Object o : content){ cells.add(new AT_Cell(o)); } return new AT_Row(){ @Override public TableRowType getType(){ return TableRowType.CONTENT; } @Override public TableRowStyle getStyle(){ return style; } @Override public LinkedList<AT_Cell> getCells(){ return cells; } }; }
if(cells.get(i).getContent()!=null){ String[] lines = String_To_ConditionalBreak.convert(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString()); 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 row with content with given cell context and a normal row style. * @param content the content for the row, each member of the array represents the content for a cell in the row, must not be null but can contain null members * @return a new row with content * @throws {@link NullPointerException} if content was null */ public static AT_Row createContentRow(Object[] content, TableRowStyle style){ Validate.notNull(content); Validate.notNull(style); Validate.validState(style!=TableRowStyle.UNKNOWN); LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>(); for(Object o : content){ cells.add(new AT_Cell(o)); } return new AT_Row(){ @Override public TableRowType getType(){ return TableRowType.CONTENT; } @Override public TableRowStyle getStyle(){ return style; } @Override public LinkedList<AT_Cell> getCells(){ return cells; } }; }
/** * Sets all padding for all cells in the row to the same value. * @param padding new padding for top, bottom, left, and right, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPadding(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPadding(padding); } } return this; }
if(cells.get(i).getContent()!=null){ 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 bottom padding character for all cells in the row. * @param paddingBottomChar new padding character, ignored if null * @return this to allow chaining */ public AT_Row setPaddingBottomChar(Character paddingBottomChar) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingBottomChar(paddingBottomChar); } } return this; }
if(cells.get(i).getContent()!=null){ 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;
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); } }
Object content = cells.get(i).getContent(); if(content==null){ length++; 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()));
/** * Sets the right padding for all cells in the row. * @param paddingRight new padding, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingRight(int paddingRight) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingRight(paddingRight); } } return this; }
Object content = cells.get(i).getContent(); if(content==null){ length++; 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()));
/** * Sets the right padding character for all cells in the row. * @param paddingRightChar new padding character, ignored if null * @return this to allow chaining */ public AT_Row setPaddingRightChar(Character paddingRightChar) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingRightChar(paddingRightChar); } } return this; }
/** * Sets the left padding for all cells in the row. * @param paddingLeft new padding, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingLeft(int paddingLeft) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeft(paddingLeft); } } return this; }
/** * Sets left and right padding for all cells in the row. * @param padding new padding for left and right, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingLeftRight(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeftRight(padding); } } return this; }
/** * Sets the top padding for all cells in the row. * @param paddingTop new padding, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingTop(int paddingTop) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingTop(paddingTop); } } return this; }
/** * Sets top and bottom padding for all cells in the row. * @param padding new padding for top and bottom, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingTopBottom(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingTopBottom(padding); } } return this; }
/** * Sets the HTML entity translator for all cells in the row. * It will also remove any other translator set. * Nothing will happen if the argument is null. * @param htmlElementTranslator translator * @return this to allow chaining */ public AT_Row setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setHtmlElementTranslator(htmlElementTranslator); } } return this; }
/** * Sets left and right padding for all cells in the row (only if both values are not smaller than 0). * @param paddingLeft new left padding, ignored if smaller than 0 * @param paddingRight new right padding, ignored if smaller than 0 * @return this to allow chaining */ public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight); } } return this; }