@@ -0,0 +1,2536 @@
+/*%0A * This file is part of Bisq.%0A *%0A * Bisq is free software: you can redistribute it and/or modify it%0A * under the terms of the GNU Affero General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or (at%0A * your option) any later version.%0A *%0A * Bisq is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or%0A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public%0A * License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with Bisq. If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage bisq.cli.table.column;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.function.Predicate;%0Aimport java.util.stream.IntStream;%0A%0Aimport static bisq.cli.table.column.Column.JUSTIFICATION.RIGHT;%0A%0A/**%0A * For displaying Integer values.%0A */%0Apublic class IntegerColumn extends NumberColumn%3CIntegerColumn, Integer%3E %7B%0A%0A    protected final List%3CInteger%3E rows = new ArrayList%3C%3E();%0A%0A    protected final Predicate%3CString%3E isNewMaxWidth = (s) -%3E s != null && !s.isEmpty() && s.length() %3E maxWidth;%0A%0A    // The default IntegerColumn JUSTIFICATION is RIGHT.%0A    public IntegerColumn(String name) %7B%0A        this(name, RIGHT);%0A    %7D%0A%0A    public IntegerColumn(String name, JUSTIFICATION justification) %7B%0A        super(name, justification);%0A        this.maxWidth = name.length();%0A    %7D%0A%0A    @Override%0A    public void addRow(Integer value) %7B%0A        rows.add(value);%0A%0A        String s = String.valueOf(value);%0A        if (isNewMaxWidth.test(s))%0A            maxWidth = s.length();%0A    %7D%0A%0A    @Override%0A    public List%3CInteger%3E getRows() %7B%0A        return rows;%0A    %7D%0A%0A    @Override%0A    public int rowCount() %7B%0A        return rows.size();%0A    %7D%0A%0A    @Override%0A    public boolean isEmpty() %7B%0A        return rows.isEmpty();%0A    %7D%0A%0A    @Override%0A    public Integer getRow(int rowIndex) %7B%0A        return rows.get(rowIndex);%0A    %7D%0A%0A    @Override%0A    public void updateRow(int rowIndex, Integer newValue) %7B%0A        rows.set(rowIndex, newValue);%0A    %7D%0A%0A    @Override%0A    public String getRowAsFormattedString(int rowIndex) %7B%0A        String s = String.valueOf(getRow(rowIndex));%0A        return toJustifiedString(s);%0A    %7D%0A%0A    @Override%0A    public StringColumn asStringColumn() %7B%0A        IntStream.range(0, rows.size()).forEachOrdered(rowIndex -%3E%0A                stringColumn.addRow(getRowAsFormattedString(rowIndex)));%0A%0A        return stringColumn;%0A    %7D%0A%7D%0A

Add CLI output IntegerColumn