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); });
/** * Creates a new row with content with default 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){ return AT_Row.createContentRow(content, TableRowStyle.NORMAL); }
/** * Sets left and right padding for all cells in the table. * @param padding new padding for left and right, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingLeftRight(int padding){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingLeftRight(padding); } } return this; }
/** * Sets all padding for all cells in the table 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 AsciiTable setPadding(int padding){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPadding(padding); } } return this; }
/** * Sets the right padding for all cells in the table. * @param paddingRight new padding, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingRight(int paddingRight) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingRight(paddingRight); } } return this; }
/** * Sets the left padding character for all cells in the table. * @param paddingLeftChar new padding character, ignored if null * @return this to allow chaining */ public AsciiTable setPaddingLeftChar(Character paddingLeftChar) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingLeftChar(paddingLeftChar); } } return this; }
/** * 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; }
switch(row.getStyle()){ case NORMAL: ruleset = TA_GridConfig.RULESET_NORMAL; switch(row.getType()){ case RULE: table.add(ruleset); case CONTENT: String[][] cAr = new String[colNumbers][]; LinkedList<AT_Cell> cells = row.getCells(); if(cells==null){ throw new AsciiTableException("cannot render table", "row content (cells) was null");
/** * Sets top and bottom padding for all cells in the table. * @param padding new padding for top and bottom, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingTopBottom(int padding){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingTopBottom(padding); } } return this; }
/** * Adds a rule with strong (emphasized) style row to the table. */ public final void addStrongRule(){ this.rows.add(AT_Row.createRule(TableRowType.RULE, TableRowStyle.STRONG)); }
/** * Sets the bottom padding for all cells in the table. * @param paddingBottom new padding, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingBottom(int paddingBottom) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingBottom(paddingBottom); } } return this; }
/** * Sets the bottom padding character for all cells in the table. * @param paddingBottomChar new padding character, ignored if null * @return this to allow chaining */ public AsciiTable setPaddingBottomChar(Character paddingBottomChar) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingBottomChar(paddingBottomChar); } } return this; }
/** * Sets the left padding for all cells in the table. * @param paddingLeft new padding, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingLeft(int paddingLeft) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingLeft(paddingLeft); } } return this; }
/** * Sets the top padding for all cells in the table. * @param paddingTop new padding, ignored if smaller than 0 * @return this to allow chaining */ public AsciiTable setPaddingTop(int paddingTop) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingTop(paddingTop); } } return this; }
/** * Sets the right padding character for all cells in the table. * @param paddingRightChar new padding character, ignored if null * @return this to allow chaining */ public AsciiTable setPaddingRightChar(Character paddingRightChar) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingRightChar(paddingRightChar); } } return this; }
/** * Sets the top padding character for all cells in the table. * @param paddingTopChar new padding character, ignored if null * @return this to allow chaining */ public AsciiTable setPaddingTopChar(Character paddingTopChar) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingTopChar(paddingTopChar); } } return this; }
/** * Sets the HTML entity translator for all cells in the table. * 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 AsciiTable setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setHtmlElementTranslator(htmlElementTranslator); } } return this; }
/** * Sets the text alignment for all cells in the table. * @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 AsciiTable setTextAlignment(TextAlignment textAlignment){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setTextAlignment(textAlignment); } } return this; }
/** * Sets the target translator for all cells in the table. * It will also remove any other translator set. * Nothing will happen if the argument is null. * @param targetTranslator translator * @return this to allow chaining */ public AsciiTable setTargetTranslator(TargetTranslator targetTranslator) { for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setTargetTranslator(targetTranslator); } } return this; }