Search in sources :

Example 11 with AutoTooltipButton

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

the class TakeOfferView method addButtons.

private void addButtons() {
    nextButton = new AutoTooltipButton(Res.get("shared.nextStep"));
    nextButton.setDefaultButton(true);
    nextButton.setOnAction(e -> {
        showNextStepAfterAmountIsSet();
    });
    cancelButton1 = new AutoTooltipButton(Res.get("shared.cancel"));
    cancelButton1.setDefaultButton(false);
    cancelButton1.setId("cancel-button");
    cancelButton1.setOnAction(e -> {
        model.dataModel.swapTradeToSavings();
        close();
    });
}
Also used : AutoTooltipButton(bisq.desktop.components.AutoTooltipButton)

Example 12 with AutoTooltipButton

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

the class Overlay method addReportErrorButtons.

private void addReportErrorButtons() {
    messageLabel.setText(Res.get("popup.reportError", truncatedMessage));
    Button logButton = new AutoTooltipButton(Res.get("popup.reportError.log"));
    GridPane.setMargin(logButton, new Insets(20, 0, 0, 0));
    GridPane.setHalignment(logButton, HPos.RIGHT);
    GridPane.setRowIndex(logButton, ++rowIndex);
    GridPane.setColumnIndex(logButton, 1);
    gridPane.getChildren().add(logButton);
    logButton.setOnAction(event -> {
        try {
            File dataDir = new File(BisqEnvironment.getStaticAppDataDir());
            File logFile = new File(Paths.get(dataDir.getPath(), "bisq.log").toString());
            Utilities.openFile(logFile);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
    });
    Button gitHubButton = new AutoTooltipButton(Res.get("popup.reportError.gitHub"));
    GridPane.setHalignment(gitHubButton, HPos.RIGHT);
    GridPane.setRowIndex(gitHubButton, ++rowIndex);
    GridPane.setColumnIndex(gitHubButton, 1);
    gridPane.getChildren().add(gitHubButton);
    gitHubButton.setOnAction(event -> {
        if (message != null)
            Utilities.copyToClipboard(message);
        GUIUtil.openWebPage("https://github.com/bisq-network/exchange/issues");
        hide();
    });
}
Also used : Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) IOException(java.io.IOException) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) File(java.io.File)

Example 13 with AutoTooltipButton

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

the class EmptyWalletWindow method addContent.

