further followup tweaks

This commit is contained in:
Craig Raw 2025-05-19 09:11:12 +02:00
parent 4ab9a9f681
commit db478f8da6
2 changed files with 11 additions and 9 deletions

View file

@ -227,9 +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);
List<Payment> defaultPayments = getDefaultPayments(); List<Payment> userPayments = getUserPayments();
if(!isFinal() && defaultPayments.size() > 1) { if(!isFinal() && userPayments.size() > 1) {
Pane totalsPane = getTotalsPane(defaultPayments); Pane totalsPane = getTotalsPane(userPayments);
GridPane.setConstraints(totalsPane, 2, 0, 3, 1); GridPane.setConstraints(totalsPane, 2, 0, 3, 1);
getChildren().add(totalsPane); getChildren().add(totalsPane);
} }
@ -621,8 +621,8 @@ public class TransactionDiagram extends GridPane {
} }
} }
private List<Payment> getDefaultPayments() { private List<Payment> getUserPayments() {
return walletTx.getPayments().stream().filter(payment -> payment.getType() == Payment.Type.DEFAULT).toList(); return walletTx.getPayments().stream().filter(payment -> payment.getType() == Payment.Type.DEFAULT || payment.getType() == Payment.Type.ANCHOR).toList();
} }
private Pane getOutputsLines(List<Payment> displayedPayments) { private Pane getOutputsLines(List<Payment> displayedPayments) {
@ -848,18 +848,18 @@ public class TransactionDiagram extends GridPane {
return txPane; return txPane;
} }
private Pane getTotalsPane(List<Payment> defaultPayments) { private Pane getTotalsPane(List<Payment> userPayments) {
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 = defaultPayments.stream().mapToLong(Payment::getAmount).sum(); long amount = userPayments.stream().mapToLong(Payment::getAmount).sum();
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(defaultPayments.size())), new Label(" payments")); coinLabelBox.getChildren().addAll(totalCoinLabel, new Label(" in "), new Label(Long.toString(userPayments.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,9 @@ 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 && !(utxoSelectorProperty().get() instanceof MaxUtxoSelector)) { if(utxoSelectorProperty().get() instanceof MaxUtxoSelector) {
addLabel("Cannot fake coinjoin with max amount selected", getInfoGlyph());
} else if(utxoSelectorProperty().get() != null) {
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());