Search in sources :

Example 6 with InputTextField

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

the class SendPrivateNotificationWindow method addContent.

private void addContent() {
    InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Key for private notification:", 10).second;
    Tuple2<Label, TextArea> labelTextAreaTuple2 = addLabelTextArea(gridPane, ++rowIndex, "Private notification:", "Enter notification");
    TextArea alertMessageTextArea = labelTextAreaTuple2.second;
    Label first = labelTextAreaTuple2.first;
    first.setMinWidth(200);
    sendButton = new Button("Send private notification");
    sendButton.setOnAction(e -> {
        if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
            if (!sendPrivateNotificationHandler.handle(new PrivateNotification(alertMessageTextArea.getText()), pubKeyRing, nodeAddress, keyInputTextField.getText(), new SendMailboxMessageListener() {

                @Override
                public void onArrived() {
                    log.trace("PrivateNotificationMessage arrived at peer.");
                    new Popup<>().feedback("Message arrived.").onClose(SendPrivateNotificationWindow.this::hide).show();
                }

                @Override
                public void onStoredInMailbox() {
                    log.trace("PrivateNotificationMessage was stored in mailbox.");
                    new Popup<>().feedback("Message stored in mailbox.").onClose(SendPrivateNotificationWindow.this::hide).show();
                }

                @Override
                public void onFault(String errorMessage) {
                    new Popup<>().feedback("Message sending failed. error=" + errorMessage).onClose(SendPrivateNotificationWindow.this::hide).show();
                }
            }))
                new Popup().warning("The key you entered was not correct.").width(300).onClose(() -> blurAgain()).show();
        }
    });
    closeButton = new Button("Close");
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
    });
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(sendButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) TextArea(javafx.scene.control.TextArea) FormBuilder.addLabelTextArea(io.bitsquare.gui.util.FormBuilder.addLabelTextArea) Button(javafx.scene.control.Button) FormBuilder.addLabelInputTextField(io.bitsquare.gui.util.FormBuilder.addLabelInputTextField) InputTextField(io.bitsquare.gui.components.InputTextField) Popup(io.bitsquare.gui.main.overlays.popups.Popup) Label(javafx.scene.control.Label) PrivateNotification(io.bitsquare.alert.PrivateNotification) SendMailboxMessageListener(io.bitsquare.p2p.messaging.SendMailboxMessageListener)

Example 7 with InputTextField

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

the class EmptyWalletWindow method addContent.

private void addContent() {
    addMultilineLabel(gridPane, ++rowIndex, "Please use that only in emergency case if you cannot access your fund from the UI.\n\n" + "Please note that all open offers will be closed automatically when using this tool.\n\n" + "Before you use this tool, please backup your data directory. " + "You can do this under \"Account/Backup\".\n\n" + "Please file a bug report on Github so that we can investigate what was causing the problem.", 10);
    Coin totalBalance = walletService.getAvailableBalance();
    balanceTextField = addLabelTextField(gridPane, ++rowIndex, "Your available wallet balance:", formatter.formatCoinWithCode(totalBalance), 10).second;
    Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++rowIndex, "Your destination address:");
    addressInputTextField = tuple.second;
    if (DevFlags.DEV_MODE)
        addressInputTextField.setText("mjYhQYSbET2bXJDyCdNqYhqSye5QX2WHPz");
    emptyWalletButton = new Button("Empty wallet");
    boolean isBalanceSufficient = Restrictions.isAboveDust(totalBalance);
    emptyWalletButton.setDefaultButton(isBalanceSufficient);
    emptyWalletButton.setDisable(!isBalanceSufficient && addressInputTextField.getText().length() > 0);
    emptyWalletButton.setOnAction(e -> {
        if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
            if (walletService.getWallet().isEncrypted()) {
                walletPasswordWindow.onAesKey(this::doEmptyWallet).onClose(this::blurAgain).show();
            } else {
                doEmptyWallet(null);
            }
        }
    });
    closeButton = new Button("Cancel");
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });
    closeButton.setDefaultButton(!isBalanceSufficient);
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(emptyWalletButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Also used : Coin(org.bitcoinj.core.Coin) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) InputTextField(io.bitsquare.gui.components.InputTextField) Label(javafx.scene.control.Label)

Example 8 with InputTextField

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

the class ChaseQuickPayForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        chaseQuickPayAccount.setHolderName(newValue);
        updateFromInputs();
    });
    mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Email:").second;
    mobileNrInputTextField.setValidator(chaseQuickPayValidator);
    mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        chaseQuickPayAccount.setEmail(newValue);
        updateFromInputs();
    });
    addLabelTextField(gridPane, ++gridRow, "Currency:", chaseQuickPayAccount.getSingleTradeCurrency().getNameAndCode());
    addAllowedPeriod();
    addAccountNameTextFieldWithAutoFillCheckBox();
}
Also used : FormBuilder.addLabelInputTextField(io.bitsquare.gui.util.FormBuilder.addLabelInputTextField) InputTextField(io.bitsquare.gui.components.InputTextField)

