public void newRowSeparator(Character character, boolean isTablewideSeparator) { Row row = new Row(this, character, isTablewideSeparator); rows.add(row); }
int maxNumCols = this.rowGroup.getNumCols(); .append(this.columns.get(i).buildColumn(this.rowGroup.getColSize(i), lastColumn)); if (!lastColumn) { stringBuffer.append(getColumnSeparator());
private void buildTable(TableBuilder.RowGroup rowGroup, TabularResultModel model) { TableBuilder.Row headerRow = rowGroup.newRow(); rowGroup.setColumnSeparator(" | "); rowGroup.newRowSeparator('-', false); Map<String, List<String>> rows = model.getContent(); if (!rows.isEmpty()) { // build table header first rows.keySet().forEach(c -> headerRow.newCenterCol(c)); // each row should have the same number of entries, so just look at the first one int rowCount = rows.values().iterator().next().size(); for (int i = 0; i < rowCount; i++) { TableBuilder.Row oneRow = rowGroup.newRow(); for (String column : rows.keySet()) { oneRow.newLeftCol(rows.get(column).get(i)); } } } }
newRow.newLeftCol(prefix + key).newLeftCol(value[0]); } else { if (value.length != 0) { // possible when object == CliConstants.LINE_SEPARATOR newRow.newLeftCol(prefix + key).newLeftCol(value[0]); for (int i = 1; i < value.length; i++) { newRow = rowGroup.newRow(); newRow.setColumnSeparator(" "); newRow.newLeftCol("").newLeftCol(value[i]); newRow.newLeftCol(prefix + key).newLeftCol("");
private void buildTable(RowGroup rowGroup, GfJsonObject content) throws GfJsonException { GfJsonArray columnNames = content.names(); int numOfColumns = columnNames.size(); Row headerRow = rowGroup.newRow(); rowGroup.setColumnSeparator(" | "); rowGroup.newRowSeparator('-', false); // build Table Header first for (int i = 0; i < numOfColumns; i++) { Object object = columnNames.get(i); if (ResultData.BYTE_DATA_ACCESSOR.equals(object)) { // skip file data if any continue; } headerRow.newCenterCol(object); } // Build remaining rows by extracting data column-wise from JSON object Row[] dataRows = null; for (int i = 0; i < numOfColumns; i++) { Object object = columnNames.get(i); if (ResultData.BYTE_DATA_ACCESSOR.equals(object)) { // skip file data if any continue; } GfJsonArray accumulatedData = content.getJSONArray((String) object); dataRows = buildRows(rowGroup, dataRows, accumulatedData); } }
private void buildData(TableBuilder.Table resultTable, DataResultModel section) { TableBuilder.RowGroup rowGroup = resultTable.newRowGroup(); rowGroup.setColumnSeparator(" : "); addRowInRowGroup(rowGroup, section.getHeader()); // finally process map values for (Map.Entry<String, String> entry : section.getContent().entrySet()) { TableBuilder.Row newRow = rowGroup.newRow(); String key = entry.getKey(); String value = entry.getValue(); String[] values = entry.getValue().split(GfshParser.LINE_SEPARATOR); if (values.length == 1) { newRow.newLeftCol(key).newLeftCol(values[0]); } else { if (values.length != 0) { // possible when object == CliConstants.LINE_SEPARATOR newRow.newLeftCol(key).newLeftCol(values[0]); for (int i = 1; i < values.length; i++) { newRow = rowGroup.newRow(); newRow.setColumnSeparator(" "); newRow.newLeftCol("").newLeftCol(values[i]); } } else { newRow.newLeftCol(key).newLeftCol(""); } } } addRowInRowGroup(rowGroup, section.getFooter()); }
private Row[] buildRows(RowGroup rowGroup, Row[] dataRows, GfJsonArray accumulatedData) throws GfJsonException { int size = accumulatedData.size(); // Initialize rows' array as required if (dataRows == null) { dataRows = new Row[size]; for (int j = 0; j < dataRows.length; j++) { dataRows[j] = rowGroup.newRow(); } } // Add data column-wise for (int j = 0; j < size; j++) { dataRows[j].newLeftCol(accumulatedData.get(j)); } return dataRows; }
private void addRowInRowGroup(TableBuilder.RowGroup rowGroup, String row) { if (row != null && !row.isEmpty()) { rowGroup.newRow().newLeftCol(row); } }
private void addHeaderInRowGroup(RowGroup rowGroup, GfJsonObject fromJsonObject) { String header = getHeader(fromJsonObject); if (header != null && !header.isEmpty()) { rowGroup.newRow().newLeftCol(header); } }
public Row newRow() { Row row = new Row(this); rows.add(row); return row; }
private void addSpacedRowInTable(TableBuilder.Table resultTable, String row) { if (row != null && !row.isEmpty()) { resultTable.newRow().newLeftCol(row); resultTable.newRow().newLeftCol(""); } }
private void addHeaderInTable(TableBuilder.Table resultTable, ResultModel model) { String header = model.getHeader(); if (header != null && !header.isEmpty()) { resultTable.newRow().newLeftCol(header); resultTable.newRow().newLeftCol(""); } }
private void buildInfoOrErrorCommandOutput(TableBuilder.Table resultTable, InfoResultModel model) { TableBuilder.RowGroup rowGroup = resultTable.newRowGroup(); addRowInRowGroup(rowGroup, model.getHeader()); model.getContent().forEach(c -> rowGroup.newRow().newLeftCol(c)); addRowInRowGroup(rowGroup, model.getFooter()); } }
private void addFooterInTable(Table resultTable, GfJsonObject fromJsonObject) { String footer = getFooter(fromJsonObject); if (footer != null && !footer.isEmpty()) { resultTable.newRow().newLeftCol(footer); } }
public void newBlankRow() { Row row = newRow(); row.newCenterCol(""); row.isBlank = true; }
private void addFooterInRowGroup(RowGroup rowGroup, GfJsonObject fromJsonObject) { String footer = getFooter(fromJsonObject); if (footer != null && !footer.isEmpty()) { rowGroup.newRow().newLeftCol(footer); } }
private void addHeaderInTable(Table resultTable, GfJsonObject fromJsonObject) { String header = getHeader(fromJsonObject); if (header != null && !header.isEmpty()) { resultTable.newRow().newLeftCol(header); } }