private void addContent() {
    addMultilineLabel(gridPane, ++rowIndex, Res.get("emptyWalletWindow.info"), 10);
    Coin totalBalance = walletService.getAvailableBalance();
    balanceTextField = addLabelTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.balance"), formatter.formatCoinWithCode(totalBalance), 10).second;
    Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.address"));
    addressInputTextField = tuple.second;
    emptyWalletButton = new AutoTooltipButton(Res.get("emptyWalletWindow.button"));
    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.isEncrypted()) {
                walletPasswordWindow.onAesKey(this::doEmptyWallet).onClose(this::blurAgain).show();
            } else {
                doEmptyWallet(null);
            }
        }
    });
    closeButton = new AutoTooltipButton(Res.get("shared.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) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) InputTextField(bisq.desktop.components.InputTextField) Label(javafx.scene.control.Label) FormBuilder.addMultilineLabel(bisq.desktop.util.FormBuilder.addMultilineLabel) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton)

Example 14 with AutoTooltipButton

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

the class FilterWindow method addContent.

private void addContent() {
    InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("shared.unlock"), 10).second;
    if (useDevPrivilegeKeys)
        keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
    InputTextField offerIdsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.offers")).second;
    InputTextField nodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.onions")).second;
    // Do not translate
    nodesInputTextField.setPromptText("E.g. zqnzx6o3nifef5df.onion:9999");
    InputTextField paymentAccountFilterInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.accounts")).second;
    GridPane.setHalignment(paymentAccountFilterInputTextField, HPos.RIGHT);
    // Do not translate
    paymentAccountFilterInputTextField.setPromptText("E.g. PERFECT_MONEY|getAccountNr|12345");
    InputTextField bannedCurrenciesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.bannedCurrencies")).second;
    InputTextField bannedPaymentMethodsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.bannedPaymentMethods")).second;
    // Do not translate
    bannedPaymentMethodsInputTextField.setPromptText("E.g. PERFECT_MONEY");
    InputTextField arbitratorsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.arbitrators")).second;
    InputTextField seedNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.seedNode")).second;
    InputTextField priceRelayNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.priceRelayNode")).second;
    InputTextField btcNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.btcNode")).second;
    CheckBox preventPublicBtcNetworkCheckBox = addLabelCheckBox(gridPane, ++rowIndex, Res.get("filterWindow.preventPublicBtcNetwork")).second;
    final Filter filter = filterManager.getDevelopersFilter();
    if (filter != null) {
        offerIdsInputTextField.setText(filter.getBannedOfferIds().stream().collect(Collectors.joining(", ")));
        nodesInputTextField.setText(filter.getBannedNodeAddress().stream().collect(Collectors.joining(", ")));
        if (filter.getBannedPaymentAccounts() != null) {
            StringBuilder sb = new StringBuilder();
            filter.getBannedPaymentAccounts().stream().forEach(e -> {
                if (e != null && e.getPaymentMethodId() != null) {
                    sb.append(e.getPaymentMethodId()).append("|").append(e.getGetMethodName()).append("|").append(e.getValue()).append(", ");
                }
            });
            paymentAccountFilterInputTextField.setText(sb.toString());
        }
        if (filter.getBannedCurrencies() != null)
            bannedCurrenciesInputTextField.setText(filter.getBannedCurrencies().stream().collect(Collectors.joining(", ")));
        if (filter.getBannedPaymentMethods() != null)
            bannedPaymentMethodsInputTextField.setText(filter.getBannedPaymentMethods().stream().collect(Collectors.joining(", ")));
        if (filter.getArbitrators() != null)
            arbitratorsInputTextField.setText(filter.getArbitrators().stream().collect(Collectors.joining(", ")));
        if (filter.getSeedNodes() != null)
            seedNodesInputTextField.setText(filter.getSeedNodes().stream().collect(Collectors.joining(", ")));
        if (filter.getPriceRelayNodes() != null)
            priceRelayNodesInputTextField.setText(filter.getPriceRelayNodes().stream().collect(Collectors.joining(", ")));
        if (filter.getBtcNodes() != null)
            btcNodesInputTextField.setText(filter.getBtcNodes().stream().collect(Collectors.joining(", ")));
        preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());
    }
    Button sendButton = new AutoTooltipButton(Res.get("filterWindow.add"));
    sendButton.setOnAction(e -> {
        List<String> offerIds = new ArrayList<>();
        List<String> nodes = new ArrayList<>();
        List<PaymentAccountFilter> paymentAccountFilters = new ArrayList<>();
        List<String> bannedCurrencies = new ArrayList<>();
        List<String> bannedPaymentMethods = new ArrayList<>();
        List<String> arbitrators = new ArrayList<>();
        List<String> seedNodes = new ArrayList<>();
        List<String> priceRelayNodes = new ArrayList<>();
        List<String> btcNodes = new ArrayList<>();
        if (!offerIdsInputTextField.getText().isEmpty()) {
            offerIds = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(offerIdsInputTextField.getText()).split(",")));
        }
        if (!nodesInputTextField.getText().isEmpty()) {
            nodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(nodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
        }
        if (!paymentAccountFilterInputTextField.getText().isEmpty()) {
            paymentAccountFilters = new ArrayList<>(Arrays.asList(paymentAccountFilterInputTextField.getText().replace(", ", ",").split(",")).stream().map(item -> {
                String[] list = item.split("\\|");
                if (list.length == 3)
                    return new PaymentAccountFilter(list[0], list[1], list[2]);
                else
                    return new PaymentAccountFilter("", "", "");
            }).collect(Collectors.toList()));
        }
        if (!bannedCurrenciesInputTextField.getText().isEmpty()) {
            bannedCurrencies = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(bannedCurrenciesInputTextField.getText()).split(",")));
        }
        if (!bannedPaymentMethodsInputTextField.getText().isEmpty()) {
            bannedPaymentMethods = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(bannedPaymentMethodsInputTextField.getText()).split(",")));
        }
        if (!arbitratorsInputTextField.getText().isEmpty()) {
            arbitrators = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(arbitratorsInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
        }
        if (!seedNodesInputTextField.getText().isEmpty()) {
            seedNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(seedNodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
        }
        if (!priceRelayNodesInputTextField.getText().isEmpty()) {
            priceRelayNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(priceRelayNodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
        }
        if (!btcNodesInputTextField.getText().isEmpty()) {
            btcNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(btcNodesInputTextField.getText()).split(",")));
        }
        if (sendFilterMessageHandler.handle(new Filter(offerIds, nodes, paymentAccountFilters, bannedCurrencies, bannedPaymentMethods, arbitrators, seedNodes, priceRelayNodes, preventPublicBtcNetworkCheckBox.isSelected(), btcNodes), keyInputTextField.getText()))
            hide();
        else
            new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
    });
    Button removeFilterMessageButton = new AutoTooltipButton(Res.get("filterWindow.remove"));
    removeFilterMessageButton.setOnAction(e -> {
        if (keyInputTextField.getText().length() > 0) {
            if (removeFilterMessageHandler.handle(keyInputTextField.getText()))
                hide();
            else
                new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
        }
    });
    closeButton = new AutoTooltipButton(Res.get("shared.close"));
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(sendButton, removeFilterMessageButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Also used : Button(javafx.scene.control.Button) Scene(javafx.scene.Scene) KeyCode(javafx.scene.input.KeyCode) HBox(javafx.scene.layout.HBox) HPos(javafx.geometry.HPos) Popup(bisq.desktop.main.overlays.popups.Popup) Arrays(java.util.Arrays) PaymentAccountFilter(bisq.core.filter.PaymentAccountFilter) FilterManager(bisq.core.filter.FilterManager) CheckBox(javafx.scene.control.CheckBox) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) ArrayList(java.util.ArrayList) List(java.util.List) Insets(javafx.geometry.Insets) InputTextField(bisq.desktop.components.InputTextField) DevEnv(bisq.common.app.DevEnv) Res(bisq.core.locale.Res) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Overlay(bisq.desktop.main.overlays.Overlay) Filter(bisq.core.filter.Filter) FormBuilder.addLabelCheckBox(bisq.desktop.util.FormBuilder.addLabelCheckBox) GridPane(javafx.scene.layout.GridPane) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) InputTextField(bisq.desktop.components.InputTextField) ArrayList(java.util.ArrayList) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) PaymentAccountFilter(bisq.core.filter.PaymentAccountFilter) Filter(bisq.core.filter.Filter) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) CheckBox(javafx.scene.control.CheckBox) FormBuilder.addLabelCheckBox(bisq.desktop.util.FormBuilder.addLabelCheckBox) PaymentAccountFilter(bisq.core.filter.PaymentAccountFilter)

