Search in sources :

Example 6 with AutoTooltipButton

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

the class TraderDisputeView method getContractColumn.

private TableColumn<Dispute, Dispute> getContractColumn() {
    TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.details")) {

        {
            setMinWidth(80);
            setSortable(false);
        }
    };
    column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
    column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {

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

                Button button;

                @Override
                public void updateItem(final Dispute item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        if (button == null) {
                            button = new AutoTooltipButton(Res.get("shared.details"));
                            setGraphic(button);
                        }
                        button.setOnAction(e -> onOpenContract(item));
                    } else {
                        setGraphic(null);
                        if (button != null) {
                            button.setOnAction(null);
                            button = null;
                        }
                    }
                }
            };
        }
    });
    return column;
}
Also used : Button(javafx.scene.control.Button) EventHandler(javafx.event.EventHandler) PubKeyRing(bisq.common.crypto.PubKeyRing) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) ListCell(javafx.scene.control.ListCell) URL(java.net.URL) Date(java.util.Date) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(bisq.core.arbitration.DisputeManager) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) Contract(bisq.core.trade.Contract) InputTextField(bisq.desktop.components.InputTextField) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) Map(java.util.Map) TableView(javafx.scene.control.TableView) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) Pane(javafx.scene.layout.Pane) SortedList(javafx.collections.transformation.SortedList) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) P2PService(bisq.network.p2p.P2PService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) SendPrivateNotificationWindow(bisq.desktop.main.overlays.windows.SendPrivateNotificationWindow) Priority(javafx.scene.layout.Priority) List(java.util.List) TradeManager(bisq.core.trade.TradeManager) AnchorPane(javafx.scene.layout.AnchorPane) Paint(javafx.scene.paint.Paint) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) UserThread(bisq.common.UserThread) ByteStreams(com.google.common.io.ByteStreams) Optional(java.util.Optional) Attachment(bisq.core.arbitration.Attachment) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) GUIUtil(bisq.desktop.util.GUIUtil) Scene(javafx.scene.Scene) ActivatableView(bisq.desktop.common.view.ActivatableView) ListView(javafx.scene.control.ListView) DisputeSummaryWindow(bisq.desktop.main.overlays.windows.DisputeSummaryWindow) TextArea(javafx.scene.control.TextArea) SimpleDateFormat(java.text.SimpleDateFormat) Timer(bisq.common.Timer) HashMap(java.util.HashMap) Dispute(bisq.core.arbitration.Dispute) ContractWindow(bisq.desktop.main.overlays.windows.ContractWindow) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) Connection(bisq.network.p2p.network.Connection) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) Nullable(javax.annotation.Nullable) KeyCode(javafx.scene.input.KeyCode) Version(bisq.common.app.Version) Label(javafx.scene.control.Label) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) MalformedURLException(java.net.MalformedURLException) Trade(bisq.core.trade.Trade) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) ArbitratorDisputeView(bisq.desktop.main.disputes.arbitrator.ArbitratorDisputeView) Named(com.google.inject.name.Named) KeyRing(bisq.common.crypto.KeyRing) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) 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) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) Dispute(bisq.core.arbitration.Dispute)

Example 7 with AutoTooltipButton

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

the class ArbitratorRegistrationView method buildUI.

