mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-18 23:06:02 -04:00
Fix missing remove listener (Should fix #280 - not reproducible yet)
This commit is contained in:
parent
ee310fc4ae
commit
b87a27922a
@ -40,6 +40,7 @@ public class TxIdTextField extends AnchorPane {
|
||||
private final Tooltip progressIndicatorTooltip;
|
||||
private final ConfidenceProgressIndicator progressIndicator;
|
||||
private final Label copyIcon;
|
||||
private TxConfidenceListener txConfidenceListener;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -78,6 +79,18 @@ public class TxIdTextField extends AnchorPane {
|
||||
}
|
||||
|
||||
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.setOnMouseClicked(mouseEvent -> {
|
||||
try {
|
||||
@ -91,16 +104,9 @@ public class TxIdTextField extends AnchorPane {
|
||||
});
|
||||
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -110,7 +116,6 @@ public class TxIdTextField extends AnchorPane {
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private void updateConfidence(TransactionConfidence confidence) {
|
||||
if (confidence != null) {
|
||||
switch (confidence.getConfidenceType()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user