/** * Renders an {@link AsciiTable}. * @param rows table rows to render, cannot be null * @param colNumbers number of columns in the table * @param ctx context of the original table with relevant settings, cannot be null * @return collection of lines, each as a {@link StrBuilder} * @throws {@link NullPointerException} if rows or context where null */ default Collection<StrBuilder> renderAsCollection(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx){ Validate.notNull(rows); Validate.notNull(ctx); return this.renderAsCollection(rows, colNumbers, ctx, ctx.getWidth()); }
/** * Renders an {@link AsciiTable}. * @param rows table rows to render, cannot be null * @param colNumbers number of columns in the table * @param ctx context of the original table with relevant settings, cannot be null * @return collection of lines, each as a {@link StrBuilder} * @throws {@link NullPointerException} if rows or context where null */ default Collection<StrBuilder> renderAsCollection(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx){ Validate.notNull(rows); Validate.notNull(ctx); return this.renderAsCollection(rows, colNumbers, ctx, ctx.getWidth()); }
/** * Renders an {@link AsciiTable}. * @param rows table rows to render, cannot be null * @param colNumbers number of columns in the table * @param ctx context of the original table with relevant settings, cannot be null * @param width maximum line width, excluding any extra padding * @return a single string with the rendered table * @throws {@link NullPointerException} if rows or context where null */ default String render(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx, int width){ Validate.notNull(rows); Validate.notNull(ctx); Collection<StrBuilder> coll = this.renderAsCollection(rows, colNumbers, ctx, width); String fileSeparator = this.getLineSeparator(); if(fileSeparator==null){ fileSeparator = ctx.getLineSeparator(); } if(fileSeparator==null){ fileSeparator = System.lineSeparator(); } return new StrBuilder().appendWithSeparators(coll, fileSeparator).build(); }
/** * Renders an {@link AsciiTable}. * @param rows table rows to render, cannot be null * @param colNumbers number of columns in the table * @param ctx context of the original table with relevant settings, cannot be null * @param width maximum line width, excluding any extra padding * @return a single string with the rendered table * @throws {@link NullPointerException} if rows or context where null */ default String render(LinkedList<AT_Row> rows, int colNumbers, AT_Context ctx, int width){ Validate.notNull(rows); Validate.notNull(ctx); Collection<StrBuilder> coll = this.renderAsCollection(rows, colNumbers, ctx, width); String fileSeparator = this.getLineSeparator(); if(fileSeparator==null){ fileSeparator = ctx.getLineSeparator(); } if(fileSeparator==null){ fileSeparator = System.lineSeparator(); } return new StrBuilder().appendWithSeparators(coll, fileSeparator).build(); }
@Override public Collection<String> renderAsCollection(){ return ClusterElementTransformer.create().transform( this.renderer.renderAsCollection(this.getRawContent(), this.getColNumber(), this.ctx), StrBuilder_To_String.create(), ArrayListStrategy.create() ); }
@Override public Collection<String> renderAsCollection(){ return ClusterElementTransformer.create().transform( this.renderer.renderAsCollection(this.getRawContent(), this.getColNumber(), this.ctx), StrBuilder_To_String.create(), ArrayListStrategy.create() ); }
@Override public Collection<String> renderAsCollection(int width){ return ClusterElementTransformer.create().transform( this.renderer.renderAsCollection(this.getRawContent(), this.getColNumber(), this.ctx, this.ctx.getTextWidth(width)), StrBuilder_To_String.create(), ArrayListStrategy.create() ); }
@Override public Collection<String> renderAsCollection(int width){ return ClusterElementTransformer.create().transform( this.renderer.renderAsCollection(this.getRawContent(), this.getColNumber(), this.ctx, this.ctx.getTextWidth(width)), StrBuilder_To_String.create(), ArrayListStrategy.create() ); }