private void buildUI() {
    GridPane gridPane = new GridPane();
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    root.getChildren().add(gridPane);
    addTitledGroupBg(gridPane, gridRow, 3, Res.get("account.tab.arbitratorRegistration"));
    TextField pubKeyTextField = FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("account.arbitratorRegistration.pubKey"), model.registrationPubKeyAsHex.get(), Layout.FIRST_ROW_DISTANCE).second;
    pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);
    Tuple2<Label, ListView> tuple = addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
    GridPane.setValignment(tuple.first, VPos.TOP);
    // noinspection unchecked
    languagesListView = tuple.second;
    languagesListView.disableProperty().bind(model.registrationEditDisabled);
    languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {

        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ListCell<String>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(LanguageUtil.getDisplayName(item));
                        removeButton.setOnAction(e -> onRemoveLanguage(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    // noinspection unchecked
    languageComboBox = addLabelComboBox(gridPane, ++gridRow).second;
    languageComboBox.disableProperty().bind(model.registrationEditDisabled);
    languageComboBox.setPromptText(Res.get("shared.addLanguage"));
    languageComboBox.setConverter(new StringConverter<String>() {

        @Override
        public String toString(String code) {
            return LanguageUtil.getDisplayName(code);
        }

        @Override
        public String fromString(String s) {
            return null;
        }
    });
    languageComboBox.setOnAction(e -> onAddLanguage());
    Button registerButton = addButtonAfterGroup(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.register"));
    registerButton.disableProperty().bind(model.registrationEditDisabled);
    registerButton.setOnAction(e -> onRegister());
    Button revokeButton = addButton(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.revoke"));
    revokeButton.setDefaultButton(false);
    revokeButton.disableProperty().bind(model.revokeButtonDisabled);
    revokeButton.setOnAction(e -> onRevoke());
    addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("shared.information"), Layout.GROUP_DISTANCE);
    Label infoLabel = addMultilineLabel(gridPane, gridRow);
    GridPane.setMargin(infoLabel, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
    infoLabel.setText(Res.get("account.arbitratorRegistration.info.msg"));
}
Also used : Button(javafx.scene.control.Button) Arbitrator(bisq.core.arbitration.Arbitrator) HPos(javafx.geometry.HPos) ListView(javafx.scene.control.ListView) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ListCell(javafx.scene.control.ListCell) UnlockArbitrationRegistrationWindow(bisq.desktop.main.overlays.windows.UnlockArbitrationRegistrationWindow) Layout(bisq.desktop.util.Layout) VBox(javafx.scene.layout.VBox) FxmlView(bisq.desktop.common.view.FxmlView) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) ListChangeListener(javafx.collections.ListChangeListener) VPos(javafx.geometry.VPos) Res(bisq.core.locale.Res) Callback(javafx.util.Callback) GridPane(javafx.scene.layout.GridPane) Popup(bisq.desktop.main.overlays.popups.Popup) TextField(javafx.scene.control.TextField) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder(bisq.desktop.util.FormBuilder) StringConverter(javafx.util.StringConverter) Priority(javafx.scene.layout.Priority) ImageUtil(bisq.desktop.util.ImageUtil) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) LanguageUtil(bisq.core.locale.LanguageUtil) UserThread(bisq.common.UserThread) Named(com.google.inject.name.Named) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ListView(javafx.scene.control.ListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) TextField(javafx.scene.control.TextField) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane)

Example 8 with AutoTooltipButton

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

the class ArbitratorSelectionView method addLanguageGroup.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI builder
// /////////////////////////////////////////////////////////////////////////////////////////
private void addLanguageGroup() {
    addTitledGroupBg(root, gridRow, 1, Res.get("account.arbitratorSelection.whichLanguages"));
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("shared.yourLanguage"), Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    // noinspection unchecked
    languagesListView = tuple.second;
    languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {

        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ListCell<String>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(LanguageUtil.getDisplayName(item));
                        removeButton.setOnAction(e -> onRemoveLanguage(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    // noinspection unchecked
    languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
    languageComboBox.setPromptText(Res.get("shared.addLanguage"));
    languageComboBox.setConverter(new StringConverter<String>() {

        @Override
        public String toString(String code) {
            return LanguageUtil.getDisplayName(code);
        }

        @Override
        public String fromString(String s) {
            return null;
        }
    });
    languageComboBox.setOnAction(e -> onAddLanguage());
}
Also used : TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) TableCell(javafx.scene.control.TableCell) FormBuilder.addLabelComboBox(bisq.desktop.util.FormBuilder.addLabelComboBox) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) VPos(javafx.geometry.VPos) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) GridPane(javafx.scene.layout.GridPane) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) Popup(bisq.desktop.main.overlays.popups.Popup) Label(javafx.scene.control.Label) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableRow(javafx.scene.control.TableRow) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) CheckBox(javafx.scene.control.CheckBox) StringConverter(javafx.util.StringConverter) FormBuilder.addCheckBox(bisq.desktop.util.FormBuilder.addCheckBox) BooleanProperty(javafx.beans.property.BooleanProperty) ImageUtil(bisq.desktop.util.ImageUtil) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) LanguageUtil(bisq.core.locale.LanguageUtil) UserThread(bisq.common.UserThread) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) AutoTooltipCheckBox(bisq.desktop.components.AutoTooltipCheckBox) ChangeListener(javafx.beans.value.ChangeListener) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ListView(javafx.scene.control.ListView) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane)

