mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-03 04:06:23 -04:00
Use errorMessageListener instead of subscription to avoid repeated error popup display at startup
This commit is contained in:
parent
9869b64352
commit
e405d0e400
1 changed files with 12 additions and 12 deletions
|
@ -29,6 +29,7 @@ import io.bitsquare.gui.main.portfolio.pendingtrades.TradeSubView;
|
||||||
import io.bitsquare.gui.util.Layout;
|
import io.bitsquare.gui.util.Layout;
|
||||||
import io.bitsquare.trade.Trade;
|
import io.bitsquare.trade.Trade;
|
||||||
import io.bitsquare.user.Preferences;
|
import io.bitsquare.user.Preferences;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.scene.control.ProgressBar;
|
import javafx.scene.control.ProgressBar;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
@ -51,7 +52,6 @@ public abstract class TradeStepView extends AnchorPane {
|
||||||
protected final Preferences preferences;
|
protected final Preferences preferences;
|
||||||
protected final GridPane gridPane;
|
protected final GridPane gridPane;
|
||||||
|
|
||||||
private Subscription errorMessageSubscription;
|
|
||||||
private Subscription disputeStateSubscription;
|
private Subscription disputeStateSubscription;
|
||||||
private Subscription tradePeriodStateSubscription;
|
private Subscription tradePeriodStateSubscription;
|
||||||
protected int gridRow = 0;
|
protected int gridRow = 0;
|
||||||
|
@ -62,6 +62,7 @@ public abstract class TradeStepView extends AnchorPane {
|
||||||
protected TradeSubView.NotificationGroup notificationGroup;
|
protected TradeSubView.NotificationGroup notificationGroup;
|
||||||
private Subscription txIdSubscription;
|
private Subscription txIdSubscription;
|
||||||
private Clock.Listener clockListener;
|
private Clock.Listener clockListener;
|
||||||
|
private ChangeListener<String> errorMessageListener;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -82,6 +83,11 @@ public abstract class TradeStepView extends AnchorPane {
|
||||||
AnchorPane.setBottomAnchor(this, 0d);
|
AnchorPane.setBottomAnchor(this, 0d);
|
||||||
|
|
||||||
addContent();
|
addContent();
|
||||||
|
|
||||||
|
errorMessageListener = (observable, oldValue, newValue) -> {
|
||||||
|
if (newValue != null)
|
||||||
|
showSupportFields();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activate() {
|
public void activate() {
|
||||||
|
@ -92,22 +98,16 @@ public abstract class TradeStepView extends AnchorPane {
|
||||||
txIdSubscription = EasyBind.subscribe(model.dataModel.txId, id -> txIdTextField.setup(id));
|
txIdSubscription = EasyBind.subscribe(model.dataModel.txId, id -> txIdTextField.setup(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessageSubscription = EasyBind.subscribe(trade.errorMessageProperty(), newValue -> {
|
trade.errorMessageProperty().addListener(errorMessageListener);
|
||||||
if (newValue != null) {
|
|
||||||
showSupportFields();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
disputeStateSubscription = EasyBind.subscribe(trade.disputeStateProperty(), newValue -> {
|
disputeStateSubscription = EasyBind.subscribe(trade.disputeStateProperty(), newValue -> {
|
||||||
if (newValue != null) {
|
if (newValue != null)
|
||||||
updateDisputeState(newValue);
|
updateDisputeState(newValue);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tradePeriodStateSubscription = EasyBind.subscribe(trade.getTradePeriodStateProperty(), newValue -> {
|
tradePeriodStateSubscription = EasyBind.subscribe(trade.getTradePeriodStateProperty(), newValue -> {
|
||||||
if (newValue != null) {
|
if (newValue != null)
|
||||||
updateTradePeriodState(newValue);
|
updateTradePeriodState(newValue);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
clockListener = new Clock.Listener() {
|
clockListener = new Clock.Listener() {
|
||||||
|
@ -135,8 +135,8 @@ public abstract class TradeStepView extends AnchorPane {
|
||||||
if (txIdTextField != null)
|
if (txIdTextField != null)
|
||||||
txIdTextField.cleanup();
|
txIdTextField.cleanup();
|
||||||
|
|
||||||
if (errorMessageSubscription != null)
|
if (errorMessageListener != null)
|
||||||
errorMessageSubscription.unsubscribe();
|
trade.errorMessageProperty().removeListener(errorMessageListener);
|
||||||
|
|
||||||
if (disputeStateSubscription != null)
|
if (disputeStateSubscription != null)
|
||||||
disputeStateSubscription.unsubscribe();
|
disputeStateSubscription.unsubscribe();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue