Search in sources :

Example 21 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class FormBuilder method addLabelInputTextFieldButton.

// /////////////////////////////////////////////////////////////////////////////////////////
// Label  + InputTextField + Button
// /////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Label, InputTextField, Button> addLabelInputTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) {
    Label label = addLabel(gridPane, rowIndex, title, 0);
    InputTextField inputTextField = new InputTextField();
    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(inputTextField, button);
    HBox.setHgrow(inputTextField, Priority.ALWAYS);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);
    return new Tuple3<>(label, inputTextField, button);
}
Also used : HBox(javafx.scene.layout.HBox) Button(javafx.scene.control.Button) AutoTooltipRadioButton(bisq.desktop.components.AutoTooltipRadioButton) RadioButton(javafx.scene.control.RadioButton) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) Tuple3(bisq.common.util.Tuple3) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton)

Example 22 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class DepositView method initialize.

@Override
public void initialize() {
    paymentLabelString = Res.get("funds.deposit.fundBisqWallet");
    selectColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.select")));
    addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
    balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
    confirmationsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations")));
    usageColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.usage")));
    // trigger creation of at least 1 savings address
    walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.deposit.noAddresses")));
    tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
        if (newValue != null) {
            fillForm(newValue.getAddressString());
            GUIUtil.requestFocus(amountTextField);
        }
    };
    setSelectColumnCellFactory();
    setAddressColumnCellFactory();
    setBalanceColumnCellFactory();
    setUsageColumnCellFactory();
    setConfidenceColumnCellFactory();
    addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
    balanceColumn.setComparator((o1, o2) -> o1.getBalanceAsCoin().compareTo(o2.getBalanceAsCoin()));
    confirmationsColumn.setComparator((o1, o2) -> Double.valueOf(o1.getTxConfidenceIndicator().getProgress()).compareTo(o2.getTxConfidenceIndicator().getProgress()));
    usageColumn.setComparator((a, b) -> (a.getNumTxOutputs() < b.getNumTxOutputs()) ? -1 : ((a.getNumTxOutputs() == b.getNumTxOutputs()) ? 0 : 1));
    tableView.getSortOrder().add(usageColumn);
    tableView.setItems(sortedList);
    titledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, Res.get("funds.deposit.fundWallet"));
    qrCodeImageView = new ImageView();
    qrCodeImageView.getStyleClass().add("qr-code");
    Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
    qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> UserThread.runAfter(() -> new QRCodeWindow(getBitcoinURI()).show(), 200, TimeUnit.MILLISECONDS)));
    GridPane.setRowIndex(qrCodeImageView, gridRow);
    GridPane.setColumnIndex(qrCodeImageView, 1);
    GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(qrCodeImageView);
    Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, Res.getWithCol("shared.address"));
    addressLabel = addressTuple.first;
    // GridPane.setValignment(addressLabel, VPos.TOP);
    // GridPane.setMargin(addressLabel, new Insets(3, 0, 0, 0));
    addressTextField = addressTuple.second;
    addressTextField.setPaymentLabel(paymentLabelString);
    Tuple2<Label, InputTextField> amountTuple = addLabelInputTextField(gridPane, ++gridRow, Res.get("funds.deposit.amount"));
    amountLabel = amountTuple.first;
    amountTextField = amountTuple.second;
    if (DevEnv.isDevMode())
        amountTextField.setText("10");
    titledGroupBg.setVisible(false);
    titledGroupBg.setManaged(false);
    qrCodeImageView.setVisible(false);
    qrCodeImageView.setManaged(false);
    addressLabel.setVisible(false);
    addressLabel.setManaged(false);
    addressTextField.setVisible(false);
    addressTextField.setManaged(false);
    amountLabel.setVisible(false);
    amountTextField.setManaged(false);
    generateNewAddressButton = addButton(gridPane, ++gridRow, Res.get("funds.deposit.generateAddress"), -20);
    GridPane.setColumnIndex(generateNewAddressButton, 0);
    GridPane.setHalignment(generateNewAddressButton, HPos.LEFT);
    generateNewAddressButton.setOnAction(event -> {
        boolean hasUnUsedAddress = observableList.stream().filter(e -> e.getNumTxOutputs() == 0).findAny().isPresent();
        if (hasUnUsedAddress) {
            new Popup<>().warning(Res.get("funds.deposit.selectUnused")).show();
        } else {
            AddressEntry newSavingsAddressEntry = walletService.getOrCreateUnusedAddressEntry(AddressEntry.Context.AVAILABLE);
            updateList();
            observableList.stream().filter(depositListItem -> depositListItem.getAddressString().equals(newSavingsAddressEntry.getAddressString())).findAny().ifPresent(depositListItem -> tableView.getSelectionModel().select(depositListItem));
        }
    });
    balanceListener = new BalanceListener() {

        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };
    GUIUtil.focusWhenAddedToScene(amountTextField);
}
Also used : Insets(javafx.geometry.Insets) BalanceListener(bisq.core.btc.listeners.BalanceListener) AddressEntry(bisq.core.btc.AddressEntry) AddressTextField(bisq.desktop.components.AddressTextField) FormBuilder.addLabelAddressTextField(bisq.desktop.util.FormBuilder.addLabelAddressTextField) InputTextField(bisq.desktop.components.InputTextField) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) Tooltip(javafx.scene.control.Tooltip) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) Coin(org.bitcoinj.core.Coin) Transaction(org.bitcoinj.core.Transaction) Popup(bisq.desktop.main.overlays.popups.Popup) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 23 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class CreateOfferView method addSecondRow.