Example 9 with AutoTooltipButton

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

the class OfferBookView method getActionColumn.

private TableColumn<OfferBookListItem, OfferBookListItem> getActionColumn() {
    TableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem>("") {

        {
            setMinWidth(80);
            setSortable(false);
        }
    };
    column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    column.setCellFactory(new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem, OfferBookListItem>>() {

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

                final ImageView iconView = new ImageView();

                final Button button = new AutoTooltipButton();

                boolean isTradable, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit;

                {
                    button.setGraphic(iconView);
                    button.setMinWidth(130);
                    button.setMaxWidth(130);
                    button.setGraphicTextGap(10);
                }

                @Override
                public void updateItem(final OfferBookListItem newItem, boolean empty) {
                    super.updateItem(newItem, empty);
                    TableRow tableRow = getTableRow();
                    if (newItem != null && !empty) {
                        final Offer offer = newItem.getOffer();
                        boolean myOffer = model.isMyOffer(offer);
                        if (tableRow != null) {
                            isPaymentAccountValidForOffer = model.isAnyPaymentAccountValidForOffer(offer);
                            hasMatchingArbitrator = model.hasMatchingArbitrator(offer);
                            hasSameProtocolVersion = model.hasSameProtocolVersion(offer);
                            isIgnored = model.isIgnored(offer);
                            isOfferBanned = model.isOfferBanned(offer);
                            isCurrencyBanned = model.isCurrencyBanned(offer);
                            isPaymentMethodBanned = model.isPaymentMethodBanned(offer);
                            isNodeAddressBanned = model.isNodeAddressBanned(offer);
                            isInsufficientTradeLimit = model.isInsufficientTradeLimit(offer);
                            isTradable = isPaymentAccountValidForOffer && hasMatchingArbitrator && hasSameProtocolVersion && !isIgnored && !isOfferBanned && !isCurrencyBanned && !isPaymentMethodBanned && !isNodeAddressBanned && !isInsufficientTradeLimit;
                            tableRow.setOpacity(isTradable || myOffer ? 1 : 0.4);
                            if (isTradable) {
                                // set first row button as default
                                button.setDefaultButton(getIndex() == 0);
                                tableRow.setOnMousePressed(null);
                            } else {
                                button.setDefaultButton(false);
                                tableRow.setOnMousePressed(e -> {
                                    // ugly hack to get the icon clickable when deactivated
                                    if (!(e.getTarget() instanceof ImageView || e.getTarget() instanceof Canvas))
                                        onShowInfo(offer, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit);
                                });
                            }
                        }
                        String title;
                        if (myOffer) {
                            iconView.setId("image-remove");
                            title = Res.get("shared.remove");
                            button.setId("cancel-button");
                            // does not take the font colors sometimes from the style
                            button.setStyle("-fx-text-fill: #444;");
                            button.setOnAction(e -> onRemoveOpenOffer(offer));
                        } else {
                            boolean isSellOffer = offer.getDirection() == OfferPayload.Direction.SELL;
                            iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
                            button.setId(isSellOffer ? "buy-button" : "sell-button");
                            // does not take the font colors sometimes from the style
                            button.setStyle("-fx-text-fill: white;");
                            title = Res.get("offerbook.takeOffer");
                            button.setTooltip(new Tooltip(Res.get("offerbook.takeOfferButton.tooltip", model.getDirectionLabelTooltip(offer))));
                            button.setOnAction(e -> onTakeOffer(offer));
                        }
                        if (!myOffer && !isTradable)
                            button.setOnAction(e -> onShowInfo(offer, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit));
                        button.setText(title);
                        setGraphic(button);
                    } else {
                        setGraphic(null);
                        if (button != null)
                            button.setOnAction(null);
                        if (tableRow != null) {
                            tableRow.setOpacity(1);
                            tableRow.setOnMousePressed(null);
                        }
                    }
                }
            };
        }
    });
    return column;
}
Also used : Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) ArbitratorSelectionView(bisq.desktop.main.account.content.arbitratorselection.ArbitratorSelectionView) Coin(org.bitcoinj.core.Coin) Layout(bisq.desktop.util.Layout) FiatAccountsView(bisq.desktop.main.account.content.fiataccounts.FiatAccountsView) BSFormatter(bisq.desktop.util.BSFormatter) FormBuilder.getIcon(bisq.desktop.util.FormBuilder.getIcon) ComboBox(javafx.scene.control.ComboBox) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) MonadicBinding(org.fxmisc.easybind.monadic.MonadicBinding) TableView(javafx.scene.control.TableView) Navigation(bisq.desktop.Navigation) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) Offer(bisq.core.offer.Offer) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) Canvas(javafx.scene.canvas.Canvas) Subscription(org.fxmisc.easybind.Subscription) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Priority(javafx.scene.layout.Priority) PaymentAccount(bisq.core.payment.PaymentAccount) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) AccountSettingsView(bisq.desktop.main.account.settings.AccountSettingsView) Optional(java.util.Optional) MaterialDesignIcon(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon) NotNull(org.jetbrains.annotations.NotNull) GUIUtil(bisq.desktop.util.GUIUtil) Scene(javafx.scene.Scene) TradeCurrency(bisq.core.locale.TradeCurrency) FormBuilder.addHBoxLabelComboBox(bisq.desktop.util.FormBuilder.addHBoxLabelComboBox) OfferDetailsWindow(bisq.desktop.main.overlays.windows.OfferDetailsWindow) FiatCurrency(bisq.core.locale.FiatCurrency) Volume(bisq.core.monetary.Volume) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) InfoAutoTooltipLabel(bisq.desktop.components.InfoAutoTooltipLabel) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) WithdrawalView(bisq.desktop.main.funds.withdrawal.WithdrawalView) OfferPayload(bisq.core.offer.OfferPayload) Tuple3(bisq.common.util.Tuple3) Insets(javafx.geometry.Insets) VPos(javafx.geometry.VPos) ColoredDecimalPlacesWithZerosText(bisq.desktop.components.ColoredDecimalPlacesWithZerosText) Callback(javafx.util.Callback) FundsView(bisq.desktop.main.funds.FundsView) Tooltip(javafx.scene.control.Tooltip) AccountView(bisq.desktop.main.account.AccountView) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) TableRow(javafx.scene.control.TableRow) DontShowAgainLookup(bisq.core.user.DontShowAgainLookup) OfferView(bisq.desktop.main.offer.OfferView) StringConverter(javafx.util.StringConverter) PeerInfoIcon(bisq.desktop.components.PeerInfoIcon) FormBuilder.addButton(bisq.desktop.util.FormBuilder.addButton) MainView(bisq.desktop.main.MainView) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) Price(bisq.core.monetary.Price) ObservableValue(javafx.beans.value.ObservableValue) Named(com.google.inject.name.Named) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) Comparator(java.util.Comparator) ContentDisplay(javafx.scene.control.ContentDisplay) Canvas(javafx.scene.canvas.Canvas) Tooltip(javafx.scene.control.Tooltip) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) 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) FormBuilder.addButton(bisq.desktop.util.FormBuilder.addButton) Offer(bisq.core.offer.Offer) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableRow(javafx.scene.control.TableRow) ImageView(javafx.scene.image.ImageView)

