followup tweaks

This commit is contained in:
Craig Raw 2025-05-16 18:49:58 +02:00
parent c078aea3b4
commit 4ab9a9f681
2 changed files with 11 additions and 7 deletions

View file

@ -227,8 +227,9 @@ public class TransactionDiagram extends GridPane {
getChildren().clear(); getChildren().clear();
getChildren().addAll(inputsTypePane, inputsPane, inputsLinesPane, txPane, outputsLinesPane, outputsPane); getChildren().addAll(inputsTypePane, inputsPane, inputsLinesPane, txPane, outputsLinesPane, outputsPane);
if(!isFinal() && walletTx.getPayments().size() > 1) { List<Payment> defaultPayments = getDefaultPayments();
Pane totalsPane = getTotalsPane(); if(!isFinal() && defaultPayments.size() > 1) {
Pane totalsPane = getTotalsPane(defaultPayments);
GridPane.setConstraints(totalsPane, 2, 0, 3, 1); GridPane.setConstraints(totalsPane, 2, 0, 3, 1);
getChildren().add(totalsPane); getChildren().add(totalsPane);
} }
@ -620,6 +621,10 @@ public class TransactionDiagram extends GridPane {
} }
} }
private List<Payment> getDefaultPayments() {
return walletTx.getPayments().stream().filter(payment -> payment.getType() == Payment.Type.DEFAULT).toList();
}
private Pane getOutputsLines(List<Payment> displayedPayments) { private Pane getOutputsLines(List<Payment> displayedPayments) {
VBox pane = new VBox(); VBox pane = new VBox();
Group group = new Group(); Group group = new Group();
@ -843,19 +848,18 @@ public class TransactionDiagram extends GridPane {
return txPane; return txPane;
} }
private Pane getTotalsPane() { private Pane getTotalsPane(List<Payment> defaultPayments) {
VBox totalsBox = new VBox(); VBox totalsBox = new VBox();
totalsBox.setPadding(new Insets(0, 0, 15, 0)); totalsBox.setPadding(new Insets(0, 0, 15, 0));
totalsBox.setAlignment(Pos.CENTER); totalsBox.setAlignment(Pos.CENTER);
long amount = walletTx.getPayments().stream().mapToLong(Payment::getAmount).sum(); long amount = defaultPayments.stream().mapToLong(Payment::getAmount).sum();
long count = walletTx.getPayments().size();
HBox coinLabelBox = new HBox(); HBox coinLabelBox = new HBox();
coinLabelBox.setAlignment(Pos.CENTER); coinLabelBox.setAlignment(Pos.CENTER);
CoinLabel totalCoinLabel = new CoinLabel(); CoinLabel totalCoinLabel = new CoinLabel();
totalCoinLabel.setValue(amount); totalCoinLabel.setValue(amount);
coinLabelBox.getChildren().addAll(totalCoinLabel, new Label(" in "), new Label(Long.toString(count)), new Label(" payments")); coinLabelBox.getChildren().addAll(totalCoinLabel, new Label(" in "), new Label(Long.toString(defaultPayments.size())), new Label(" payments"));
totalsBox.getChildren().addAll(createSpacer(), coinLabelBox); totalsBox.getChildren().addAll(createSpacer(), coinLabelBox);
CurrencyRate currencyRate = AppServices.getFiatCurrencyExchangeRate(); CurrencyRate currencyRate = AppServices.getFiatCurrencyExchangeRate();

View file

@ -1625,7 +1625,7 @@ public class SendController extends WalletFormController implements Initializabl
} else if(payjoinPresent) { } else if(payjoinPresent) {
addLabel("Cannot fake coinjoin due to payjoin", getInfoGlyph()); addLabel("Cannot fake coinjoin due to payjoin", getInfoGlyph());
} else { } else {
if(utxoSelectorProperty().get() != null) { if(utxoSelectorProperty().get() != null && !(utxoSelectorProperty().get() instanceof MaxUtxoSelector)) {
addLabel("Cannot fake coinjoin due to coin control", getInfoGlyph()); addLabel("Cannot fake coinjoin due to coin control", getInfoGlyph());
} else { } else {
addLabel("Cannot fake coinjoin due to insufficient funds", getInfoGlyph()); addLabel("Cannot fake coinjoin due to insufficient funds", getInfoGlyph());