private void addSecondRow() {
    // price as fiat
    Tuple3<HBox, InputTextField, Label> priceValueCurrencyBoxTuple = getEditableValueCurrencyBox(Res.get("createOffer.price.prompt"));
    HBox priceValueCurrencyBox = priceValueCurrencyBoxTuple.first;
    fixedPriceTextField = priceValueCurrencyBoxTuple.second;
    fixedPriceTextField.setPrefWidth(200);
    editOfferElements.add(fixedPriceTextField);
    priceCurrencyLabel = priceValueCurrencyBoxTuple.third;
    editOfferElements.add(priceCurrencyLabel);
    Tuple2<Label, VBox> priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, "");
    priceDescriptionLabel = priceInputBoxTuple.first;
    priceDescriptionLabel.setPrefWidth(200);
    getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel);
    editOfferElements.add(priceDescriptionLabel);
    fixedPriceBox = priceInputBoxTuple.second;
    marketBasedPriceTextField.setPromptText(Res.get("shared.enterPercentageValue"));
    marketBasedPriceLabel.setText("%");
    marketBasedPriceLabel.getStyleClass().add("percentage-label");
    Tuple3<HBox, InputTextField, Label> amountValueCurrencyBoxTuple = getEditableValueCurrencyBox(Res.get("createOffer.amount.prompt"));
    HBox amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
    minAmountTextField = amountValueCurrencyBoxTuple.second;
    editOfferElements.add(minAmountTextField);
    Label minAmountBtcLabel = amountValueCurrencyBoxTuple.third;
    editOfferElements.add(minAmountBtcLabel);
    Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, Res.get("createOffer.amountPriceBox.minAmountDescription"));
    Label xLabel = new AutoTooltipLabel("x");
    xLabel.setFont(Font.font("Helvetica-Bold", 20));
    xLabel.setPadding(new Insets(14, 3, 0, 3));
    // we just use it to get the same layout as the upper row
    xLabel.setVisible(false);
    secondRowHBox = new HBox();
    secondRowHBox.setSpacing(5);
    secondRowHBox.setAlignment(Pos.CENTER_LEFT);
    secondRowHBox.getChildren().addAll(amountInputBoxTuple.second, xLabel, fixedPriceBox, priceTypeToggleButton);
    GridPane.setRowIndex(secondRowHBox, ++gridRow);
    GridPane.setColumnIndex(secondRowHBox, 1);
    GridPane.setMargin(secondRowHBox, new Insets(0, 10, 0, 0));
    GridPane.setColumnSpan(secondRowHBox, 2);
    gridPane.getChildren().add(secondRowHBox);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) VBox(javafx.scene.layout.VBox)

