* @param values The initial values to write. Each row written to this table
* writer is written to the base writer with these values prefixed.
*/
public PrefixedTableWriter(TableWriter writer, List<?> values) {
baseWriter = writer;
TableLayout baseLayout = writer.getLayout();
if (values.size() > baseLayout.getColumnCount()) {
throw new IllegalArgumentException("Value array too wide");
}
rowData = new ObjectArrayList<Object>(writer.getLayout().getColumnCount());
rowData.addAll(values);
fixedColumns = values.size();
TableLayoutBuilder bld = new TableLayoutBuilder();
List<String> bheaders = baseLayout.getColumns();
for (String h : bheaders.subList(fixedColumns, bheaders.size())) {
bld.addColumn(h);
}
layout = bld.build();
assert layout.getColumnCount() + rowData.size() == writer.getLayout().getColumnCount();