Search in sources :

Example 6 with BusyAnimation

use of io.bitsquare.gui.components.BusyAnimation in project bitsquare by bitsquare.

the class BuyerStep2View method addContent.

///////////////////////////////////////////////////////////////////////////////////////////
// Content
///////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
    addTradeInfoBlock();
    PaymentAccountContractData paymentAccountContractData = model.dataModel.getSellersPaymentAccountContractData();
    String paymentMethodName = paymentAccountContractData != null ? paymentAccountContractData.getPaymentMethodName() : "";
    TitledGroupBg accountTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 1, "Start payment using " + BSResources.get(paymentMethodName), Layout.GROUP_DISTANCE);
    TextFieldWithCopyIcon field = addLabelTextFieldWithCopyIcon(gridPane, gridRow, "Amount to transfer:", model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
    field.setCopyWithoutCurrencyPostFix(true);
    switch(paymentMethodName) {
        case PaymentMethod.OK_PAY_ID:
            gridRow = OKPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.PERFECT_MONEY_ID:
            gridRow = PerfectMoneyForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.SEPA_ID:
            gridRow = SepaForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.FASTER_PAYMENTS_ID:
            gridRow = FasterPaymentsForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.NATIONAL_BANK_ID:
            gridRow = NationalBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.SAME_BANK_ID:
            gridRow = SameBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.SPECIFIC_BANKS_ID:
            gridRow = SpecificBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.SWISH_ID:
            gridRow = SwishForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.ALI_PAY_ID:
            gridRow = AliPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.CLEAR_X_CHANGE_ID:
            gridRow = ClearXchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.CHASE_QUICK_PAY_ID:
            gridRow = ChaseQuickPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.INTERAC_E_TRANSFER_ID:
            gridRow = InteracETransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
            gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.CASH_DEPOSIT_ID:
            gridRow = CashDepositForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
            break;
        case PaymentMethod.BLOCK_CHAINS_ID:
            String labelTitle = "Sellers " + CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()) + " address:";
            gridRow = CryptoCurrencyForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData, labelTitle);
            break;
        default:
            log.error("Not supported PaymentMethod: " + paymentMethodName);
    }
    if (!(paymentAccountContractData instanceof CryptoCurrencyAccountContractData))
        addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Reason for payment:", model.dataModel.getReference());
    GridPane.setRowSpan(accountTitledGroupBg, gridRow - 3);
    Tuple3<Button, BusyAnimation, Label> tuple3 = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, "Payment started");
    confirmButton = tuple3.first;
    confirmButton.setOnAction(e -> onPaymentStarted());
    busyAnimation = tuple3.second;
    statusLabel = tuple3.third;
    hideStatusInfo();
}
Also used : BusyAnimation(io.bitsquare.gui.components.BusyAnimation) Button(javafx.scene.control.Button) TextFieldWithCopyIcon(io.bitsquare.gui.components.TextFieldWithCopyIcon) Label(javafx.scene.control.Label) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg)

Example 7 with BusyAnimation

use of io.bitsquare.gui.components.BusyAnimation in project bitsquare by bitsquare.

the class SellerStep3View method addContent.

///////////////////////////////////////////////////////////////////////////////////////////
// Content
///////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
    addTradeInfoBlock();
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 3, "Confirm payment receipt", Layout.GROUP_DISTANCE);
    TextFieldWithCopyIcon field = addLabelTextFieldWithCopyIcon(gridPane, gridRow, "Amount to receive:", model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
    field.setCopyWithoutCurrencyPostFix(true);
    String myPaymentDetails = "";
    String peersPaymentDetails = "";
    String myTitle = "";
    String peersTitle = "";
    boolean isBlockChain = false;
    String nameByCode = CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode());
    Contract contract = trade.getContract();
    if (contract != null) {
        PaymentAccountContractData myPaymentAccountContractData = contract.getSellerPaymentAccountContractData();
        PaymentAccountContractData peersPaymentAccountContractData = contract.getBuyerPaymentAccountContractData();
        if (myPaymentAccountContractData instanceof CryptoCurrencyAccountContractData) {
            myPaymentDetails = ((CryptoCurrencyAccountContractData) myPaymentAccountContractData).getAddress();
            peersPaymentDetails = ((CryptoCurrencyAccountContractData) peersPaymentAccountContractData).getAddress();
            myTitle = "Your " + nameByCode + " address:";
            peersTitle = "Buyers " + nameByCode + " address:";
            isBlockChain = true;
        } else {
            myPaymentDetails = myPaymentAccountContractData.getPaymentDetails();
            peersPaymentDetails = peersPaymentAccountContractData.getPaymentDetails();
            myTitle = "Your trading account:";
            peersTitle = "Buyers trading account:";
        }
    }
    TextFieldWithCopyIcon myPaymentDetailsTextField = addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, myTitle, myPaymentDetails).second;
    myPaymentDetailsTextField.setMouseTransparent(false);
    myPaymentDetailsTextField.setTooltip(new Tooltip(myPaymentDetails));
    TextFieldWithCopyIcon peersPaymentDetailsTextField = addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, peersTitle, peersPaymentDetails).second;
    peersPaymentDetailsTextField.setMouseTransparent(false);
    peersPaymentDetailsTextField.setTooltip(new Tooltip(peersPaymentDetails));
    if (!isBlockChain) {
        addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Reason for payment:", model.dataModel.getReference());
        GridPane.setRowSpan(titledGroupBg, 4);
    }
    Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, "Confirm payment receipt");
    confirmButton = tuple.first;
    confirmButton.setOnAction(e -> onPaymentReceived());
    busyAnimation = tuple.second;
    statusLabel = tuple.third;
    hideStatusInfo();
}
Also used : BusyAnimation(io.bitsquare.gui.components.BusyAnimation) Button(javafx.scene.control.Button) TextFieldWithCopyIcon(io.bitsquare.gui.components.TextFieldWithCopyIcon) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) Contract(io.bitsquare.trade.Contract)