Example 24 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class SpecificBankForm method addAcceptedBanksForAddAccount.

@Override
protected void addAcceptedBanksForAddAccount() {
    Tuple3<Label, InputTextField, Button> addBankTuple = addLabelInputTextFieldButton(gridPane, ++gridRow, Res.get("payment.nameOfAcceptedBank"), Res.get("payment.addAcceptedBank"));
    InputTextField addBankInputTextField = addBankTuple.second;
    Button addButton = addBankTuple.third;
    addButton.setMinWidth(200);
    addButton.disableProperty().bind(Bindings.createBooleanBinding(() -> addBankInputTextField.getText().isEmpty(), addBankInputTextField.textProperty()));
    Tuple3<Label, TextField, Button> acceptedBanksTuple = addLabelTextFieldButton(gridPane, ++gridRow, Res.get("payment.accepted.banks"), Res.get("payment.clearAcceptedBanks"));
    acceptedBanksTextField = acceptedBanksTuple.second;
    acceptedBanksTextField.setMouseTransparent(false);
    acceptedBanksTooltip = new Tooltip();
    acceptedBanksTextField.setTooltip(acceptedBanksTooltip);
    Button clearButton = acceptedBanksTuple.third;
    clearButton.setMinWidth(200);
    clearButton.setDefaultButton(false);
    clearButton.disableProperty().bind(Bindings.createBooleanBinding(() -> acceptedBanksTextField.getText().isEmpty(), acceptedBanksTextField.textProperty()));
    addButton.setOnAction(e -> {
        specificBanksAccountPayload.addAcceptedBank(addBankInputTextField.getText());
        addBankInputTextField.setText("");
        String value = Joiner.on(", ").join(specificBanksAccountPayload.getAcceptedBanks());
        acceptedBanksTextField.setText(value);
        acceptedBanksTooltip.setText(value);
        updateAllInputsValid();
    });
    clearButton.setOnAction(e -> resetAcceptedBanks());
}
Also used : Button(javafx.scene.control.Button) FormBuilder.addLabelInputTextFieldButton(bisq.desktop.util.FormBuilder.addLabelInputTextFieldButton) FormBuilder.addLabelTextFieldButton(bisq.desktop.util.FormBuilder.addLabelTextFieldButton) InputTextField(bisq.desktop.components.InputTextField) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) TextField(javafx.scene.control.TextField) FormBuilder.addLabelTextField(bisq.desktop.util.FormBuilder.addLabelTextField) InputTextField(bisq.desktop.components.InputTextField)

Example 25 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class SwishForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner")).second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        swishAccount.setHolderName(newValue);
        updateFromInputs();
    });
    mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.mobile")).second;
    mobileNrInputTextField.setValidator(swishValidator);
    mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        swishAccount.setMobileNr(newValue);
        updateFromInputs();
    });
    TradeCurrency singleTradeCurrency = swishAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) InputTextField(bisq.desktop.components.InputTextField)

Aggregations

InputTextField (bisq.desktop.components.InputTextField)35 Label (javafx.scene.control.Label)23 HBox (javafx.scene.layout.HBox)19 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)17 Insets (javafx.geometry.Insets)15 TradeCurrency (bisq.core.locale.TradeCurrency)11 InfoInputTextField (bisq.desktop.components.InfoInputTextField)11 FormBuilder.addLabelInputTextField (bisq.desktop.util.FormBuilder.addLabelInputTextField)11 Popup (bisq.desktop.main.overlays.popups.Popup)8 Tuple3 (bisq.common.util.Tuple3)6 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)6 Button (javafx.scene.control.Button)5 TextField (javafx.scene.control.TextField)5 CheckBox (javafx.scene.control.CheckBox)4 Country (bisq.core.locale.Country)3 AddressTextField (bisq.desktop.components.AddressTextField)3 VBox (javafx.scene.layout.VBox)3 BalanceTextField (bisq.desktop.components.BalanceTextField)2 FundsTextField (bisq.desktop.components.FundsTextField)2 TitledGroupBg (bisq.desktop.components.TitledGroupBg)2