@Override public int getRowCount() { return TableModel.this.getColumnCount(); }
/** * Construct a new Table with the given model and customizers. * The passed in LinkedHashMap should be in reverse-insertion order (<i>i.e.</i> the first CellMatcher * found in iteration order will "win"). * * @see TableBuilder#build() */ /*package*/ Table(TableModel model, LinkedHashMap<CellMatcher, Formatter> formatters, LinkedHashMap<CellMatcher, SizeConstraints> sizeConstraints, LinkedHashMap<CellMatcher, TextWrapper> wrappers, LinkedHashMap<CellMatcher, Aligner> aligners, List<BorderSpecification> borderSpecifications) { this.model = model; this.formatters = formatters; this.sizeConstraints = sizeConstraints; this.wrappers = wrappers; this.aligners = aligners; this.borderSpecifications = borderSpecifications; rows = model.getRowCount(); columns = model.getColumnCount(); }
/** * Set a border on the outline of the whole table, around the first row and draw vertical lines * around each column. */ public TableBuilder addHeaderAndVerticalsBorders(BorderStyle style) { this.addBorder(0, 0, 1, model.getColumnCount(), OUTLINE, style); this.addBorder(0, 0, model.getRowCount(), model.getColumnCount(), OUTLINE | INNER_VERTICAL, style); return this; }
public TableBuilder toBottomRight() { return toRowColumn(model.getRowCount(), model.getColumnCount()); } }
/** * Set a border around each and every cell of the table. */ public TableBuilder addFullBorder(BorderStyle style) { this.addBorder(0, 0, model.getRowCount(), model.getColumnCount(), FULL, style); return this; }
/** * Set a border on the outline of the whole table. */ public TableBuilder addOutlineBorder(BorderStyle style) { this.addBorder(0, 0, model.getRowCount(), model.getColumnCount(), OUTLINE, style); return this; }
/** * Set a border on the outline of the whole table, as well as around the first row. */ public TableBuilder addHeaderBorder(BorderStyle style) { this.addBorder(0, 0, 1, model.getColumnCount(), OUTLINE, style); return addOutlineBorder(style); }
/** * Set a border on the inner verticals and horizontals of the table, but not on the outline. */ public TableBuilder addInnerBorder(BorderStyle style) { this.addBorder(0, 0, model.getRowCount(), model.getColumnCount(), INNER, style); return this; }
/** * Construct a table with the given model. The table will use the following * strategies for all cells, unless overridden:<ul> * <li>{@link DefaultFormatter default formatting} using {@literal toString()}</li> * <li>{@link AutoSizeConstraints sizing strategy} trying to use the maximum space, resorting to splitting lines on * spaces</li> * <li>{@link DelimiterTextWrapper wrapping text} on space characters</li> * <li>{@link SimpleHorizontalAligner left aligning} text.</li> * </ul> */ public TableBuilder(TableModel model) { this.model = model; rows = model.getRowCount(); columns = model.getColumnCount(); formatters.put(CellMatchers.table(), new DefaultFormatter()); sizeConstraints.put(CellMatchers.table(), new AutoSizeConstraints()); wrappers.put(CellMatchers.table(), new DelimiterTextWrapper()); aligners.put(CellMatchers.table(), left); }
for (int i = 2; i < model.getRowCount(); i++) { if (splits.contains(i)) { builder.paintBorder(BorderStyle.fancy_light, BorderSpecification.TOP).fromRowColumn(i, 0).toRowColumn(i + 1, model.getColumnCount()); model.getColumnCount());
for (int i = 2; i < model.getRowCount(); i++) { if (splits.contains(i)) { builder.paintBorder(BorderStyle.fancy_light, BorderSpecification.TOP).fromRowColumn(i, 0).toRowColumn(i + 1, model.getColumnCount()); model.getColumnCount());
.addWrapper(new KeyValueTextWrapper(": ")); rowsWithThinSeparators.forEach(row -> builder.paintBorder(BorderStyle.fancy_light_quadruple_dash, BorderSpecification.TOP) .fromRowColumn(row, 0).toRowColumn(row + 1, builder.getModel().getColumnCount()));
.addWrapper(new KeyValueTextWrapper(": ")); rowsWithThinSeparators.forEach(row -> builder.paintBorder(BorderStyle.fancy_light_quadruple_dash, BorderSpecification.TOP) .fromRowColumn(row, 0).toRowColumn(row + 1, builder.getModel().getColumnCount()));