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