private void buildTabularCommandOutput(TableBuilder.Table resultTable, TabularResultModel model) { addSpacedRowInTable(resultTable, model.getHeader()); resultTable.setColumnSeparator(" "); resultTable.setTabularResult(true); TableBuilder.RowGroup rowGroup = resultTable.newRowGroup(); buildTable(rowGroup, model); addSpacedRowInTable(resultTable, model.getFooter()); }
private void buildCommandOutput() { commandOutputIndex = 0; commandOutput = new ArrayList<>(); TableBuilder.Table resultTable = TableBuilder.newTable(); addSpacedRowInTable(resultTable, result.getHeader()); int index = 0; int sectionSize = result.getContent().size(); for (AbstractResultModel section : result.getContent().values()) { index++; if (section instanceof DataResultModel) { buildData(resultTable, (DataResultModel) section); } else if (section instanceof TabularResultModel) { buildTabularCommandOutput(resultTable, (TabularResultModel) section); } else if (section instanceof InfoResultModel) { buildInfoOrErrorCommandOutput(resultTable, (InfoResultModel) section); } else { throw new IllegalArgumentException( "Unable to process output for " + section.getClass().getName()); } // only add the spacer in between the sections. if (index < sectionSize) { addSpacedRowInTable(resultTable, LINE_SEPARATOR); } } addSpacedRowInTable(resultTable, result.getFooter()); commandOutput.addAll(resultTable.buildTableList()); }