private void dumpStatus() { if (STATUS_LOGGER.isDebugEnabled()) { final AsciiTable at = new AsciiTable(); at.addRule(); AT_Row headerRow = at.addRow("Id", "Proxy", "Created", "Started", "Last Used", "Last Session", "Busy", "Timed Out", "Terminating", "Tests Run"); 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); at.addRule(); AT_Row row = at.addRow(containerId, proxyId, timeCreated, timeStarted, lastUsed, lastSession, isBusy, isTimedOut, isShuttingDown, testCount); 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); }); at.addRule(); at.setPaddingLeftRight(1); CWC_LongestLine cwc = new CWC_LongestLine(); at.getRenderer().setCWC(cwc); STATUS_LOGGER.debug("Status:\n" + at.render(200));
@Override public String render(int width){ return this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx, width); // return new StrBuilder().appendWithSeparators(this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx, this.ctx.getTextWidth(width)), "\n").toString(); }
/** * Returns the width of each column in an array, column one being [0] and so on. * @param rows the table rows with rules and content * @param colNumbers number of columns in the table * @param ctx the original table context, the required width is taken from this context * @return an array with the width for each column */ default int[] calculateColumnWidths(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx){ return this.calculateColumnWidths(rows, colNumbers, ctx.getTextWidth()); } /**
/** * 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 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 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 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; }
/** * 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 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; }
/** * 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; }
/** * 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 the left padding character for all cells in the row. * @param paddingLeftChar new padding character, ignored if null * @return this to allow chaining */ public AT_Row setPaddingLeftChar(Character paddingLeftChar) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeftChar(paddingLeftChar); } } return this; }
/** * Sets the top padding character for all cells in the row. * @param paddingTopChar new padding character, ignored if null * @return this to allow chaining */ public AT_Row setPaddingTopChar(Character paddingTopChar) { if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingTopChar(paddingTopChar); } } return this; }
/** * 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 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 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; }
@Override public String render(){ return this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx); // return new StrBuilder().appendWithSeparators(this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx), "\n").toString(); }
/** * Returns the width of each column in an array, column one being [0] and so on. * @param rows the table rows with rules and content * @param colNumbers number of columns in the table * @param ctx the original table context, the required width is taken from this context * @return an array with the width for each column */ default int[] calculateColumnWidths(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx){ return this.calculateColumnWidths(rows, colNumbers, ctx.getTextWidth()); } /**
@Override public String render(){ return this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx); // return new StrBuilder().appendWithSeparators(this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx), "\n").toString(); }
@Override public String render(int width){ return this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx, width); // return new StrBuilder().appendWithSeparators(this.renderer.render(this.getRawContent(), this.getColNumber(), this.ctx, this.ctx.getTextWidth(width)), "\n").toString(); }