Example 8 with BusyAnimation

use of io.bitsquare.gui.components.BusyAnimation in project bitsquare by bitsquare.

the class WalletPasswordWindow method addButtons.

private void addButtons() {
    BusyAnimation busyAnimation = new BusyAnimation(false);
    Label deriveStatusLabel = new Label();
    unlockButton = new Button("Unlock");
    unlockButton.setDefaultButton(true);
    unlockButton.setDisable(true);
    unlockButton.setOnAction(e -> {
        String password = passwordTextField.getText();
        checkArgument(password.length() < 50, "Password must be less then 50 characters.");
        Wallet wallet = walletService.getWallet();
        KeyCrypterScrypt keyCrypterScrypt = (KeyCrypterScrypt) wallet.getKeyCrypter();
        if (keyCrypterScrypt != null) {
            busyAnimation.play();
            deriveStatusLabel.setText("Derive key from password");
            ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
                if (wallet.checkAESKey(aesKey)) {
                    if (aesKeyHandler != null)
                        aesKeyHandler.onAesKey(aesKey);
                    hide();
                } else {
                    busyAnimation.stop();
                    deriveStatusLabel.setText("");
                    UserThread.runAfter(() -> new Popup().warning("You entered the wrong password.\n\n" + "Please try entering your password again, carefully checking for typos or spelling errors.").onClose(this::blurAgain).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
                }
            });
        } else {
            log.error("wallet.getKeyCrypter() is null, that must not happen.");
        }
    });
    forgotPasswordButton = new Button("Forgot password?");
    forgotPasswordButton.setOnAction(e -> {
        forgotPasswordButton.setDisable(true);
        unlockButton.setDefaultButton(false);
        showRestoreScreen();
    });
    Button cancelButton = new Button("Cancel");
    cancelButton.setOnAction(event -> {
        hide();
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
    });
    HBox hBox = new HBox();
    hBox.setMinWidth(560);
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.setAlignment(Pos.CENTER_LEFT);
    if (hideCloseButton)
        hBox.getChildren().addAll(unlockButton, forgotPasswordButton, busyAnimation, deriveStatusLabel);
    else
        hBox.getChildren().addAll(unlockButton, cancelButton);
    gridPane.getChildren().add(hBox);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
Also used : HBox(javafx.scene.layout.HBox) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) Wallet(org.bitcoinj.core.Wallet) ColumnConstraints(javafx.scene.layout.ColumnConstraints) Popup(io.bitsquare.gui.main.overlays.popups.Popup) KeyCrypterScrypt(org.bitcoinj.crypto.KeyCrypterScrypt)

Aggregations

BusyAnimation (io.bitsquare.gui.components.BusyAnimation)8 Popup (io.bitsquare.gui.main.overlays.popups.Popup)4 Button (javafx.scene.control.Button)4 Label (javafx.scene.control.Label)4 TextFieldWithCopyIcon (io.bitsquare.gui.components.TextFieldWithCopyIcon)2 TitledGroupBg (io.bitsquare.gui.components.TitledGroupBg)2 Contract (io.bitsquare.trade.Contract)2 Insets (javafx.geometry.Insets)2 ImageView (javafx.scene.image.ImageView)2 Wallet (org.bitcoinj.core.Wallet)2 KeyCrypterScrypt (org.bitcoinj.crypto.KeyCrypterScrypt)2 Lists (com.google.common.collect.Lists)1 ByteStreams (com.google.common.io.ByteStreams)1 AwesomeDude (de.jensd.fx.fontawesome.AwesomeDude)1 AwesomeIcon (de.jensd.fx.fontawesome.AwesomeIcon)1 PrivateNotificationManager (io.bitsquare.alert.PrivateNotificationManager)1 Version (io.bitsquare.app.Version)1 Dispute (io.bitsquare.arbitration.Dispute)1 DisputeManager (io.bitsquare.arbitration.DisputeManager)1 DisputeCommunicationMessage (io.bitsquare.arbitration.messages.DisputeCommunicationMessage)1