From 12dec2c3213739d3a2e89984d08e571a1ce8afc0 Mon Sep 17 00:00:00 2001 From: cd2357 Date: Fri, 1 May 2020 19:56:21 +0200 Subject: [PATCH] BondsView: Fix sorting of numeric columns The table in the BondsView uses string sorting by default. This results in unexpected behavior when sorting non-string columns. This commit adds custom comparators to the numeric columns to address that. Fixes #3231 --- .../java/bisq/desktop/main/dao/bonding/bonds/BondsView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java index 93d736e03f7..60be0740629 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java @@ -169,6 +169,7 @@ private void addColumns() { column = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", "BSQ")); column.setMinWidth(80); column.getStyleClass().add("first-column"); + column.setComparator(Comparator.comparingLong(v -> v.getBond().getAmount())); column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory(new Callback<>() { @Override @@ -189,6 +190,7 @@ public void updateItem(final BondListItem item, boolean empty) { tableView.getColumns().add(column); column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockTime")); column.setMinWidth(40); + column.setComparator(Comparator.comparingInt(v -> v.getBond().getLockTime())); column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory(new Callback<>() { @Override @@ -287,6 +289,7 @@ public void updateItem(final BondListItem item, boolean empty) { column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockupDate")); column.setMinWidth(140); + column.setComparator(Comparator.comparingLong(v -> v.getBond().getLockupDate())); column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory(new Callback<>() { @Override