Skip to content

Commit

Permalink
Improve funding button handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Mar 30, 2016
1 parent a9a711f commit a79b4cc
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ private void onShowPayFundsScreen() {
currencyComboBox.setMouseTransparent(true);
paymentAccountsComboBox.setMouseTransparent(true);

fundingHBox.visibleProperty().bind(model.dataModel.isWalletFunded.not());
fundingHBox.managedProperty().bind(model.dataModel.isWalletFunded.not());

if (!BitsquareApp.DEV_MODE) {
String key = "securityDepositInfo";
new Popup().backgroundInfo("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" +
Expand Down Expand Up @@ -312,8 +315,6 @@ private void onShowPayFundsScreen() {
qrCodeImageView.setVisible(true);
balanceLabel.setVisible(true);
balanceTextField.setVisible(true);
fundingHBox.setVisible(true);
placeOfferButton.setVisible(true);
cancelButton2.setVisible(true);
//root.requestFocus();

Expand Down Expand Up @@ -404,9 +405,10 @@ private void addBindings() {
volumeTextField.validationResultProperty().bind(model.volumeValidationResult);

// buttons
placeOfferButton.visibleProperty().bind(model.dataModel.isWalletFunded);
placeOfferButton.managedProperty().bind(model.dataModel.isWalletFunded);
placeOfferButton.disableProperty().bind(model.isPlaceOfferButtonDisabled);
cancelButton2.disableProperty().bind(model.cancelButtonDisabled);
fundingHBox.disableProperty().bind(model.dataModel.isWalletFunded);

// payment account
currencyComboBox.prefWidthProperty().bind(paymentAccountsComboBox.widthProperty());
Expand Down Expand Up @@ -436,9 +438,12 @@ private void removeBindings() {
minAmountTextField.validationResultProperty().unbind();
priceTextField.validationResultProperty().unbind();
volumeTextField.validationResultProperty().unbind();
fundingHBox.visibleProperty().unbind();
fundingHBox.managedProperty().unbind();
placeOfferButton.visibleProperty().unbind();
placeOfferButton.managedProperty().unbind();
placeOfferButton.disableProperty().unbind();
cancelButton2.disableProperty().unbind();
fundingHBox.disableProperty().unbind();
currencyComboBox.managedProperty().unbind();
currencyComboBoxLabel.visibleProperty().unbind();
currencyComboBoxLabel.managedProperty().unbind();
Expand Down Expand Up @@ -758,12 +763,12 @@ private void addFundingGroup() {
balanceTextField = balanceTuple.second;
balanceTextField.setVisible(false);


fundingHBox = new HBox();
fundingHBox.setVisible(false);
fundingHBox.setManaged(false);
fundingHBox.setSpacing(10);
fundFromSavingsWalletButton = new Button("Transfer funds from Bitsquare wallet");
fundFromSavingsWalletButton.setDefaultButton(true);
fundingHBox.setVisible(false);
fundFromSavingsWalletButton.setDefaultButton(false);
fundFromSavingsWalletButton.setOnAction(e -> model.useSavingsWalletForFunding());
Label label = new Label("OR");
Expand All @@ -786,8 +791,7 @@ private void addFundingGroup() {
gridPane.getChildren().add(fundingHBox);


placeOfferButton = addButton(gridPane, ++gridRow, "");
placeOfferButton.setVisible(false);
placeOfferButton = addButtonAfterGroup(gridPane, gridRow, "");
placeOfferButton.setOnAction(e -> onPlaceOffer());
placeOfferButton.setMinHeight(40);
placeOfferButton.setPadding(new Insets(0, 20, 0, 20));
Expand All @@ -811,7 +815,6 @@ private void addFundingGroup() {
});
cancelButton2.setDefaultButton(false);
cancelButton2.setVisible(false);
cancelButton2.setId("cancel-button");
}

@NotNull
Expand Down

0 comments on commit a79b4cc

Please sign in to comment.