mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Deactivate close tab button when funds are paid (#130)
This commit is contained in:
parent
e459ce8419
commit
704230fbdd
5 changed files with 23 additions and 6 deletions
|
@ -188,8 +188,8 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
|
|||
createOfferViewCB = loader.getController();
|
||||
createOfferViewCB.setParent(this);
|
||||
createOfferViewCB.initWithData(direction, amount, price);
|
||||
createOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
|
||||
final Tab tab = new Tab("Create offer");
|
||||
createOfferViewCB.configCloseHandlers(this::onCreateOfferViewRemoved, tab.closableProperty());
|
||||
tab.setContent(createOfferView);
|
||||
tabPane.getTabs().add(tab);
|
||||
tabPane.getSelectionModel().select(tab);
|
||||
|
@ -204,8 +204,8 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
|
|||
takeOfferViewCB = loader.getController();
|
||||
takeOfferViewCB.setParent(this);
|
||||
takeOfferViewCB.initWithData(direction, amount, offer);
|
||||
takeOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
|
||||
final Tab tab = new Tab("Take offer");
|
||||
takeOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved, tab.closableProperty());
|
||||
tab.setContent(takeOfferView);
|
||||
tabPane.getTabs().add(tab);
|
||||
tabPane.getSelectionModel().select(tab);
|
||||
|
|
|
@ -81,6 +81,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
|||
final BooleanProperty showWarningInvalidFiatDecimalPlaces = new SimpleBooleanProperty();
|
||||
final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
|
||||
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
|
||||
final BooleanProperty tabIsClosable = new SimpleBooleanProperty(true);
|
||||
|
||||
final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<InputValidator.ValidationResult> minAmountValidationResult = new
|
||||
|
@ -347,8 +348,10 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
|||
updateButtonDisableState();
|
||||
});
|
||||
model.isWalletFunded.addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue)
|
||||
if (newValue) {
|
||||
updateButtonDisableState();
|
||||
tabIsClosable.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
// Binding with Bindings.createObjectBinding does not work because of bi-directional binding
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.ResourceBundle;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.HPos;
|
||||
|
@ -79,6 +80,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
|
|||
private final Navigation navigation;
|
||||
private final OverlayManager overlayManager;
|
||||
private CloseListener closeListener;
|
||||
private BooleanProperty tabIsClosable;
|
||||
|
||||
private boolean detailsVisible;
|
||||
private boolean advancedScreenInited;
|
||||
|
@ -143,6 +145,8 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
|
|||
@SuppressWarnings("EmptyMethod")
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
|
||||
tabIsClosable.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -169,10 +173,13 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
|
|||
imageView.setId("image-sell-large");
|
||||
}
|
||||
|
||||
public void setCloseListener(CloseListener closeListener) {
|
||||
public void configCloseHandlers(CloseListener closeListener, BooleanProperty tabIsClosable) {
|
||||
this.closeListener = closeListener;
|
||||
this.tabIsClosable = tabIsClosable;
|
||||
tabIsClosable.bind(presentationModel.tabIsClosable);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI Handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -80,6 +80,7 @@ class TakeOfferPM extends PresentationModel<TakeOfferModel> {
|
|||
final BooleanProperty isTakeOfferButtonDisabled = new SimpleBooleanProperty(true);
|
||||
final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
|
||||
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
|
||||
final BooleanProperty tabIsClosable = new SimpleBooleanProperty(true);
|
||||
|
||||
final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>();
|
||||
|
||||
|
@ -322,8 +323,10 @@ class TakeOfferPM extends PresentationModel<TakeOfferModel> {
|
|||
});
|
||||
|
||||
model.isWalletFunded.addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue)
|
||||
if (newValue) {
|
||||
updateButtonDisableState();
|
||||
tabIsClosable.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
// Binding with Bindings.createObjectBinding does not work because of bi-directional binding
|
||||
|
|
|
@ -45,6 +45,7 @@ import java.util.ResourceBundle;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.HPos;
|
||||
|
@ -74,6 +75,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
|
|||
private final Navigation navigation;
|
||||
private final OverlayManager overlayManager;
|
||||
private CloseListener closeListener;
|
||||
private BooleanProperty tabIsClosable;
|
||||
|
||||
private boolean detailsVisible;
|
||||
private boolean advancedScreenInited;
|
||||
|
@ -184,8 +186,10 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
|
|||
acceptedArbitratorsTextField.setText(presentationModel.getAcceptedArbitrators());
|
||||
}
|
||||
|
||||
public void setCloseListener(CloseListener closeListener) {
|
||||
public void setCloseListener(CloseListener closeListener, BooleanProperty tabIsClosable) {
|
||||
this.closeListener = closeListener;
|
||||
this.tabIsClosable = tabIsClosable;
|
||||
tabIsClosable.bind(presentationModel.tabIsClosable);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue