Search in sources :

Example 1 with TitledGroupBg

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

the class ActiveProposalsView method createVoteView.

// /////////////////////////////////////////////////////////////////////////////////////////
// Create views
// /////////////////////////////////////////////////////////////////////////////////////////
private void createVoteView() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.proposal.votes.header"), Layout.GROUP_DISTANCE - 20);
    final Tuple2<Label, InputTextField> tuple2 = addLabelInputTextField(root, gridRow, Res.getWithCol("dao.proposal.myVote.stake"), Layout.FIRST_ROW_AND_GROUP_DISTANCE - 20);
    stakeInputTextField = tuple2.second;
    voteButton = addButtonAfterGroup(root, ++gridRow, Res.get("dao.proposal.myVote.button"));
    voteViewItems.add(titledGroupBg);
    voteViewItems.add(tuple2.first);
    voteViewItems.add(stakeInputTextField);
    voteViewItems.add(voteButton);
    changeVoteViewItemsVisibility(false);
}
Also used : FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) InputTextField(bisq.desktop.components.InputTextField) Label(javafx.scene.control.Label) TitledGroupBg(bisq.desktop.components.TitledGroupBg) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg)

Example 2 with TitledGroupBg

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

the class TakeOfferView method addAmountPriceGroup.

private void addAmountPriceGroup() {
    TitledGroupBg titledGroupBg = FormBuilder.addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("takeOffer.setAmountPrice"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 3);
    imageView = new ImageView();
    imageView.setPickOnBounds(true);
    directionLabel = new AutoTooltipLabel();
    directionLabel.setAlignment(Pos.CENTER);
    directionLabel.setPadding(new Insets(-5, 0, 0, 0));
    directionLabel.setId("direction-icon-label");
    VBox imageVBox = new VBox();
    imageVBox.setAlignment(Pos.CENTER);
    imageVBox.setSpacing(12);
    imageVBox.getChildren().addAll(imageView, directionLabel);
    GridPane.setRowIndex(imageVBox, gridRow);
    GridPane.setRowSpan(imageVBox, 2);
    GridPane.setMargin(imageVBox, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 10, 10, 10));
    gridPane.getChildren().add(imageVBox);
    addAmountPriceFields();
    addSecondRow();
}
Also used : Insets(javafx.geometry.Insets) TitledGroupBg(bisq.desktop.components.TitledGroupBg) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) VBox(javafx.scene.layout.VBox)

Example 3 with TitledGroupBg

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

the class SellerStep3View method addContent.

// /////////////////////////////////////////////////////////////////////////////////////////
// Content
// /////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
    addTradeInfoBlock();
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 3, Res.get("portfolio.pending.step3_seller.confirmPaymentReceipt"), Layout.GROUP_DISTANCE);
    TextFieldWithCopyIcon field = addLabelTextFieldWithCopyIcon(gridPane, gridRow, Res.get("portfolio.pending.step3_seller.amountToReceive"), 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) {
        PaymentAccountPayload myPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
        PaymentAccountPayload peersPaymentAccountPayload = contract.getBuyerPaymentAccountPayload();
        if (myPaymentAccountPayload instanceof CryptoCurrencyAccountPayload) {
            myPaymentDetails = ((CryptoCurrencyAccountPayload) myPaymentAccountPayload).getAddress();
            peersPaymentDetails = ((CryptoCurrencyAccountPayload) peersPaymentAccountPayload).getAddress();
            myTitle = Res.get("portfolio.pending.step3_seller.yourAddress", nameByCode);
            peersTitle = Res.get("portfolio.pending.step3_seller.buyersAddress", nameByCode);
            isBlockChain = true;
        } else {
            myPaymentDetails = myPaymentAccountPayload.getPaymentDetails();
            peersPaymentDetails = peersPaymentAccountPayload.getPaymentDetails();
            myTitle = Res.get("portfolio.pending.step3_seller.yourAccount");
            peersTitle = Res.get("portfolio.pending.step3_seller.buyersAccount");
        }
    }
    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, Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
        GridPane.setRowSpan(titledGroupBg, 4);
    }
    Tuple3<Button, BusyAnimation, Label> tuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step3_seller.confirmReceipt"));
    confirmButton = tuple.first;
    confirmButton.setOnAction(e -> onPaymentReceived());
    busyAnimation = tuple.second;
    statusLabel = tuple.third;
}
Also used : BusyAnimation(bisq.desktop.components.BusyAnimation) Button(javafx.scene.control.Button) FormBuilder.addLabelTextFieldWithCopyIcon(bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon) TextFieldWithCopyIcon(bisq.desktop.components.TextFieldWithCopyIcon) Tooltip(javafx.scene.control.Tooltip) PaymentAccountPayload(bisq.core.payment.payload.PaymentAccountPayload) Label(javafx.scene.control.Label) TitledGroupBg(bisq.desktop.components.TitledGroupBg) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) Contract(bisq.core.trade.Contract) CryptoCurrencyAccountPayload(bisq.core.payment.payload.CryptoCurrencyAccountPayload)

