Search in sources :

Example 1 with InfoInputTextField

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

the class CreateOfferView method addAmountPriceFields.

private void addAmountPriceFields() {
    // amountBox
    Tuple3<HBox, InputTextField, Label> amountValueCurrencyBoxTuple = getEditableValueCurrencyBox(Res.get("createOffer.amount.prompt"));
    HBox amountValueCurrencyBox = amountValueCurrencyBoxTuple.first;
    amountTextField = amountValueCurrencyBoxTuple.second;
    editOfferElements.add(amountTextField);
    Label amountBtcLabel = amountValueCurrencyBoxTuple.third;
    editOfferElements.add(amountBtcLabel);
    Tuple2<Label, VBox> amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, model.getAmountDescription());
    amountDescriptionLabel = amountInputBoxTuple.first;
    editOfferElements.add(amountDescriptionLabel);
    VBox amountBox = amountInputBoxTuple.second;
    // x
    xLabel = new AutoTooltipLabel();
    xLabel.setFont(Font.font("Helvetica-Bold", 20));
    xLabel.setPadding(new Insets(14, 3, 0, 3));
    xLabel.setMinWidth(14);
    xLabel.setMaxWidth(14);
    // price as percent
    Tuple3<HBox, InfoInputTextField, Label> priceAsPercentageTuple = getEditableValueCurrencyBoxWithInfo(Res.get("createOffer.price.prompt"));
    HBox priceAsPercentageValueCurrencyBox = priceAsPercentageTuple.first;
    marketBasedPriceInfoInputTextField = priceAsPercentageTuple.second;
    marketBasedPriceTextField = marketBasedPriceInfoInputTextField.getTextField();
    marketBasedPriceTextField.setPrefWidth(200);
    editOfferElements.add(marketBasedPriceTextField);
    marketBasedPriceLabel = priceAsPercentageTuple.third;
    editOfferElements.add(marketBasedPriceLabel);
    Tuple2<Label, VBox> priceAsPercentageInputBoxTuple = getTradeInputBox(priceAsPercentageValueCurrencyBox, Res.get("shared.distanceInPercent"));
    percentagePriceDescription = priceAsPercentageInputBoxTuple.first;
    percentagePriceDescription.setPrefWidth(200);
    getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription);
    percentagePriceBox = priceAsPercentageInputBoxTuple.second;
    // Fixed/Percentage toggle
    priceTypeToggleButton = getIconButton(MaterialDesignIcon.SWAP_VERTICAL);
    editOfferElements.add(priceTypeToggleButton);
    priceTypeToggleButton.setOnAction((actionEvent) -> {
        updatePriceToggleButtons(model.dataModel.getUseMarketBasedPrice().getValue());
    });
    // =
    resultLabel = new AutoTooltipLabel("=");
    resultLabel.setFont(Font.font("Helvetica-Bold", 20));
    resultLabel.setPadding(new Insets(14, 2, 0, 2));
    // volume
    Tuple3<HBox, InputTextField, Label> volumeValueCurrencyBoxTuple = getEditableValueCurrencyBox(Res.get("createOffer.volume.prompt"));
    HBox volumeValueCurrencyBox = volumeValueCurrencyBoxTuple.first;
    volumeTextField = volumeValueCurrencyBoxTuple.second;
    editOfferElements.add(volumeTextField);
    volumeCurrencyLabel = volumeValueCurrencyBoxTuple.third;
    editOfferElements.add(volumeCurrencyLabel);
    Tuple2<Label, VBox> volumeInputBoxTuple = getTradeInputBox(volumeValueCurrencyBox, model.volumeDescriptionLabel.get());
    volumeDescriptionLabel = volumeInputBoxTuple.first;
    editOfferElements.add(volumeDescriptionLabel);
    VBox volumeBox = volumeInputBoxTuple.second;
    firstRowHBox = new HBox();
    firstRowHBox.setSpacing(5);
    firstRowHBox.setAlignment(Pos.CENTER_LEFT);
    firstRowHBox.getChildren().addAll(amountBox, xLabel, percentagePriceBox, priceTypeToggleButton, resultLabel, volumeBox);
    GridPane.setRowIndex(firstRowHBox, gridRow);
    GridPane.setColumnIndex(firstRowHBox, 1);
    GridPane.setMargin(firstRowHBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 10, 0, 0));
    GridPane.setColumnSpan(firstRowHBox, 2);
    gridPane.getChildren().add(firstRowHBox);
}
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) InfoInputTextField(bisq.desktop.components.InfoInputTextField) VBox(javafx.scene.layout.VBox)

Example 2 with InfoInputTextField

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

the class FormBuilder method getEditableValueCurrencyBoxWithInfo.

public static Tuple3<HBox, InfoInputTextField, Label> getEditableValueCurrencyBoxWithInfo(String promptText) {
    InfoInputTextField infoInputTextField = new InfoInputTextField();
    InputTextField input = infoInputTextField.getTextField();
    input.setPrefWidth(170);
    input.setAlignment(Pos.CENTER_RIGHT);
    input.setId("text-input-with-currency-text-field");
    input.setPromptText(promptText);
    Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode());
    currency.setId("currency-info-label");
    HBox box = new HBox();
    box.getChildren().addAll(infoInputTextField, currency);
    return new Tuple3<>(box, infoInputTextField, currency);
}
Also used : HBox(javafx.scene.layout.HBox) 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) InfoInputTextField(bisq.desktop.components.InfoInputTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Aggregations

AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)2 InfoInputTextField (bisq.desktop.components.InfoInputTextField)2 InputTextField (bisq.desktop.components.InputTextField)2 Label (javafx.scene.control.Label)2 HBox (javafx.scene.layout.HBox)2 Tuple3 (bisq.common.util.Tuple3)1 Insets (javafx.geometry.Insets)1 VBox (javafx.scene.layout.VBox)1