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);
}
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);
}
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);
}
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());
}
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();
}
Aggregations