Example 15 with AutoTooltipButton

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

the class OpenOffersView method setDeactivateColumnCellFactory.

private void setDeactivateColumnCellFactory() {
    deactivateItemColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper<>(offerListItem.getValue()));
    deactivateItemColumn.setCellFactory(new Callback<TableColumn<OpenOfferListItem, OpenOfferListItem>, TableCell<OpenOfferListItem, OpenOfferListItem>>() {

        @Override
        public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
            return new TableCell<OpenOfferListItem, OpenOfferListItem>() {

                final ImageView iconView = new ImageView();

                Button button;

                private void updateState(@NotNull OpenOffer openOffer) {
                    if (openOffer.isDeactivated()) {
                        button.setText(Res.get("shared.activate"));
                        iconView.setId("image-alert-round");
                        button.setGraphic(iconView);
                    } else {
                        button.setText(Res.get("shared.deactivate"));
                        iconView.setId("image-green_circle");
                        button.setGraphic(iconView);
                    }
                }

                @Override
                public void updateItem(final OpenOfferListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        if (button == null) {
                            button = new AutoTooltipButton();
                            button.setGraphic(iconView);
                            updateState(item.getOpenOffer());
                            button.setMinWidth(70);
                            setGraphic(button);
                        }
                        button.setOnAction(event -> {
                            if (item.getOpenOffer().isDeactivated()) {
                                onActivateOpenOffer(item.getOpenOffer());
                            } else {
                                onDeactivateOpenOffer(item.getOpenOffer());
                            }
                            updateState(item.getOpenOffer());
                            tableView.refresh();
                        });
                    } else {
                        setGraphic(null);
                        if (button != null) {
                            button.setOnAction(null);
                            button = null;
                        }
                    }
                }
            };
        }
    });
}
Also used : Button(javafx.scene.control.Button) OfferDetailsWindow(bisq.desktop.main.overlays.windows.OfferDetailsWindow) OpenOffer(bisq.core.offer.OpenOffer) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) VBox(javafx.scene.layout.VBox) Volume(bisq.core.monetary.Volume) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) WithdrawalView(bisq.desktop.main.funds.withdrawal.WithdrawalView) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) FundsView(bisq.desktop.main.funds.FundsView) Tooltip(javafx.scene.control.Tooltip) SortedList(javafx.collections.transformation.SortedList) Navigation(bisq.desktop.Navigation) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) DontShowAgainLookup(bisq.core.user.DontShowAgainLookup) FXML(javafx.fxml.FXML) MainView(bisq.desktop.main.MainView) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Price(bisq.core.monetary.Price) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) NotNull(org.jetbrains.annotations.NotNull) OpenOffer(bisq.core.offer.OpenOffer) TableColumn(javafx.scene.control.TableColumn) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) TableCell(javafx.scene.control.TableCell) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ImageView(javafx.scene.image.ImageView)

Aggregations

AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)43 Button (javafx.scene.control.Button)37 Insets (javafx.geometry.Insets)31 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)28 Label (javafx.scene.control.Label)27 HBox (javafx.scene.layout.HBox)26 Popup (bisq.desktop.main.overlays.popups.Popup)17 ImageView (javafx.scene.image.ImageView)17 Res (bisq.core.locale.Res)15 FxmlView (bisq.desktop.common.view.FxmlView)13 Callback (javafx.util.Callback)13 Inject (javax.inject.Inject)13 InputTextField (bisq.desktop.components.InputTextField)12 ChangeListener (javafx.beans.value.ChangeListener)12 Tooltip (javafx.scene.control.Tooltip)12 VBox (javafx.scene.layout.VBox)12 Tuple2 (bisq.common.util.Tuple2)11 GridPane (javafx.scene.layout.GridPane)11 TableCell (javafx.scene.control.TableCell)10 TableColumn (javafx.scene.control.TableColumn)10