Example 10 with AutoTooltipButton

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

the class TakeOfferView method addFundingGroup.

private void addFundingGroup() {
    // don't increase gridRow as we removed button when this gets visible
    payFundsPane = FormBuilder.addTitledGroupBg(gridPane, gridRow, 3, Res.get("takeOffer.fundsBox.title"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(payFundsPane, 3);
    payFundsPane.setVisible(false);
    Tuple2<Label, FundsTextField> fundsTuple = addLabelFundsTextfield(gridPane, gridRow, Res.get("shared.totalsNeeded"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    totalToPayLabel = fundsTuple.first;
    totalToPayLabel.setVisible(false);
    totalToPayTextField = fundsTuple.second;
    totalToPayTextField.setVisible(false);
    qrCodeImageView = new ImageView();
    qrCodeImageView.setVisible(false);
    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, 2);
    GridPane.setRowSpan(qrCodeImageView, 3);
    GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE - 9, 0, 0, 5));
    gridPane.getChildren().add(qrCodeImageView);
    Tuple2<Label, AddressTextField> addressTuple = FormBuilder.addLabelAddressTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletAddress"));
    addressLabel = addressTuple.first;
    addressLabel.setVisible(false);
    addressTextField = addressTuple.second;
    addressTextField.setVisible(false);
    Tuple2<Label, BalanceTextField> balanceTuple = FormBuilder.addLabelBalanceTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletBalance"));
    balanceLabel = balanceTuple.first;
    balanceLabel.setVisible(false);
    balanceTextField = balanceTuple.second;
    balanceTextField.setVisible(false);
    fundingHBox = new HBox();
    fundingHBox.setVisible(false);
    fundingHBox.setManaged(false);
    fundingHBox.setSpacing(10);
    Button fundFromSavingsWalletButton = new AutoTooltipButton(Res.get("shared.fundFromSavingsWalletButton"));
    fundFromSavingsWalletButton.setDefaultButton(true);
    fundFromSavingsWalletButton.setDefaultButton(false);
    fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet());
    Label label = new AutoTooltipLabel(Res.get("shared.OR"));
    label.setPadding(new Insets(5, 0, 0, 0));
    Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton"));
    fundFromExternalWalletButton.setDefaultButton(false);
    fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));
    waitingForFundsBusyAnimation = new BusyAnimation(false);
    waitingForFundsLabel = new AutoTooltipLabel();
    waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0));
    fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel);
    GridPane.setRowIndex(fundingHBox, ++gridRow);
    GridPane.setColumnIndex(fundingHBox, 1);
    GridPane.setMargin(fundingHBox, new Insets(15, 10, 0, 0));
    gridPane.getChildren().add(fundingHBox);
    takeOfferButton = FormBuilder.addButtonAfterGroup(gridPane, gridRow, "");
    takeOfferButton.setVisible(false);
    takeOfferButton.setManaged(false);
    takeOfferButton.setMinHeight(40);
    takeOfferButton.setPadding(new Insets(0, 20, 0, 20));
    takeOfferButton.setOnAction(e -> onTakeOffer());
    cancelButton2 = FormBuilder.addButton(gridPane, ++gridRow, Res.get("shared.cancel"));
    cancelButton2.setOnAction(e -> {
        if (model.dataModel.getIsBtcWalletFunded().get()) {
            new Popup<>().warning(Res.get("takeOffer.alreadyFunded.askCancel")).closeButtonText(Res.get("shared.no")).actionButtonText(Res.get("shared.yesCancel")).onAction(() -> {
                model.dataModel.swapTradeToSavings();
                close();
            }).show();
        } else {
            close();
            model.dataModel.swapTradeToSavings();
        }
    });
    cancelButton2.setDefaultButton(false);
    cancelButton2.setVisible(false);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) BusyAnimation(bisq.desktop.components.BusyAnimation) AddressTextField(bisq.desktop.components.AddressTextField) Tooltip(javafx.scene.control.Tooltip) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) BalanceTextField(bisq.desktop.components.BalanceTextField) FundsTextField(bisq.desktop.components.FundsTextField) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

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