mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #6666 from stejbac/fix-npe-from-burningmanview-comparators
Fix NPE from BurningManView column comparators
This commit is contained in:
commit
c8c256f958
@ -36,7 +36,6 @@ import com.google.common.base.Joiner;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -90,7 +89,7 @@ class BalanceEntryItem {
|
||||
receivedBtc = Optional.of(monthlyBalanceEntry.getReceivedBtc());
|
||||
burnedBsq = Optional.of(-monthlyBalanceEntry.getBurnedBsq());
|
||||
type = monthlyBalanceEntry.getTypes().size() == 1 ?
|
||||
Optional.of(new ArrayList<>(monthlyBalanceEntry.getTypes()).get(0)) :
|
||||
Optional.of(monthlyBalanceEntry.getTypes().iterator().next()) :
|
||||
Optional.empty();
|
||||
} else if (balanceEntry instanceof BurnedBsqBalanceEntry) {
|
||||
BurnedBsqBalanceEntry burnedBsqBalanceEntry = (BurnedBsqBalanceEntry) balanceEntry;
|
||||
|
@ -211,9 +211,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
};
|
||||
|
||||
amountInputTextFieldListener = (observable, oldValue, newValue) -> {
|
||||
updateButtonState();
|
||||
};
|
||||
amountInputTextFieldListener = (observable, oldValue, newValue) -> updateButtonState();
|
||||
|
||||
burningmenSelectionListener = (observable, oldValue, newValue) -> {
|
||||
boolean isValueSet = newValue != null;
|
||||
@ -1026,7 +1024,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getBurnTarget));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getBurnTarget));
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.expectedRevenue"));
|
||||
column.setMinWidth(140);
|
||||
@ -1049,7 +1047,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getExpectedRevenue));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getExpectedRevenue));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.burnAmountShare.label"));
|
||||
@ -1075,7 +1073,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getCappedBurnAmountShare));
|
||||
column.setComparator(Comparator.comparingDouble(BurningManListItem::getCappedBurnAmountShare));
|
||||
burningManTableView.getSortOrder().add(column);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.decayedBurnAmount"));
|
||||
@ -1099,7 +1097,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getAccumulatedDecayedBurnAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getAccumulatedDecayedBurnAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setVisible(false);
|
||||
|
||||
@ -1124,7 +1122,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getAccumulatedBurnAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getAccumulatedBurnAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.issuanceShare"));
|
||||
@ -1148,7 +1146,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getCompensationShare));
|
||||
column.setComparator(Comparator.comparingDouble(BurningManListItem::getCompensationShare));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.decayedIssuanceAmount"));
|
||||
@ -1172,7 +1170,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getAccumulatedDecayedCompensationAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getAccumulatedDecayedCompensationAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setVisible(false);
|
||||
|
||||
@ -1197,7 +1195,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurningManListItem::getAccumulatedCompensationAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurningManListItem::getAccumulatedCompensationAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
|
||||
@ -1228,7 +1226,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
});
|
||||
burnOutputsTableView.getColumns().add(column);
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparing(BurnOutputListItem::getDate));
|
||||
column.setComparator(Comparator.comparingLong(BurnOutputListItem::getDate));
|
||||
burnOutputsTableView.getSortOrder().add(column);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.cycle"));
|
||||
@ -1253,7 +1251,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burnOutputsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurnOutputListItem::getCycleIndex));
|
||||
column.setComparator(Comparator.comparingInt(BurnOutputListItem::getCycleIndex));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.height"));
|
||||
@ -1278,7 +1276,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burnOutputsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurnOutputListItem::getHeight));
|
||||
column.setComparator(Comparator.comparingInt(BurnOutputListItem::getHeight));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.decayedBurnAmount"));
|
||||
@ -1302,7 +1300,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burnOutputsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurnOutputListItem::getDecayedAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurnOutputListItem::getDecayedAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.burnAmount"));
|
||||
@ -1326,7 +1324,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
burnOutputsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BurnOutputListItem::getAmount));
|
||||
column.setComparator(Comparator.comparingLong(BurnOutputListItem::getAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
|
||||
@ -1380,7 +1378,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtc().orElse(null)));
|
||||
column.setComparator(Comparator.comparingLong(e -> e.getReceivedBtc().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.price"));
|
||||
@ -1404,7 +1402,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getPrice().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getPrice().orElse(null),
|
||||
Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.receivedBtcAsBsq"));
|
||||
@ -1428,7 +1427,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtcAsBsq().orElse(null)));
|
||||
column.setComparator(Comparator.comparingLong(e -> e.getReceivedBtcAsBsq().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.burnedBsq"));
|
||||
@ -1452,8 +1451,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getBurnedBsq().orElse(null)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparingLong(e -> e.getBurnedBsq().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.ASCENDING);
|
||||
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.revenue"));
|
||||
@ -1477,7 +1476,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(BalanceEntryItem::getRevenue));
|
||||
column.setComparator(Comparator.comparingLong(BalanceEntryItem::getRevenue));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.type"));
|
||||
@ -1501,7 +1500,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getType().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getType().orElse(null),
|
||||
Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
|
||||
@ -1533,7 +1533,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
});
|
||||
compensationsTableView.getColumns().add(column);
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparing(CompensationListItem::getDate));
|
||||
column.setComparator(Comparator.comparingLong(CompensationListItem::getDate));
|
||||
compensationsTableView.getSortOrder().add(column);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.cycle"));
|
||||
@ -1558,7 +1558,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
compensationsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(CompensationListItem::getCycleIndex));
|
||||
column.setComparator(Comparator.comparingInt(CompensationListItem::getCycleIndex));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.height"));
|
||||
@ -1583,7 +1583,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
compensationsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(CompensationListItem::getHeight));
|
||||
column.setComparator(Comparator.comparingInt(CompensationListItem::getHeight));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.decayedIssuanceAmount"));
|
||||
@ -1608,7 +1608,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
compensationsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(CompensationListItem::getDecayedAmount));
|
||||
column.setComparator(Comparator.comparingLong(CompensationListItem::getDecayedAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.issuanceAmount"));
|
||||
@ -1632,7 +1632,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
compensationsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(CompensationListItem::getAmount));
|
||||
column.setComparator(Comparator.comparingLong(CompensationListItem::getAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
|
||||
@ -1663,7 +1663,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
});
|
||||
reimbursementsTableView.getColumns().add(column);
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparing(ReimbursementListItem::getDate));
|
||||
column.setComparator(Comparator.comparingLong(ReimbursementListItem::getDate));
|
||||
reimbursementsTableView.getSortOrder().add(column);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.height"));
|
||||
@ -1687,7 +1687,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
reimbursementsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(ReimbursementListItem::getHeight));
|
||||
column.setComparator(Comparator.comparingInt(ReimbursementListItem::getHeight));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.shared.table.cycle"));
|
||||
@ -1711,7 +1711,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
reimbursementsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(ReimbursementListItem::getCycleIndex));
|
||||
column.setComparator(Comparator.comparingInt(ReimbursementListItem::getCycleIndex));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.reimbursedAmount"));
|
||||
@ -1735,7 +1735,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
reimbursementsTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(ReimbursementListItem::getAmount));
|
||||
column.setComparator(Comparator.comparingLong(ReimbursementListItem::getAmount));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user