Example 4 with TitledGroupBg

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

the class AboutView method initialize.

@Override
public void initialize() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 4, Res.get("setting.about.aboutBisq"));
    GridPane.setColumnSpan(titledGroupBg, 2);
    Label label = addLabel(root, gridRow, Res.get("setting.about.about"), Layout.FIRST_ROW_DISTANCE);
    label.setWrapText(true);
    GridPane.setColumnSpan(label, 2);
    GridPane.setHalignment(label, HPos.LEFT);
    HyperlinkWithIcon hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.web"), "https://bisq.network");
    GridPane.setColumnSpan(hyperlinkWithIcon, 2);
    hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.code"), "https://github.com/bisq-network/exchange");
    GridPane.setColumnSpan(hyperlinkWithIcon, 2);
    hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.agpl"), "https://github.com/bisq-network/exchange/blob/master/LICENSE");
    GridPane.setColumnSpan(hyperlinkWithIcon, 2);
    titledGroupBg = addTitledGroupBg(root, ++gridRow, 3, Res.get("setting.about.support"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 2);
    label = addLabel(root, gridRow, Res.get("setting.about.def"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    label.setWrapText(true);
    GridPane.setColumnSpan(label, 2);
    GridPane.setHalignment(label, HPos.LEFT);
    hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.contribute"), "https://bisq.network/contribute");
    GridPane.setColumnSpan(hyperlinkWithIcon, 2);
    hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.donate"), "https://bisq.network/contribute/#donation");
    GridPane.setColumnSpan(hyperlinkWithIcon, 2);
    final boolean isBtc = Res.getBaseCurrencyCode().equals("BTC");
    titledGroupBg = addTitledGroupBg(root, ++gridRow, isBtc ? 3 : 2, Res.get("setting.about.providers"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 2);
    label = addLabel(root, gridRow, Res.get(isBtc ? "setting.about.apisWithFee" : "setting.about.apis"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    label.setWrapText(true);
    GridPane.setColumnSpan(label, 2);
    GridPane.setHalignment(label, HPos.LEFT);
    addLabelTextField(root, ++gridRow, Res.get("setting.about.pricesProvided"), Res.get("setting.about.pricesProviders", "BitcoinAverage (https://bitcoinaverage.com)", "Poloniex (https://poloniex.com)", "Coinmarketcap (https://coinmarketcap.com)"));
    if (isBtc)
        addLabelTextField(root, ++gridRow, Res.get("setting.about.feeEstimation.label"), "21 (https://bitcoinfees.earn.com)");
    titledGroupBg = addTitledGroupBg(root, ++gridRow, 2, Res.get("setting.about.versionDetails"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 2);
    addLabelTextField(root, gridRow, Res.get("setting.about.version"), Version.VERSION, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextField(root, ++gridRow, Res.get("setting.about.subsystems.label"), Res.get("setting.about.subsystems.val", Version.P2P_NETWORK_VERSION, Version.getP2PMessageVersion(), Version.LOCAL_DB_VERSION, Version.TRADE_PROTOCOL_VERSION));
}
Also used : FormBuilder.addLabel(bisq.desktop.util.FormBuilder.addLabel) Label(javafx.scene.control.Label) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) TitledGroupBg(bisq.desktop.components.TitledGroupBg) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) FormBuilder.addHyperlinkWithIcon(bisq.desktop.util.FormBuilder.addHyperlinkWithIcon)

Example 5 with TitledGroupBg

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

the class PreferencesView method initializeGeneralOptions.

// /////////////////////////////////////////////////////////////////////////////////////////
// Initialize
// /////////////////////////////////////////////////////////////////////////////////////////
private void initializeGeneralOptions() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 8, Res.get("setting.preferences.general"));
    GridPane.setColumnSpan(titledGroupBg, 4);
    // selectBaseCurrencyNetwork
    // noinspection unchecked
    selectBaseCurrencyNetworkComboBox = addLabelComboBox(root, gridRow, Res.getWithCol("settings.preferences.selectCurrencyNetwork"), Layout.FIRST_ROW_DISTANCE).second;
    selectBaseCurrencyNetworkComboBox.setConverter(new StringConverter<BaseCurrencyNetwork>() {

        @Override
        public String toString(BaseCurrencyNetwork baseCurrencyNetwork) {
            return DevEnv.isDevMode() ? (baseCurrencyNetwork.getCurrencyName() + "_" + baseCurrencyNetwork.getNetwork()) : baseCurrencyNetwork.getCurrencyName();
        }

        @Override
        public BaseCurrencyNetwork fromString(String string) {
            return null;
        }
    });
    // userLanguage
    // noinspection unchecked
    userLanguageComboBox = addLabelComboBox(root, ++gridRow, Res.getWithCol("shared.language")).second;
    // userCountry
    // noinspection unchecked
    userCountryComboBox = addLabelComboBox(root, ++gridRow, Res.getWithCol("shared.country")).second;
    // blockChainExplorer
    // noinspection unchecked
    blockChainExplorerComboBox = addLabelComboBox(root, ++gridRow, Res.get("setting.preferences.explorer")).second;
    // transactionFee
    Tuple3<Label, InputTextField, CheckBox> tuple = addLabelInputTextFieldCheckBox(root, ++gridRow, Res.get("setting.preferences.txFee"), Res.get("setting.preferences.useCustomValue"));
    transactionFeeInputTextField = tuple.second;
    useCustomFeeCheckbox = tuple.third;
    useCustomFeeCheckboxListener = (observable, oldValue, newValue) -> {
        preferences.setUseCustomWithdrawalTxFee(newValue);
        transactionFeeInputTextField.setEditable(newValue);
        if (!newValue) {
            transactionFeeInputTextField.setText(String.valueOf(feeService.getTxFeePerByte().value));
            try {
                preferences.setWithdrawalTxFeeInBytes(feeService.getTxFeePerByte().value);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        preferences.setUseCustomWithdrawalTxFee(newValue);
    };
    transactionFeeFocusedListener = (o, oldValue, newValue) -> {
        if (oldValue && !newValue) {
            String estimatedFee = String.valueOf(feeService.getTxFeePerByte().value);
            try {
                int withdrawalTxFeePerByte = Integer.parseInt(transactionFeeInputTextField.getText());
                final long minFeePerByte = BisqEnvironment.getBaseCurrencyNetwork().getDefaultMinFeePerByte();
                if (withdrawalTxFeePerByte < minFeePerByte) {
                    new Popup<>().warning(Res.get("setting.preferences.txFeeMin", minFeePerByte)).show();
                    transactionFeeInputTextField.setText(estimatedFee);
                } else if (withdrawalTxFeePerByte > 5000) {
                    new Popup<>().warning(Res.get("setting.preferences.txFeeTooLarge")).show();
                    transactionFeeInputTextField.setText(estimatedFee);
                } else {
                    preferences.setWithdrawalTxFeeInBytes(withdrawalTxFeePerByte);
                }
            } catch (NumberFormatException t) {
                log.error(t.toString());
                t.printStackTrace();
                new Popup<>().warning(Res.get("validation.integerOnly")).show();
                transactionFeeInputTextField.setText(estimatedFee);
            } catch (Throwable t) {
                log.error(t.toString());
                t.printStackTrace();
                new Popup<>().warning(Res.get("validation.inputError", t.getMessage())).show();
                transactionFeeInputTextField.setText(estimatedFee);
            }
        }
    };
    transactionFeeChangeListener = (observable, oldValue, newValue) -> transactionFeeInputTextField.setText(String.valueOf(feeService.getTxFeePerByte().value));
    // deviation
    deviationInputTextField = addLabelInputTextField(root, ++gridRow, Res.get("setting.preferences.deviation")).second;
    deviationListener = (observable, oldValue, newValue) -> {
        try {
            double value = formatter.parsePercentStringToDouble(newValue);
            final double maxDeviation = 0.5;
            if (value <= maxDeviation) {
                preferences.setMaxPriceDistanceInPercent(value);
            } else {
                new Popup<>().warning(Res.get("setting.preferences.deviationToLarge", maxDeviation * 100)).show();
                UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
            }
        } catch (NumberFormatException t) {
            log.error("Exception at parseDouble deviation: " + t.toString());
            UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
        }
    };
    deviationFocusedListener = (observable1, oldValue1, newValue1) -> {
        if (oldValue1 && !newValue1)
            UserThread.runAfter(() -> deviationInputTextField.setText(formatter.formatPercentagePrice(preferences.getMaxPriceDistanceInPercent())), 100, TimeUnit.MILLISECONDS);
    };
    // autoSelectArbitrators
    autoSelectArbitratorsCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.autoSelectArbitrators"), "").second;
    // ignoreTraders
    ignoreTradersListInputTextField = addLabelInputTextField(root, ++gridRow, Res.get("setting.preferences.ignorePeers")).second;
    ignoreTradersListListener = (observable, oldValue, newValue) -> preferences.setIgnoreTradersList(Arrays.asList(StringUtils.deleteWhitespace(newValue).replace(":9999", "").replace(".onion", "").split(",")));
}
Also used : InputTextField(bisq.desktop.components.InputTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) CheckBox(javafx.scene.control.CheckBox) Popup(bisq.desktop.main.overlays.popups.Popup) BaseCurrencyNetwork(bisq.core.btc.BaseCurrencyNetwork) TitledGroupBg(bisq.desktop.components.TitledGroupBg)

Aggregations

TitledGroupBg (bisq.desktop.components.TitledGroupBg)12 Label (javafx.scene.control.Label)8 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)5 Insets (javafx.geometry.Insets)5 InputTextField (bisq.desktop.components.InputTextField)4 FormBuilder.addTitledGroupBg (bisq.desktop.util.FormBuilder.addTitledGroupBg)3 Button (javafx.scene.control.Button)3 ImageView (javafx.scene.image.ImageView)3 BaseCurrencyNetwork (bisq.core.btc.BaseCurrencyNetwork)2 TradeCurrency (bisq.core.locale.TradeCurrency)2 CryptoCurrencyAccountPayload (bisq.core.payment.payload.CryptoCurrencyAccountPayload)2 PaymentAccountPayload (bisq.core.payment.payload.PaymentAccountPayload)2 BusyAnimation (bisq.desktop.components.BusyAnimation)2 TextFieldWithCopyIcon (bisq.desktop.components.TextFieldWithCopyIcon)2 Popup (bisq.desktop.main.overlays.popups.Popup)2 ComboBox (javafx.scene.control.ComboBox)2 UserThread (bisq.common.UserThread)1 DevEnv (bisq.common.app.DevEnv)1 Tuple2 (bisq.common.util.Tuple2)1 Tuple3 (bisq.common.util.Tuple3)1