Improve funding button handling

This commit is contained in:
Manfred Karrer 2016-03-30 13:50:32 +02:00
parent a9a711f68b
commit a79b4cc82b

View file

@ -268,6 +268,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
currencyComboBox.setMouseTransparent(true); currencyComboBox.setMouseTransparent(true);
paymentAccountsComboBox.setMouseTransparent(true); paymentAccountsComboBox.setMouseTransparent(true);
fundingHBox.visibleProperty().bind(model.dataModel.isWalletFunded.not());
fundingHBox.managedProperty().bind(model.dataModel.isWalletFunded.not());
if (!BitsquareApp.DEV_MODE) { if (!BitsquareApp.DEV_MODE) {
String key = "securityDepositInfo"; String key = "securityDepositInfo";
new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" +
@ -312,8 +315,6 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
qrCodeImageView.setVisible(true); qrCodeImageView.setVisible(true);
balanceLabel.setVisible(true); balanceLabel.setVisible(true);
balanceTextField.setVisible(true); balanceTextField.setVisible(true);
fundingHBox.setVisible(true);
placeOfferButton.setVisible(true);
cancelButton2.setVisible(true); cancelButton2.setVisible(true);
//root.requestFocus(); //root.requestFocus();
@ -404,9 +405,10 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
volumeTextField.validationResultProperty().bind(model.volumeValidationResult); volumeTextField.validationResultProperty().bind(model.volumeValidationResult);
// buttons // buttons
placeOfferButton.visibleProperty().bind(model.dataModel.isWalletFunded);
placeOfferButton.managedProperty().bind(model.dataModel.isWalletFunded);
placeOfferButton.disableProperty().bind(model.isPlaceOfferButtonDisabled); placeOfferButton.disableProperty().bind(model.isPlaceOfferButtonDisabled);
cancelButton2.disableProperty().bind(model.cancelButtonDisabled); cancelButton2.disableProperty().bind(model.cancelButtonDisabled);
fundingHBox.disableProperty().bind(model.dataModel.isWalletFunded);
// payment account // payment account
currencyComboBox.prefWidthProperty().bind(paymentAccountsComboBox.widthProperty()); currencyComboBox.prefWidthProperty().bind(paymentAccountsComboBox.widthProperty());
@ -436,9 +438,12 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
minAmountTextField.validationResultProperty().unbind(); minAmountTextField.validationResultProperty().unbind();
priceTextField.validationResultProperty().unbind(); priceTextField.validationResultProperty().unbind();
volumeTextField.validationResultProperty().unbind(); volumeTextField.validationResultProperty().unbind();
fundingHBox.visibleProperty().unbind();
fundingHBox.managedProperty().unbind();
placeOfferButton.visibleProperty().unbind();
placeOfferButton.managedProperty().unbind();
placeOfferButton.disableProperty().unbind(); placeOfferButton.disableProperty().unbind();
cancelButton2.disableProperty().unbind(); cancelButton2.disableProperty().unbind();
fundingHBox.disableProperty().unbind();
currencyComboBox.managedProperty().unbind(); currencyComboBox.managedProperty().unbind();
currencyComboBoxLabel.visibleProperty().unbind(); currencyComboBoxLabel.visibleProperty().unbind();
currencyComboBoxLabel.managedProperty().unbind(); currencyComboBoxLabel.managedProperty().unbind();
@ -758,12 +763,12 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
balanceTextField = balanceTuple.second; balanceTextField = balanceTuple.second;
balanceTextField.setVisible(false); balanceTextField.setVisible(false);
fundingHBox = new HBox(); fundingHBox = new HBox();
fundingHBox.setVisible(false);
fundingHBox.setManaged(false);
fundingHBox.setSpacing(10); fundingHBox.setSpacing(10);
fundFromSavingsWalletButton = new Button("Transfer funds from Bitsquare wallet"); fundFromSavingsWalletButton = new Button("Transfer funds from Bitsquare wallet");
fundFromSavingsWalletButton.setDefaultButton(true); fundFromSavingsWalletButton.setDefaultButton(true);
fundingHBox.setVisible(false);
fundFromSavingsWalletButton.setDefaultButton(false); fundFromSavingsWalletButton.setDefaultButton(false);
fundFromSavingsWalletButton.setOnAction(e -> model.useSavingsWalletForFunding()); fundFromSavingsWalletButton.setOnAction(e -> model.useSavingsWalletForFunding());
Label label = new Label("OR"); Label label = new Label("OR");
@ -786,8 +791,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
gridPane.getChildren().add(fundingHBox); gridPane.getChildren().add(fundingHBox);
placeOfferButton = addButton(gridPane, ++gridRow, ""); placeOfferButton = addButtonAfterGroup(gridPane, gridRow, "");
placeOfferButton.setVisible(false);
placeOfferButton.setOnAction(e -> onPlaceOffer()); placeOfferButton.setOnAction(e -> onPlaceOffer());
placeOfferButton.setMinHeight(40); placeOfferButton.setMinHeight(40);
placeOfferButton.setPadding(new Insets(0, 20, 0, 20)); placeOfferButton.setPadding(new Insets(0, 20, 0, 20));
@ -811,7 +815,6 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
}); });
cancelButton2.setDefaultButton(false); cancelButton2.setDefaultButton(false);
cancelButton2.setVisible(false); cancelButton2.setVisible(false);
cancelButton2.setId("cancel-button");
} }
@NotNull @NotNull