Example 9 with InputTextField

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

the class ClearXchangeForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        clearXchangeAccount.setHolderName(newValue);
        updateFromInputs();
    });
    mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Email or mobile no.:").second;
    mobileNrInputTextField.setValidator(clearXchangeValidator);
    mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        clearXchangeAccount.setEmailOrMobileNr(newValue);
        updateFromInputs();
    });
    addLabelTextField(gridPane, ++gridRow, "Currency:", clearXchangeAccount.getSingleTradeCurrency().getNameAndCode());
    addAllowedPeriod();
    addAccountNameTextFieldWithAutoFillCheckBox();
}
Also used : InputTextField(io.bitsquare.gui.components.InputTextField)

Example 10 with InputTextField

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

the class SepaForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:").second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setHolderName(newValue);
        updateFromInputs();
    });
    ibanInputTextField = addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
    ibanInputTextField.setValidator(ibanValidator);
    ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setIban(newValue);
        updateFromInputs();
    });
    bicInputTextField = addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
    bicInputTextField.setValidator(bicValidator);
    bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setBic(newValue);
        updateFromInputs();
    });
    addLabel(gridPane, ++gridRow, "Country of bank:");
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    ComboBox<Country> countryComboBox = new ComboBox<>();
    currencyComboBox = new ComboBox<>();
    currencyTextField = new TextField("");
    currencyTextField.setEditable(false);
    currencyTextField.setMouseTransparent(true);
    currencyTextField.setFocusTraversable(false);
    currencyTextField.setMinWidth(300);
    currencyTextField.setVisible(false);
    currencyTextField.setManaged(false);
    currencyComboBox.setVisible(false);
    currencyComboBox.setManaged(false);
    hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox);
    GridPane.setRowIndex(hBox, gridRow);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);
    countryComboBox.setPromptText("Select country of bank");
    countryComboBox.setConverter(new StringConverter<Country>() {

        @Override
        public String toString(Country country) {
            return country.name + " (" + country.code + ")";
        }

        @Override
        public Country fromString(String s) {
            return null;
        }
    });
    countryComboBox.setOnAction(e -> {
        Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
        sepaAccount.setCountry(selectedItem);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
        setupCurrency(selectedItem, currency);
        updateCountriesSelection(true, euroCountryCheckBoxes);
        updateCountriesSelection(true, nonEuroCountryCheckBoxes);
        updateFromInputs();
    });
    addEuroCountriesGrid(true);
    addNonEuroCountriesGrid(true);
    addAllowedPeriod();
    addAccountNameTextFieldWithAutoFillCheckBox();
    countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaCountries()));
    Country country = CountryUtil.getDefaultCountry();
    if (CountryUtil.getAllSepaCountries().contains(country)) {
        countryComboBox.getSelectionModel().select(country);
        sepaAccount.setCountry(country);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
        setupCurrency(country, currency);
    }
    updateFromInputs();
}
Also used : HBox(javafx.scene.layout.HBox) InputTextField(io.bitsquare.gui.components.InputTextField) InputTextField(io.bitsquare.gui.components.InputTextField)

Aggregations

InputTextField (io.bitsquare.gui.components.InputTextField)16 Insets (javafx.geometry.Insets)8 Popup (io.bitsquare.gui.main.overlays.popups.Popup)6 FormBuilder.addLabelInputTextField (io.bitsquare.gui.util.FormBuilder.addLabelInputTextField)6 Button (javafx.scene.control.Button)6 Label (javafx.scene.control.Label)6 HBox (javafx.scene.layout.HBox)5 TextArea (javafx.scene.control.TextArea)2 Coin (org.bitcoinj.core.Coin)2 Transaction (org.bitcoinj.core.Transaction)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Alert (io.bitsquare.alert.Alert)1 PrivateNotification (io.bitsquare.alert.PrivateNotification)1 Dispute (io.bitsquare.arbitration.Dispute)1 AddressEntry (io.bitsquare.btc.AddressEntry)1 TransactionVerificationException (io.bitsquare.btc.exceptions.TransactionVerificationException)1 WalletException (io.bitsquare.btc.exceptions.WalletException)1 BalanceListener (io.bitsquare.btc.listeners.BalanceListener)1 PubKeyRing (io.bitsquare.common.crypto.PubKeyRing)1 Filter (io.bitsquare.filter.Filter)1