mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-29 09:48:46 -04:00
Fix missing remove listener (Should fix #280 - not reproducible yet)
This commit is contained in:
parent
ee310fc4ae
commit
b87a27922a
1 changed files with 14 additions and 9 deletions
|
@ -40,6 +40,7 @@ public class TxIdTextField extends AnchorPane {
|
||||||
private final Tooltip progressIndicatorTooltip;
|
private final Tooltip progressIndicatorTooltip;
|
||||||
private final ConfidenceProgressIndicator progressIndicator;
|
private final ConfidenceProgressIndicator progressIndicator;
|
||||||
private final Label copyIcon;
|
private final Label copyIcon;
|
||||||
|
private TxConfidenceListener txConfidenceListener;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -78,6 +79,18 @@ public class TxIdTextField extends AnchorPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup(WalletService walletService, String txID) {
|
public void setup(WalletService walletService, String txID) {
|
||||||
|
if (txConfidenceListener != null)
|
||||||
|
walletService.removeTxConfidenceListener(txConfidenceListener);
|
||||||
|
|
||||||
|
txConfidenceListener = new TxConfidenceListener(txID) {
|
||||||
|
@Override
|
||||||
|
public void onTransactionConfidenceChanged(TransactionConfidence confidence) {
|
||||||
|
updateConfidence(confidence);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
walletService.addTxConfidenceListener(txConfidenceListener);
|
||||||
|
updateConfidence(walletService.getConfidenceForTxId(txID));
|
||||||
|
|
||||||
textField.setText(txID);
|
textField.setText(txID);
|
||||||
textField.setOnMouseClicked(mouseEvent -> {
|
textField.setOnMouseClicked(mouseEvent -> {
|
||||||
try {
|
try {
|
||||||
|
@ -91,15 +104,8 @@ public class TxIdTextField extends AnchorPane {
|
||||||
});
|
});
|
||||||
|
|
||||||
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(txID));
|
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(txID));
|
||||||
|
}
|
||||||
|
|
||||||
walletService.addTxConfidenceListener(new TxConfidenceListener(txID) {
|
|
||||||
@Override
|
|
||||||
public void onTransactionConfidenceChanged(TransactionConfidence confidence) {
|
|
||||||
updateConfidence(confidence);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
updateConfidence(walletService.getConfidenceForTxId(txID));
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Getters/Setters
|
// Getters/Setters
|
||||||
|
@ -110,7 +116,6 @@ public class TxIdTextField extends AnchorPane {
|
||||||
// Private
|
// Private
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
private void updateConfidence(TransactionConfidence confidence) {
|
private void updateConfidence(TransactionConfidence confidence) {
|
||||||
if (confidence != null) {
|
if (confidence != null) {
|
||||||
switch (confidence.getConfidenceType()) {
|
switch (confidence.getConfidenceType()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue