From 9820e313819cbc3c8395dd84890a33a33e31851c Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 20 Dec 2017 12:52:51 +0100 Subject: [PATCH 1/8] Show a tooltip if the text is truncated --- .../main/java/io/bisq/gui/app/BisqApp.java | 3 +- .../AddressWithIconAndDirection.java | 6 +-- .../bisq/gui/components/AutoTooltipLabel.java | 48 +++++++++++++++++++ .../gui/components/BsqAddressTextField.java | 2 +- .../gui/components/HyperlinkWithIcon.java | 2 +- .../io/bisq/gui/components/InfoDisplay.java | 4 +- .../bisq/gui/components/InputTextField.java | 4 +- .../gui/components/PasswordTextField.java | 4 +- .../io/bisq/gui/components/PeerInfoIcon.java | 4 +- .../gui/components/TextFieldWithCopyIcon.java | 2 +- .../main/java/io/bisq/gui/main/MainView.java | 19 ++++---- .../altcoinaccounts/AltCoinAccountsView.java | 5 +- .../ArbitratorSelectionView.java | 3 +- .../fiataccounts/FiatAccountsView.java | 5 +- .../dao/compensation/CompensationView.java | 3 +- .../active/ActiveCompensationRequestView.java | 3 +- .../bisq/gui/main/dao/voting/VotingView.java | 3 +- .../dao/voting/vote/ParameterViewItem.java | 3 +- .../gui/main/dao/wallet/BsqWalletView.java | 3 +- .../wallet/dashboard/BsqDashboardView.java | 3 +- .../gui/main/dao/wallet/tx/BsqTxView.java | 3 +- .../gui/main/funds/deposit/DepositView.java | 9 ++-- .../gui/main/funds/locked/LockedListItem.java | 3 +- .../gui/main/funds/locked/LockedView.java | 7 +-- .../main/funds/reserved/ReservedListItem.java | 3 +- .../gui/main/funds/reserved/ReservedView.java | 7 +-- .../funds/transactions/TransactionsView.java | 5 +- .../funds/withdrawal/WithdrawalListItem.java | 3 +- .../main/funds/withdrawal/WithdrawalView.java | 3 +- .../market/offerbook/OfferBookChartView.java | 7 +-- .../gui/main/market/spread/SpreadView.java | 5 +- .../main/market/trades/TradesChartsView.java | 9 ++-- .../trades/charts/price/CandleTooltip.java | 27 ++++++----- .../offer/createoffer/CreateOfferView.java | 18 +++---- .../main/offer/offerbook/OfferBookView.java | 5 +- .../main/offer/takeoffer/TakeOfferView.java | 22 ++++----- .../main/overlays/windows/QRCodeWindow.java | 3 +- .../UnlockArbitrationRegistrationWindow.java | 3 +- .../windows/WalletPasswordWindow.java | 7 +-- .../DisplayUpdateDownloadWindow.java | 3 +- .../steps/buyer/BuyerStep4View.java | 3 +- .../settings/network/NetworkSettingsView.java | 3 +- .../settings/preferences/PreferencesView.java | 13 ++--- 43 files changed, 188 insertions(+), 112 deletions(-) create mode 100644 gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java diff --git a/gui/src/main/java/io/bisq/gui/app/BisqApp.java b/gui/src/main/java/io/bisq/gui/app/BisqApp.java index c551fb3ee0c..e913ee9251c 100644 --- a/gui/src/main/java/io/bisq/gui/app/BisqApp.java +++ b/gui/src/main/java/io/bisq/gui/app/BisqApp.java @@ -60,6 +60,7 @@ import io.bisq.gui.common.view.View; import io.bisq.gui.common.view.ViewLoader; import io.bisq.gui.common.view.guice.InjectorViewFactory; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.MainView; import io.bisq.gui.main.debug.DebugView; import io.bisq.gui.main.overlays.popups.Popup; @@ -398,7 +399,7 @@ private void showDebugWindow() { } private void showFPSWindow() { - Label label = new Label(); + Label label = new AutoTooltipLabel(); EventStreams.animationTicks() .latestN(100) .map(ticks -> { diff --git a/gui/src/main/java/io/bisq/gui/components/AddressWithIconAndDirection.java b/gui/src/main/java/io/bisq/gui/components/AddressWithIconAndDirection.java index cb7d098ba3e..93040dd266a 100644 --- a/gui/src/main/java/io/bisq/gui/components/AddressWithIconAndDirection.java +++ b/gui/src/main/java/io/bisq/gui/components/AddressWithIconAndDirection.java @@ -20,7 +20,7 @@ public class AddressWithIconAndDirection extends AnchorPane { private final Label openLinkIcon; public AddressWithIconAndDirection(String text, String address, AwesomeIcon awesomeIcon, boolean received) { - Label directionIcon = new Label(); + Label directionIcon = new AutoTooltipLabel(); directionIcon.setLayoutY(3); directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon"); AwesomeDude.setIcon(directionIcon, received ? AwesomeIcon.SIGNIN : AwesomeIcon.SIGNOUT); @@ -28,7 +28,7 @@ public AddressWithIconAndDirection(String text, String address, AwesomeIcon awes HBox hBox = new HBox(); hBox.setSpacing(-1); - Label label = new Label(text); + Label label = new AutoTooltipLabel(text); label.setMouseTransparent(true); HBox.setMargin(label, new Insets(4, 0, 0, 0)); HBox.setHgrow(label, Priority.ALWAYS); @@ -43,7 +43,7 @@ public AddressWithIconAndDirection(String text, String address, AwesomeIcon awes hBox.getChildren().addAll(label, hyperlink); - openLinkIcon = new Label(); + openLinkIcon = new AutoTooltipLabel(); openLinkIcon.setLayoutY(3); openLinkIcon.getStyleClass().add("external-link-icon"); openLinkIcon.setOpacity(0.7); diff --git a/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java b/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java new file mode 100644 index 00000000000..24f5e607084 --- /dev/null +++ b/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java @@ -0,0 +1,48 @@ +package io.bisq.gui.components; + +import com.sun.javafx.scene.control.skin.LabelSkin; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.control.Skin; +import javafx.scene.control.Tooltip; +import javafx.scene.text.Text; + +public class AutoTooltipLabel extends Label { + + public AutoTooltipLabel(){ + super(); + } + + public AutoTooltipLabel(String text) { + super(text); + } + + @Override + protected Skin createDefaultSkin() { + return new AutoTooltipLabelSkin(this); + } + + private class AutoTooltipLabelSkin extends LabelSkin { + private final Label truncateToFitLabel; + + public AutoTooltipLabelSkin(Label label) { + super(label); + this.truncateToFitLabel = label; + } + + @Override + protected void layoutChildren(double x, double y, double w, double h) { + super.layoutChildren(x, y, w, h); + for (Node node : getChildren()) { + if (node instanceof Text) { + String displayedText = ((Text) node).getText(); + if (displayedText.equals(truncateToFitLabel.getText())) { + truncateToFitLabel.setTooltip(null); + } else { + truncateToFitLabel.setTooltip(new Tooltip(truncateToFitLabel.getText())); + } + } + } + } + } +} diff --git a/gui/src/main/java/io/bisq/gui/components/BsqAddressTextField.java b/gui/src/main/java/io/bisq/gui/components/BsqAddressTextField.java index e8235febbbb..e7f5835556f 100644 --- a/gui/src/main/java/io/bisq/gui/components/BsqAddressTextField.java +++ b/gui/src/main/java/io/bisq/gui/components/BsqAddressTextField.java @@ -72,7 +72,7 @@ public BsqAddressTextField() { //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); - Label copyIcon = new Label(); + Label copyIcon = new AutoTooltipLabel(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().add("copy-icon"); copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard"))); diff --git a/gui/src/main/java/io/bisq/gui/components/HyperlinkWithIcon.java b/gui/src/main/java/io/bisq/gui/components/HyperlinkWithIcon.java index 94dc4922c27..56036118adc 100644 --- a/gui/src/main/java/io/bisq/gui/components/HyperlinkWithIcon.java +++ b/gui/src/main/java/io/bisq/gui/components/HyperlinkWithIcon.java @@ -28,7 +28,7 @@ public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon, boolean isCentere setSpacing(5); hyperlink = new Hyperlink(text); - icon = new Label(); + icon = new AutoTooltipLabel(); icon.getStyleClass().add("external-link-icon"); AwesomeDude.setIcon(icon, awesomeIcon); icon.setMinWidth(20); diff --git a/gui/src/main/java/io/bisq/gui/components/InfoDisplay.java b/gui/src/main/java/io/bisq/gui/components/InfoDisplay.java index e73334ff6ff..a63526dc452 100644 --- a/gui/src/main/java/io/bisq/gui/components/InfoDisplay.java +++ b/gui/src/main/java/io/bisq/gui/components/InfoDisplay.java @@ -68,7 +68,7 @@ public InfoDisplay() { GridPane.setMargin(icon, new Insets(-2, 0, 0, 0)); GridPane.setRowSpan(icon, 2); - label = new Label(); + label = new AutoTooltipLabel(); label.textProperty().bind(text); label.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); // width is set a frame later so we hide it first @@ -79,7 +79,7 @@ public InfoDisplay() { // We need that to know if we have a wrapping or not. // Did not find a way to get that from the API. - Label testLabel = new Label(); + Label testLabel = new AutoTooltipLabel(); testLabel.textProperty().bind(text); textFlow = new TextFlow(); diff --git a/gui/src/main/java/io/bisq/gui/components/InputTextField.java b/gui/src/main/java/io/bisq/gui/components/InputTextField.java index 7a5a10d166f..af17e1e3883 100644 --- a/gui/src/main/java/io/bisq/gui/components/InputTextField.java +++ b/gui/src/main/java/io/bisq/gui/components/InputTextField.java @@ -172,7 +172,7 @@ private Point2D getErrorPopupPosition() { private static void createErrorPopOver(String errorMessage) { - Label errorLabel = new Label(errorMessage); + Label errorLabel = new AutoTooltipLabel(errorMessage); errorLabel.setId("validation-error"); errorLabel.setPadding(new Insets(0, 10, 0, 10)); errorLabel.setOnMouseClicked(e -> hideErrorMessageDisplay()); @@ -183,4 +183,4 @@ private static void createErrorPopOver(String errorMessage) { errorMessageDisplay.setArrowIndent(5); } -} \ No newline at end of file +} diff --git a/gui/src/main/java/io/bisq/gui/components/PasswordTextField.java b/gui/src/main/java/io/bisq/gui/components/PasswordTextField.java index dd6ec36c8b8..3e43faae59c 100644 --- a/gui/src/main/java/io/bisq/gui/components/PasswordTextField.java +++ b/gui/src/main/java/io/bisq/gui/components/PasswordTextField.java @@ -159,7 +159,7 @@ private Point2D getErrorPopupPosition() { private static void createErrorPopOver(String errorMessage) { - Label errorLabel = new Label(errorMessage); + Label errorLabel = new AutoTooltipLabel(errorMessage); errorLabel.setId("validation-error"); errorLabel.setPadding(new Insets(0, 10, 0, 10)); errorLabel.setOnMouseClicked(e -> hideErrorMessageDisplay()); @@ -170,4 +170,4 @@ private static void createErrorPopOver(String errorMessage) { errorMessageDisplay.setArrowIndent(5); } -} \ No newline at end of file +} diff --git a/gui/src/main/java/io/bisq/gui/components/PeerInfoIcon.java b/gui/src/main/java/io/bisq/gui/components/PeerInfoIcon.java index f2824fad833..00985cced36 100644 --- a/gui/src/main/java/io/bisq/gui/components/PeerInfoIcon.java +++ b/gui/src/main/java/io/bisq/gui/components/PeerInfoIcon.java @@ -132,7 +132,7 @@ public PeerInfoIcon(NodeAddress nodeAddress, numTradesPane.setMouseTransparent(true); ImageView numTradesCircle = new ImageView(); numTradesCircle.setId("image-green_circle"); - numTradesLabel = new Label(); + numTradesLabel = new AutoTooltipLabel(); numTradesLabel.relocate(5, 1); numTradesLabel.setId("ident-num-label"); numTradesPane.getChildren().addAll(numTradesCircle, numTradesLabel); @@ -142,7 +142,7 @@ public PeerInfoIcon(NodeAddress nodeAddress, tagPane.setMouseTransparent(true); ImageView tagCircle = new ImageView(); tagCircle.setId("image-blue_circle"); - tagLabel = new Label(); + tagLabel = new AutoTooltipLabel(); tagLabel.relocate(5, 1); tagLabel.setId("ident-num-label"); tagPane.getChildren().addAll(tagCircle, tagLabel); diff --git a/gui/src/main/java/io/bisq/gui/components/TextFieldWithCopyIcon.java b/gui/src/main/java/io/bisq/gui/components/TextFieldWithCopyIcon.java index 30b51e5bf8b..6e7b85364ef 100644 --- a/gui/src/main/java/io/bisq/gui/components/TextFieldWithCopyIcon.java +++ b/gui/src/main/java/io/bisq/gui/components/TextFieldWithCopyIcon.java @@ -40,7 +40,7 @@ public class TextFieldWithCopyIcon extends AnchorPane { /////////////////////////////////////////////////////////////////////////////////////////// public TextFieldWithCopyIcon() { - Label copyIcon = new Label(); + Label copyIcon = new AutoTooltipLabel(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().add("copy-icon"); copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); diff --git a/gui/src/main/java/io/bisq/gui/main/MainView.java b/gui/src/main/java/io/bisq/gui/main/MainView.java index d7801e4329d..73626afbe3d 100644 --- a/gui/src/main/java/io/bisq/gui/main/MainView.java +++ b/gui/src/main/java/io/bisq/gui/main/MainView.java @@ -28,6 +28,7 @@ import io.bisq.core.exceptions.BisqException; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.account.AccountView; import io.bisq.gui.main.dao.DaoView; @@ -286,7 +287,7 @@ private Tuple2 getBalanceBox(String text) { textField.setFocusTraversable(false); textField.setStyle("-fx-alignment: center; -fx-background-color: white;"); - Label label = new Label(text); + Label label = new AutoTooltipLabel(text); label.setId("nav-balance-label"); label.setPadding(new Insets(0, 5, 0, 5)); label.setPrefWidth(textField.getPrefWidth()); @@ -372,7 +373,7 @@ private Tuple2, VBox> getMarketPriceBox() { ); }); - Label label = new Label(Res.get("mainView.marketPrice.provider")); + Label label = new AutoTooltipLabel(Res.get("mainView.marketPrice.provider")); label.setId("nav-balance-label"); label.setPadding(new Insets(0, 5, 0, 2)); @@ -422,7 +423,7 @@ private VBox createSplashScreen() { // createBitcoinInfoBox - btcSplashInfo = new Label(); + btcSplashInfo = new AutoTooltipLabel(); btcSplashInfo.textProperty().bind(model.btcInfo); walletServiceErrorMsgListener = (ov, oldValue, newValue) -> btcSplashInfo.setId("splash-error-state-msg"); model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener); @@ -455,7 +456,7 @@ private VBox createSplashScreen() { // create P2PNetworkBox - splashP2PNetworkLabel = new Label(); + splashP2PNetworkLabel = new AutoTooltipLabel(); splashP2PNetworkLabel.setWrapText(true); splashP2PNetworkLabel.setMaxWidth(500); splashP2PNetworkLabel.setTextAlignment(TextAlignment.CENTER); @@ -542,7 +543,7 @@ private AnchorPane createFooter() { setTopAnchor(separator, 0d); // BTC - Label btcInfoLabel = new Label(); + Label btcInfoLabel = new AutoTooltipLabel(); btcInfoLabel.setId("footer-pane"); btcInfoLabel.textProperty().bind(model.btcInfo); @@ -580,7 +581,7 @@ private AnchorPane createFooter() { setBottomAnchor(blockchainSyncBox, 7d); // version - versionLabel = new Label(); + versionLabel = new AutoTooltipLabel(); versionLabel.setId("footer-pane"); versionLabel.setTextAlignment(TextAlignment.CENTER); versionLabel.setAlignment(Pos.BASELINE_CENTER); @@ -602,7 +603,7 @@ private AnchorPane createFooter() { }); // P2P Network - Label p2PNetworkLabel = new Label(); + Label p2PNetworkLabel = new AutoTooltipLabel(); p2PNetworkLabel.setId("footer-pane"); setRightAnchor(p2PNetworkLabel, 33d); setBottomAnchor(p2PNetworkLabel, 7d); @@ -635,7 +636,7 @@ private AnchorPane createFooter() { } private void setupNotificationIcon(Pane buttonHolder) { - Label label = new Label(); + Label label = new AutoTooltipLabel(); label.textProperty().bind(model.numPendingTradesAsString); label.relocate(5, 1); label.setId("nav-alert-label"); @@ -654,7 +655,7 @@ private void setupNotificationIcon(Pane buttonHolder) { } private void setupDisputesIcon(Pane buttonHolder) { - Label label = new Label(); + Label label = new AutoTooltipLabel(); label.textProperty().bind(model.numOpenDisputesAsString); label.relocate(5, 1); label.setId("nav-alert-label"); diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java index dd40ddca68c..9d503845227 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -29,6 +29,7 @@ import io.bisq.core.payment.payload.PaymentMethod; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.components.paymentmethods.CryptoCurrencyForm; import io.bisq.gui.components.paymentmethods.PaymentMethodForm; @@ -92,7 +93,7 @@ public void initialize() { if (newValue != null) onSelectAccount(newValue); }; - Label placeholder = new Label(Res.get("shared.noAccountsSetupYet")); + Label placeholder = new AutoTooltipLabel(Res.get("shared.noAccountsSetupYet")); placeholder.setWrapText(true); paymentAccountsListView.setPlaceholder(placeholder); } @@ -208,7 +209,7 @@ private void buildForm() { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java index 5e250178c0d..8b0362b7e6e 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java @@ -23,6 +23,7 @@ import io.bisq.common.util.Tuple2; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TableGroupHeadline; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.util.ImageUtil; @@ -143,7 +144,7 @@ private void addLanguageGroup() { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java b/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java index 513f0df5cd1..11cbc7c1836 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java @@ -26,6 +26,7 @@ import io.bisq.core.payment.payload.PaymentMethod; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.components.paymentmethods.*; import io.bisq.gui.main.overlays.popups.Popup; @@ -118,7 +119,7 @@ public void initialize() { if (newValue != null) onSelectAccount(newValue); }; - Label placeholder = new Label(Res.get("shared.noAccountsSetupYet")); + Label placeholder = new AutoTooltipLabel(Res.get("shared.noAccountsSetupYet")); placeholder.setWrapText(true); paymentAccountsListView.setPlaceholder(placeholder); } @@ -221,7 +222,7 @@ private void buildForm() { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java b/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java index 728e4c6a54d..62bd72a856e 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java @@ -22,6 +22,7 @@ import io.bisq.common.locale.Res; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.compensation.active.ActiveCompensationRequestView; @@ -143,7 +144,7 @@ class MenuItem extends ToggleButton { setPrefWidth(240); setAlignment(Pos.CENTER_LEFT); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); AwesomeDude.setIcon(icon, awesomeIcon); icon.setTextFill(Paint.valueOf("#333")); icon.setPadding(new Insets(0, 5, 0, 0)); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java b/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java index 7490d283547..7d4b710f28e 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java @@ -25,6 +25,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TableGroupHeadline; import io.bisq.gui.main.MainView; @@ -124,7 +125,7 @@ public void initialize() { // tableView.setMinHeight(100); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noData"))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData"))); sortedList = new SortedList<>(compensationRequestManger.getObservableList()); tableView.setItems(sortedList); setColumns(); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java b/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java index 16e93807759..3342aab98f4 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java @@ -22,6 +22,7 @@ import io.bisq.common.locale.Res; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.voting.dashboard.VotingDashboardView; @@ -143,7 +144,7 @@ class MenuItem extends ToggleButton { setPrefWidth(240); setAlignment(Pos.CENTER_LEFT); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); AwesomeDude.setIcon(icon, awesomeIcon); icon.setTextFill(Paint.valueOf("#333")); icon.setPadding(new Insets(0, 5, 0, 0)); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java index 1317a8e51ba..166bb3a8010 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.core.dao.vote.VoteItem; import io.bisq.core.dao.vote.VotingDefaultValues; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import javafx.beans.property.DoubleProperty; import javafx.beans.value.ChangeListener; @@ -78,7 +79,7 @@ private ParameterViewItem(VoteItem voteItem, VBox vBox, DoubleProperty labelWidt hBox.setSpacing(5); vBox.getChildren().add(hBox); - label = new Label(voteItem.getName() + ":"); + label = new AutoTooltipLabel(voteItem.getName() + ":"); HBox.setMargin(label, new Insets(4, 0, 0, 0)); numberChangeListener = (observable, oldValue, newValue) -> { if ((double) newValue > 0) { diff --git a/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java b/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java index 5907fd9fd46..a79125872d8 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java @@ -23,6 +23,7 @@ import io.bisq.core.app.BisqEnvironment; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.wallet.dashboard.BsqDashboardView; @@ -159,7 +160,7 @@ class MenuItem extends ToggleButton { setPrefWidth(240); setAlignment(Pos.CENTER_LEFT); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); AwesomeDude.setIcon(icon, awesomeIcon); icon.setTextFill(Paint.valueOf("#333")); icon.setPadding(new Insets(0, 5, 0, 0)); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/wallet/dashboard/BsqDashboardView.java b/gui/src/main/java/io/bisq/gui/main/dao/wallet/dashboard/BsqDashboardView.java index 1f547f3f075..9bb9142b922 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/wallet/dashboard/BsqDashboardView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/wallet/dashboard/BsqDashboardView.java @@ -30,6 +30,7 @@ import io.bisq.core.user.Preferences; import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.dao.wallet.BsqBalanceUtil; import io.bisq.gui.util.BsqFormatter; @@ -91,7 +92,7 @@ public void initialize() { addLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisBlockHeight"), String.valueOf(bsqChainState.getGenesisBlockHeight()), Layout.FIRST_ROW_AND_GROUP_DISTANCE); - Label label = new Label(Res.get("dao.wallet.dashboard.genesisTxId")); + Label label = new AutoTooltipLabel(Res.get("dao.wallet.dashboard.genesisTxId")); GridPane.setRowIndex(label, ++gridRow); root.getChildren().add(label); hyperlinkWithIcon = new HyperlinkWithIcon(bsqChainState.getGenesisTxId(), AwesomeIcon.EXTERNAL_LINK); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/wallet/tx/BsqTxView.java b/gui/src/main/java/io/bisq/gui/main/dao/wallet/tx/BsqTxView.java index 12f8f600b03..cfb137e4a24 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/wallet/tx/BsqTxView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/wallet/tx/BsqTxView.java @@ -33,6 +33,7 @@ import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AddressWithIconAndDirection; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.dao.wallet.BsqBalanceUtil; import io.bisq.gui.util.BsqFormatter; @@ -332,7 +333,7 @@ public void updateItem(final BsqTxListItem item, boolean empty) { if (field != null) field.setOnAction(null); - label = new Label(item.isBurnedBsqTx() ? + label = new AutoTooltipLabel(item.isBurnedBsqTx() ? Res.get("dao.wallet.bsqFee") : Res.get("funds.tx.direction.self")); setGraphic(label); } else { diff --git a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java index 8916ee8c314..f256a336cc8 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java @@ -29,10 +29,7 @@ import io.bisq.core.user.Preferences; import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; -import io.bisq.gui.components.AddressTextField; -import io.bisq.gui.components.HyperlinkWithIcon; -import io.bisq.gui.components.InputTextField; -import io.bisq.gui.components.TitledGroupBg; +import io.bisq.gui.components.*; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.main.overlays.windows.QRCodeWindow; import io.bisq.gui.util.BSFormatter; @@ -122,7 +119,7 @@ public void initialize() { walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("funds.deposit.noAddresses"))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.deposit.noAddresses"))); tableViewSelectionListener = (observableValue, oldValue, newValue) -> { if (newValue != null) fillForm(newValue.getAddressString()); @@ -316,7 +313,7 @@ public TableCell call(TableColumn titleLabel.prefWidthProperty().bind(tableView.widthProperty())); diff --git a/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java b/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java index b7d516d37ea..5b88656e202 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.util.BSFormatter; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.ListChangeListener; @@ -65,7 +66,7 @@ public void initialize() { GridPane.setVgrow(tableView, Priority.ALWAYS); GridPane.setHgrow(tableView, Priority.ALWAYS); root.getChildren().add(tableView); - Label placeholder = new Label(Res.get("table.placeholder.noData")); + Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noData")); placeholder.setWrapText(true); tableView.setPlaceholder(placeholder); @@ -285,7 +286,7 @@ public TableCell call( public void updateItem(final SpreadItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { - // TODO maybe show exra colums with item.priceSpread and use real amount diff + // TODO maybe show exra colums with item.priceSpread and use real amount diff // not % based if (item.priceSpread != null) setText(item.percentage); diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java index bf4cf5be958..963ffa3ad45 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java @@ -27,6 +27,7 @@ import io.bisq.core.trade.statistics.TradeStatistics2; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.market.trades.charts.price.CandleStickChart; import io.bisq.gui.main.market.trades.charts.volume.VolumeChart; import io.bisq.gui.util.BSFormatter; @@ -117,7 +118,7 @@ public void initialize() { createCharts(); createTable(); - nrOfTradeStatisticsLabel = new Label(" "); // set empty string for layout + nrOfTradeStatisticsLabel = new AutoTooltipLabel(" "); // set empty string for layout nrOfTradeStatisticsLabel.setId("num-offers"); nrOfTradeStatisticsLabel.setPadding(new Insets(-5, 0, -10, 5)); root.getChildren().addAll(toolBox, priceChart, volumeChart, tableView, nrOfTradeStatisticsLabel); @@ -408,7 +409,7 @@ public Number fromString(String string) { /////////////////////////////////////////////////////////////////////////////////////////// private HBox getToolBox() { - Label currencyLabel = new Label(Res.getWithCol("shared.currency")); + Label currencyLabel = new AutoTooltipLabel(Res.getWithCol("shared.currency")); currencyLabel.setPadding(new Insets(0, 4, 0, 0)); currencyComboBox = new ComboBox<>(); @@ -420,7 +421,7 @@ private HBox getToolBox() { Pane spacer = new Pane(); HBox.setHgrow(spacer, Priority.ALWAYS); - Label label = new Label("Interval:"); + Label label = new AutoTooltipLabel("Interval:"); label.setPadding(new Insets(0, 4, 0, 0)); toggleGroup = new ToggleGroup(); @@ -644,7 +645,7 @@ public void updateItem(final TradeStatistics2 item, boolean empty) { tableView.getColumns().add(directionColumn); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - Label placeholder = new Label(Res.get("table.placeholder.noData")); + Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noData")); placeholder.setWrapText(true); tableView.setPlaceholder(placeholder); dateColumn.setSortType(TableColumn.SortType.DESCENDING); diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/charts/price/CandleTooltip.java b/gui/src/main/java/io/bisq/gui/main/market/trades/charts/price/CandleTooltip.java index c9f9e1dd7bd..0aa0d29b268 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/charts/price/CandleTooltip.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/charts/price/CandleTooltip.java @@ -32,6 +32,7 @@ package io.bisq.gui.main.market.trades.charts.price; import io.bisq.common.locale.Res; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.market.trades.charts.CandleData; import io.bisq.gui.util.Layout; import javafx.geometry.HPos; @@ -46,12 +47,12 @@ */ public class CandleTooltip extends GridPane { private final StringConverter priceStringConverter; - private final Label openValue = new Label(); - private final Label closeValue = new Label(); - private final Label highValue = new Label(); - private final Label lowValue = new Label(); - private final Label averageValue = new Label(); - private final Label dateValue = new Label(); + private final Label openValue = new AutoTooltipLabel(); + private final Label closeValue = new AutoTooltipLabel(); + private final Label highValue = new AutoTooltipLabel(); + private final Label lowValue = new AutoTooltipLabel(); + private final Label averageValue = new AutoTooltipLabel(); + private final Label dateValue = new AutoTooltipLabel(); CandleTooltip(StringConverter priceStringConverter) { this.priceStringConverter = priceStringConverter; @@ -60,12 +61,12 @@ public class CandleTooltip extends GridPane { setVgap(2); - Label open = new Label(Res.get("market.trades.tooltip.candle.open")); - Label close = new Label(Res.get("market.trades.tooltip.candle.close")); - Label high = new Label(Res.get("market.trades.tooltip.candle.high")); - Label low = new Label(Res.get("market.trades.tooltip.candle.low")); - Label average = new Label(Res.get("market.trades.tooltip.candle.average")); - Label date = new Label(Res.get("market.trades.tooltip.candle.date")); + Label open = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.open")); + Label close = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.close")); + Label high = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.high")); + Label low = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.low")); + Label average = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.average")); + Label date = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.date")); setConstraints(open, 0, 0); setConstraints(openValue, 1, 0); setConstraints(close, 0, 1); @@ -97,4 +98,4 @@ public void update(CandleData candleData) { averageValue.setText(priceStringConverter.toString(candleData.average)); dateValue.setText(candleData.date); } -} \ No newline at end of file +} diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java index 9a24ba7022d..ed00d4afce6 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java @@ -810,7 +810,7 @@ private void addAmountPriceGroup() { imageView = new ImageView(); imageView.setPickOnBounds(true); - directionLabel = new Label(); + directionLabel = new AutoTooltipLabel(); directionLabel.setAlignment(Pos.CENTER); directionLabel.setPadding(new Insets(-5, 0, 0, 0)); directionLabel.setId("direction-icon-label"); @@ -908,9 +908,9 @@ private void addFundingGroup() { GridPane.setColumnSpan(payFundsTitledGroupBg, 3); payFundsTitledGroupBg.setVisible(false); - totalToPayLabel = new Label(Res.get("shared.totalsNeeded")); + totalToPayLabel = new AutoTooltipLabel(Res.get("shared.totalsNeeded")); totalToPayLabel.setVisible(false); - totalToPayInfoIconLabel = new Label(); + totalToPayInfoIconLabel = new AutoTooltipLabel(); totalToPayInfoIconLabel.setVisible(false); HBox totalToPayBox = new HBox(); totalToPayBox.setSpacing(4); @@ -964,13 +964,13 @@ private void addFundingGroup() { fundFromSavingsWalletButton.setDefaultButton(true); fundFromSavingsWalletButton.setDefaultButton(false); fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet()); - Label label = new Label(Res.get("shared.OR")); + Label label = new AutoTooltipLabel(Res.get("shared.OR")); label.setPadding(new Insets(5, 0, 0, 0)); Button fundFromExternalWalletButton = new Button(Res.get("shared.fundFromExternalWalletButton")); fundFromExternalWalletButton.setDefaultButton(false); fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); waitingForFundsBusyAnimation = new BusyAnimation(); - waitingForFundsLabel = new Label(); + waitingForFundsLabel = new AutoTooltipLabel(); waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0)); fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel); @@ -1034,7 +1034,7 @@ private void addAmountPriceFields() { VBox amountBox = amountInputBoxTuple.second; // x - xLabel = new Label(); + xLabel = new AutoTooltipLabel(); xLabel.setFont(Font.font("Helvetica-Bold", 20)); xLabel.setPadding(new Insets(14, 3, 0, 3)); xLabel.setMinWidth(14); @@ -1075,7 +1075,7 @@ private void addAmountPriceFields() { toggleButtonsHBox.getChildren().addAll(fixedPriceButton, useMarketBasedPriceButton); // = - Label resultLabel = new Label("="); + Label resultLabel = new AutoTooltipLabel("="); resultLabel.setFont(Font.font("Helvetica-Bold", 20)); resultLabel.setPadding(new Insets(14, 2, 0, 2)); @@ -1173,7 +1173,7 @@ private void addSecondRow() { Tuple2 amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, Res.get("createOffer.amountPriceBox.minAmountDescription")); - Label xLabel = new Label("x"); + Label xLabel = new AutoTooltipLabel("x"); xLabel.setFont(Font.font("Helvetica-Bold", 20)); xLabel.setPadding(new Insets(14, 3, 0, 3)); xLabel.setVisible(false); // we just use it to get the same layout as the upper row @@ -1236,7 +1236,7 @@ private void createInfoPopover() { } private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) { - Label label = new Label(labelText); + Label label = new AutoTooltipLabel(labelText); TextField textField = new TextField(value); textField.setMinWidth(500); textField.setEditable(false); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java index 348fe04b662..0b6888be818 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java @@ -31,6 +31,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.components.PeerInfoIcon; import io.bisq.gui.main.MainView; @@ -170,7 +171,7 @@ public PaymentMethod fromString(String s) { tableView.getSortOrder().add(priceColumn); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - Label placeholder = new Label(Res.get("table.placeholder.noItems", Res.get("shared.offers"))); + Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.offers"))); placeholder.setWrapText(true); tableView.setPlaceholder(placeholder); @@ -193,7 +194,7 @@ public PaymentMethod fromString(String s) { paymentMethodColumn.setComparator((o1, o2) -> o1.getOffer().getPaymentMethod().compareTo(o2.getOffer().getPaymentMethod())); avatarColumn.setComparator((o1, o2) -> o1.getOffer().getOwnerNodeAddress().getFullAddress().compareTo(o2.getOffer().getOwnerNodeAddress().getFullAddress())); - nrOfOffersLabel = new Label(""); + nrOfOffersLabel = new AutoTooltipLabel(""); nrOfOffersLabel.setId("num-offers"); GridPane.setHalignment(nrOfOffersLabel, HPos.LEFT); GridPane.setVgrow(nrOfOffersLabel, Priority.NEVER); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java index 4b20c61ea95..eec2a448ca8 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java @@ -702,7 +702,7 @@ private void addAmountPriceGroup() { imageView = new ImageView(); imageView.setPickOnBounds(true); - directionLabel = new Label(); + directionLabel = new AutoTooltipLabel(); directionLabel.setAlignment(Pos.CENTER); directionLabel.setPadding(new Insets(-5, 0, 0, 0)); directionLabel.setId("direction-icon-label"); @@ -762,7 +762,7 @@ private void showFeeOption() { private void addOfferAvailabilityLabel() { offerAvailabilityBusyAnimation = new BusyAnimation(); - offerAvailabilityLabel = new Label(Res.get("takeOffer.fundsBox.isOfferAvailable")); + offerAvailabilityLabel = new AutoTooltipLabel(Res.get("takeOffer.fundsBox.isOfferAvailable")); HBox hBox = new HBox(); hBox.setSpacing(10); @@ -781,9 +781,9 @@ private void addFundingGroup() { GridPane.setColumnSpan(payFundsPane, 3); payFundsPane.setVisible(false); - totalToPayLabel = new Label(Res.get("shared.totalsNeeded")); + totalToPayLabel = new AutoTooltipLabel(Res.get("shared.totalsNeeded")); totalToPayLabel.setVisible(false); - totalToPayInfoIconLabel = new Label(); + totalToPayInfoIconLabel = new AutoTooltipLabel(); totalToPayInfoIconLabel.setVisible(false); HBox totalToPayBox = new HBox(); totalToPayBox.setSpacing(4); @@ -836,13 +836,13 @@ private void addFundingGroup() { fundFromSavingsWalletButton.setDefaultButton(true); fundFromSavingsWalletButton.setDefaultButton(false); fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet()); - Label label = new Label(Res.get("shared.OR")); + Label label = new AutoTooltipLabel(Res.get("shared.OR")); label.setPadding(new Insets(5, 0, 0, 0)); Button fundFromExternalWalletButton = new Button(Res.get("shared.fundFromExternalWalletButton")); fundFromExternalWalletButton.setDefaultButton(false); fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); waitingForFundsBusyAnimation = new BusyAnimation(false); - waitingForFundsLabel = new Label(); + waitingForFundsLabel = new AutoTooltipLabel(); waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0)); fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, @@ -908,7 +908,7 @@ private void addAmountPriceFields() { VBox amountBox = amountInputBoxTuple.second; // x - Label xLabel = new Label("x"); + Label xLabel = new AutoTooltipLabel("x"); xLabel.setFont(Font.font("Helvetica-Bold", 20)); xLabel.setPadding(new Insets(14, 3, 0, 3)); @@ -923,7 +923,7 @@ private void addAmountPriceFields() { VBox priceBox = priceInputBoxTuple.second; // = - Label resultLabel = new Label("="); + Label resultLabel = new AutoTooltipLabel("="); resultLabel.setFont(Font.font("Helvetica-Bold", 20)); resultLabel.setPadding(new Insets(14, 2, 0, 2)); @@ -969,7 +969,7 @@ private void addSecondRow() { Tuple2 amountInputBoxTuple = getTradeInputBox(amountValueCurrencyBox, Res.get("takeOffer.amountPriceBox.amountRangeDescription")); - Label xLabel = new Label("x"); + Label xLabel = new AutoTooltipLabel("x"); xLabel.setFont(Font.font("Helvetica-Bold", 20)); xLabel.setPadding(new Insets(14, 3, 0, 3)); xLabel.setVisible(false); // we just use it to get the same layout as the upper row @@ -992,7 +992,7 @@ private void addSecondRow() { /////////////////////////////////////////////////////////////////////////////////////////// private Tuple2 getTradeInputBox(HBox amountValueBox, String promptText) { - Label descriptionLabel = new Label(promptText); + Label descriptionLabel = new AutoTooltipLabel(promptText); descriptionLabel.setId("input-description-label"); descriptionLabel.setPrefWidth(190); @@ -1045,7 +1045,7 @@ private void createInfoPopover() { } private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) { - Label label = new Label(labelText); + Label label = new AutoTooltipLabel(labelText); TextField textField = new TextField(value); textField.setMinWidth(500); textField.setEditable(false); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/QRCodeWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/QRCodeWindow.java index bec5af0710f..dca54ccb937 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/QRCodeWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/QRCodeWindow.java @@ -1,6 +1,7 @@ package io.bisq.gui.main.overlays.windows; import io.bisq.common.locale.Res; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.overlays.Overlay; import javafx.geometry.HPos; import javafx.geometry.Insets; @@ -51,7 +52,7 @@ public void show() { gridPane.getChildren().add(qrCodeImageView); String request = bitcoinURI.replace("%20", " ").replace("?", "\n?").replace("&", "\n&"); - Label infoLabel = new Label(Res.get("qRCodeWindow.request", request)); + Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request)); infoLabel.setMouseTransparent(true); infoLabel.setWrapText(true); infoLabel.setId("popup-qr-code-info"); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java index 9de0ec66b35..739804a86c1 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java @@ -19,6 +19,7 @@ import io.bisq.common.app.DevEnv; import io.bisq.common.locale.Res; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -103,7 +104,7 @@ protected void setupKeyHandler(Scene scene) { } private void addInputFields() { - Label label = new Label(Res.get("shared.enterPrivKey")); + Label label = new AutoTooltipLabel(Res.get("shared.enterPrivKey")); label.setWrapText(true); GridPane.setMargin(label, new Insets(3, 0, 0, 0)); GridPane.setRowIndex(label, ++rowIndex); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java index 5ead6667245..c5cdcf54db0 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java @@ -23,6 +23,7 @@ import io.bisq.common.util.Tuple2; import io.bisq.core.btc.wallet.WalletsManager; import io.bisq.core.crypto.ScryptUtil; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.components.PasswordTextField; import io.bisq.gui.main.overlays.Overlay; @@ -160,7 +161,7 @@ protected void setupKeyHandler(Scene scene) { } private void addInputFields() { - Label label = new Label(Res.get("password.enterPassword")); + Label label = new AutoTooltipLabel(Res.get("password.enterPassword")); label.setWrapText(true); GridPane.setMargin(label, new Insets(3, 0, 0, 0)); GridPane.setRowIndex(label, ++rowIndex); @@ -177,7 +178,7 @@ private void addInputFields() { private void addButtons() { BusyAnimation busyAnimation = new BusyAnimation(false); - Label deriveStatusLabel = new Label(); + Label deriveStatusLabel = new AutoTooltipLabel(); unlockButton = new Button(Res.get("shared.unlock")); unlockButton.setDefaultButton(true); @@ -244,7 +245,7 @@ private void addButtons() { } private void showRestoreScreen() { - Label headLine2Label = new Label(Res.get("seed.restore.title")); + Label headLine2Label = new AutoTooltipLabel(Res.get("seed.restore.title")); headLine2Label.setId("popup-headline"); headLine2Label.setMouseTransparent(true); GridPane.setHalignment(headLine2Label, HPos.LEFT); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java index 0a41990e421..771ed9cd342 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.common.util.Utilities; import io.bisq.core.alert.Alert; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -108,7 +109,7 @@ private void addContent() { busyAnimation = new BusyAnimation(false); - Label statusLabel = new Label(); + Label statusLabel = new AutoTooltipLabel(); statusLabel.managedProperty().bind(statusLabel.visibleProperty()); HBox hBox = new HBox(); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java index 0d61521d645..20f5856650d 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java @@ -31,6 +31,7 @@ import io.bisq.core.btc.wallet.BtcWalletService; import io.bisq.core.user.DontShowAgainLookup; import io.bisq.core.util.CoinUtil; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.main.MainView; @@ -142,7 +143,7 @@ protected void addContent() { hBox.setSpacing(10); useSavingsWalletButton = new Button(Res.get("portfolio.pending.step5_buyer.moveToBisqWallet")); useSavingsWalletButton.setDefaultButton(false); - Label label = new Label(Res.get("shared.OR")); + Label label = new AutoTooltipLabel(Res.get("shared.OR")); label.setPadding(new Insets(5, 0, 0, 0)); withdrawToExternalWalletButton = new Button(Res.get("portfolio.pending.step5_buyer.withdrawExternal")); withdrawToExternalWalletButton.setDefaultButton(false); diff --git a/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java b/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java index f93c3542213..107eb00048b 100644 --- a/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java +++ b/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java @@ -30,6 +30,7 @@ import io.bisq.gui.common.model.Activatable; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.main.overlays.popups.Popup; @@ -155,7 +156,7 @@ public void initialize() { tableView.setMinHeight(180); tableView.setPrefHeight(180); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noData"))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData"))); tableView.getSortOrder().add(creationDateColumn); creationDateColumn.setSortType(TableColumn.SortType.ASCENDING); diff --git a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java index 09f82c8c2b3..2c990829c9c 100644 --- a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java +++ b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java @@ -31,6 +31,7 @@ import io.bisq.gui.common.model.Activatable; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.main.overlays.popups.Popup; @@ -267,7 +268,7 @@ public BaseCurrencyNetwork fromString(String string) { autoSelectArbitratorsCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.autoSelectArbitrators"), "").second; - // ignoreTraders + // ignoreTraders ignoreTradersListInputTextField = addLabelInputTextField(root, ++gridRow, Res.get("setting.preferences.ignorePeers")).second; ignoreTradersListListener = (observable, oldValue, newValue) -> @@ -303,14 +304,14 @@ public TradeCurrency fromString(String s) { fiatCurrenciesListView = fiatTuple.second; fiatCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2); fiatCurrenciesListView.setPrefHeight(3 * Layout.LIST_ROW_HEIGHT + 2); - Label placeholder = new Label(Res.get("setting.preferences.noFiat")); + Label placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noFiat")); placeholder.setWrapText(true); fiatCurrenciesListView.setPlaceholder(placeholder); fiatCurrenciesListView.setCellFactory(new Callback, ListCell>() { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); @@ -354,7 +355,7 @@ public void updateItem(final FiatCurrency item, boolean empty) { GridPane.setColumnIndex(cryptoCurrenciesListView, 3); cryptoCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2); cryptoCurrenciesListView.setPrefHeight(3 * Layout.LIST_ROW_HEIGHT + 2); - placeholder = new Label(Res.get("setting.preferences.noAltcoins")); + placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noAltcoins")); placeholder.setWrapText(true); cryptoCurrenciesListView.setPlaceholder(placeholder); cryptoCurrenciesListView.setCellFactory(new Callback, ListCell>() { @@ -449,12 +450,12 @@ private void initializeDisplayOptions() { private void activateGeneralOptions() { List baseCurrencyNetworks = Arrays.asList(BaseCurrencyNetwork.values()); - // We don't support DOGE anymore due lack of interest but leave it in the code in case it will get + // We don't support DOGE anymore due lack of interest but leave it in the code in case it will get // re-activated some day baseCurrencyNetworks = baseCurrencyNetworks.stream() .filter(e -> !e.isDoge()) .collect(Collectors.toList()); - + // show ony mainnet in production version if (!DevEnv.DEV_MODE) baseCurrencyNetworks = baseCurrencyNetworks.stream() From f400dac1e6d7ca75e49a658ed5843f7092ab61f1 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 12:39:47 +0100 Subject: [PATCH 2/8] Add automatic tooltips for toggle buttons (doesn't work in selected state atm) --- .../bisq/gui/components/AutoTooltipLabel.java | 19 ++------- .../components/AutoTooltipToggleButton.java | 40 +++++++++++++++++++ .../io/bisq/gui/components/TooltipUtil.java | 24 +++++++++++ .../main/java/io/bisq/gui/main/MainView.java | 3 +- .../account/settings/AccountSettingsView.java | 4 +- .../dao/compensation/CompensationView.java | 4 +- .../bisq/gui/main/dao/voting/VotingView.java | 4 +- .../gui/main/dao/wallet/BsqWalletView.java | 4 +- .../main/market/trades/TradesChartsView.java | 3 +- .../offer/createoffer/CreateOfferView.java | 4 +- 10 files changed, 82 insertions(+), 27 deletions(-) create mode 100644 gui/src/main/java/io/bisq/gui/components/AutoTooltipToggleButton.java create mode 100644 gui/src/main/java/io/bisq/gui/components/TooltipUtil.java diff --git a/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java b/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java index 24f5e607084..0ef27e02c27 100644 --- a/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java +++ b/gui/src/main/java/io/bisq/gui/components/AutoTooltipLabel.java @@ -2,11 +2,11 @@ import com.sun.javafx.scene.control.skin.LabelSkin; import javafx.scene.Node; -import javafx.scene.control.Label; -import javafx.scene.control.Skin; -import javafx.scene.control.Tooltip; +import javafx.scene.control.*; import javafx.scene.text.Text; +import static io.bisq.gui.components.TooltipUtil.showTooltipIfTruncated; + public class AutoTooltipLabel extends Label { public AutoTooltipLabel(){ @@ -23,26 +23,15 @@ protected Skin createDefaultSkin() { } private class AutoTooltipLabelSkin extends LabelSkin { - private final Label truncateToFitLabel; public AutoTooltipLabelSkin(Label label) { super(label); - this.truncateToFitLabel = label; } @Override protected void layoutChildren(double x, double y, double w, double h) { super.layoutChildren(x, y, w, h); - for (Node node : getChildren()) { - if (node instanceof Text) { - String displayedText = ((Text) node).getText(); - if (displayedText.equals(truncateToFitLabel.getText())) { - truncateToFitLabel.setTooltip(null); - } else { - truncateToFitLabel.setTooltip(new Tooltip(truncateToFitLabel.getText())); - } - } - } + showTooltipIfTruncated(this, getSkinnable()); } } } diff --git a/gui/src/main/java/io/bisq/gui/components/AutoTooltipToggleButton.java b/gui/src/main/java/io/bisq/gui/components/AutoTooltipToggleButton.java new file mode 100644 index 00000000000..73306d6a291 --- /dev/null +++ b/gui/src/main/java/io/bisq/gui/components/AutoTooltipToggleButton.java @@ -0,0 +1,40 @@ +package io.bisq.gui.components; + +import com.sun.javafx.scene.control.skin.ToggleButtonSkin; +import javafx.scene.Node; +import javafx.scene.control.Skin; +import javafx.scene.control.ToggleButton; + +import static io.bisq.gui.components.TooltipUtil.showTooltipIfTruncated; + +public class AutoTooltipToggleButton extends ToggleButton { + + public AutoTooltipToggleButton() { + super(); + } + + public AutoTooltipToggleButton(String text) { + super(text); + } + + public AutoTooltipToggleButton(String text, Node graphic) { + super(text, graphic); + } + + @Override + protected Skin createDefaultSkin() { + return new AutoTooltipToggleButtonSkin(this); + } + + private class AutoTooltipToggleButtonSkin extends ToggleButtonSkin { + public AutoTooltipToggleButtonSkin(ToggleButton toggleButton) { + super(toggleButton); + } + + @Override + protected void layoutChildren(double x, double y, double w, double h) { + super.layoutChildren(x, y, w, h); + showTooltipIfTruncated(this, getSkinnable()); + } + } +} diff --git a/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java b/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java new file mode 100644 index 00000000000..5d6dd2505c4 --- /dev/null +++ b/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java @@ -0,0 +1,24 @@ +package io.bisq.gui.components; + +import javafx.scene.control.Labeled; +import javafx.scene.control.SkinBase; +import javafx.scene.control.Tooltip; +import javafx.scene.text.Text; + +public class TooltipUtil { + + public static void showTooltipIfTruncated(SkinBase skinBase, Labeled labeled) { + for (Object node : skinBase.getChildren()) { + if (node instanceof Text) { + String displayedText = ((Text) node).getText(); + if (displayedText.equals(labeled.getText())) { + if (labeled.getTooltip() != null) { + labeled.setTooltip(null); + } + } else if (labeled.getText() != null){ + labeled.setTooltip(new Tooltip(labeled.getText()); + } + } + } + } +} diff --git a/gui/src/main/java/io/bisq/gui/main/MainView.java b/gui/src/main/java/io/bisq/gui/main/MainView.java index e14716e7ca0..de49bce6a05 100644 --- a/gui/src/main/java/io/bisq/gui/main/MainView.java +++ b/gui/src/main/java/io/bisq/gui/main/MainView.java @@ -29,6 +29,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.account.AccountView; import io.bisq.gui.main.dao.DaoView; @@ -679,7 +680,7 @@ private void setupDisputesIcon(Pane buttonHolder) { buttonHolder.getChildren().add(notification); } - private class NavButton extends ToggleButton { + private class NavButton extends AutoTooltipToggleButton { private final Class viewClass; diff --git a/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java b/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java index 77ad0280e68..e3d4d4c68d1 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java @@ -22,6 +22,7 @@ import io.bisq.common.locale.Res; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.MainView; import io.bisq.gui.main.account.AccountView; import io.bisq.gui.main.account.content.altcoinaccounts.AltCoinAccountsView; @@ -37,7 +38,6 @@ import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; -import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; @@ -145,7 +145,7 @@ public Class getSelectedViewClass() { } -class MenuItem extends ToggleButton { +class MenuItem extends AutoTooltipToggleButton { private final ChangeListener selectedPropertyChangeListener; private final ChangeListener disablePropertyChangeListener; diff --git a/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java b/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java index 62bd72a856e..f2b321415f7 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/compensation/CompensationView.java @@ -23,6 +23,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.compensation.active.ActiveCompensationRequestView; @@ -34,7 +35,6 @@ import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; -import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; @@ -126,7 +126,7 @@ public Class getSelectedViewClass() { } -class MenuItem extends ToggleButton { +class MenuItem extends AutoTooltipToggleButton { private final ChangeListener selectedPropertyChangeListener; private final ChangeListener disablePropertyChangeListener; diff --git a/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java b/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java index 3342aab98f4..aa0cefa0925 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/voting/VotingView.java @@ -23,6 +23,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.voting.dashboard.VotingDashboardView; @@ -34,7 +35,6 @@ import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; -import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; @@ -126,7 +126,7 @@ public Class getSelectedViewClass() { } -class MenuItem extends ToggleButton { +class MenuItem extends AutoTooltipToggleButton { private final ChangeListener selectedPropertyChangeListener; private final ChangeListener disablePropertyChangeListener; diff --git a/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java b/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java index a79125872d8..d732e45497f 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/wallet/BsqWalletView.java @@ -24,6 +24,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.DaoView; import io.bisq.gui.main.dao.wallet.dashboard.BsqDashboardView; @@ -36,7 +37,6 @@ import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Label; -import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; @@ -142,7 +142,7 @@ public Class getSelectedViewClass() { } -class MenuItem extends ToggleButton { +class MenuItem extends AutoTooltipToggleButton { private final ChangeListener selectedPropertyChangeListener; private final ChangeListener disablePropertyChangeListener; diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java index 963ffa3ad45..6833fa8d7ac 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java @@ -28,6 +28,7 @@ import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.market.trades.charts.price.CandleStickChart; import io.bisq.gui.main.market.trades.charts.volume.VolumeChart; import io.bisq.gui.util.BSFormatter; @@ -441,7 +442,7 @@ private HBox getToolBox() { } private ToggleButton getToggleButton(String label, TradesChartsViewModel.TickUnit tickUnit, ToggleGroup toggleGroup, String style) { - ToggleButton toggleButton = new ToggleButton(label); + ToggleButton toggleButton = new AutoTooltipToggleButton(label); toggleButton.setPadding(new Insets(0, 5, 0, 5)); toggleButton.setUserData(tickUnit); toggleButton.setToggleGroup(toggleGroup); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java index 47646331e31..e583a865838 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java @@ -1054,7 +1054,7 @@ private void addAmountPriceFields() { // Fixed/Percentage toggle ToggleGroup toggleGroup = new ToggleGroup(); - fixedPriceButton = new ToggleButton(Res.get("createOffer.fixed")); + fixedPriceButton = new AutoTooltipToggleButton(Res.get("createOffer.fixed")); editOfferElements.add(fixedPriceButton); fixedPriceButton.setId("toggle-price-left"); fixedPriceButton.setToggleGroup(toggleGroup); @@ -1062,7 +1062,7 @@ private void addAmountPriceFields() { updatePriceToggleButtons(newValue); }); - useMarketBasedPriceButton = new ToggleButton(Res.get("createOffer.percentage")); + useMarketBasedPriceButton = new AutoTooltipToggleButton(Res.get("createOffer.percentage")); editOfferElements.add(useMarketBasedPriceButton); useMarketBasedPriceButton.setId("toggle-price-right"); useMarketBasedPriceButton.setToggleGroup(toggleGroup); From 6dcad738a1710f624c3efabd120db21f97874bc3 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 12:40:45 +0100 Subject: [PATCH 3/8] Add missing bracket --- gui/src/main/java/io/bisq/gui/components/TooltipUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java b/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java index 5d6dd2505c4..ca6f6a63a4b 100644 --- a/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java +++ b/gui/src/main/java/io/bisq/gui/components/TooltipUtil.java @@ -16,7 +16,7 @@ public static void showTooltipIfTruncated(SkinBase skinBase, Labeled labeled) { labeled.setTooltip(null); } } else if (labeled.getText() != null){ - labeled.setTooltip(new Tooltip(labeled.getText()); + labeled.setTooltip(new Tooltip(labeled.getText())); } } } From a96d84eb244dcfc66d500d34235a8fc0f7a69f77 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 12:46:06 +0100 Subject: [PATCH 4/8] Convert labels to auto tooltip labels --- .../bisq/gui/components/AddressTextField.java | 4 ++-- .../gui/components/TableGroupHeadline.java | 2 +- .../io/bisq/gui/components/TitledGroupBg.java | 2 +- .../io/bisq/gui/components/TxIdTextField.java | 4 ++-- .../ArbitratorRegistrationView.java | 3 ++- .../account/settings/AccountSettingsView.java | 3 ++- .../disputes/trader/TraderDisputeView.java | 23 ++++++++----------- .../io/bisq/gui/main/overlays/Overlay.java | 5 ++-- .../closedtrades/ClosedTradesView.java | 3 ++- .../failedtrades/FailedTradesView.java | 8 +++++-- .../portfolio/openoffer/OpenOffersView.java | 3 ++- .../pendingtrades/PendingTradesView.java | 8 +++++-- .../pendingtrades/steps/TradeWizardItem.java | 7 +++--- .../settings/preferences/PreferencesView.java | 2 +- .../java/io/bisq/gui/util/FormBuilder.java | 18 +++++++-------- .../java/io/bisq/gui/AwesomeFontDemo.java | 3 ++- .../test/java/io/bisq/gui/BindingTest.java | 3 ++- 17 files changed, 57 insertions(+), 44 deletions(-) diff --git a/gui/src/main/java/io/bisq/gui/components/AddressTextField.java b/gui/src/main/java/io/bisq/gui/components/AddressTextField.java index ac83ee12b09..812852939d3 100644 --- a/gui/src/main/java/io/bisq/gui/components/AddressTextField.java +++ b/gui/src/main/java/io/bisq/gui/components/AddressTextField.java @@ -71,14 +71,14 @@ public AddressTextField() { //TODO app wide focus //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); - Label extWalletIcon = new Label(); + Label extWalletIcon = new AutoTooltipLabel(); extWalletIcon.setLayoutY(3); extWalletIcon.getStyleClass().addAll("icon", "highlight"); extWalletIcon.setTooltip(new Tooltip(tooltipText)); AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN); extWalletIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); - Label copyIcon = new Label(); + Label copyIcon = new AutoTooltipLabel(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard"))); diff --git a/gui/src/main/java/io/bisq/gui/components/TableGroupHeadline.java b/gui/src/main/java/io/bisq/gui/components/TableGroupHeadline.java index 10f3ce86564..aed27fccd94 100644 --- a/gui/src/main/java/io/bisq/gui/components/TableGroupHeadline.java +++ b/gui/src/main/java/io/bisq/gui/components/TableGroupHeadline.java @@ -51,7 +51,7 @@ public TableGroupHeadline(String title) { bg.prefWidthProperty().bind(widthProperty()); bg.prefHeightProperty().bind(heightProperty()); - label = new Label(); + label = new AutoTooltipLabel(); label.textProperty().bind(text); label.setLayoutX(8); label.setPadding(new Insets(-8, 7, 0, 5)); diff --git a/gui/src/main/java/io/bisq/gui/components/TitledGroupBg.java b/gui/src/main/java/io/bisq/gui/components/TitledGroupBg.java index d4ed7cfcc38..bb19b9c85e2 100644 --- a/gui/src/main/java/io/bisq/gui/components/TitledGroupBg.java +++ b/gui/src/main/java/io/bisq/gui/components/TitledGroupBg.java @@ -37,7 +37,7 @@ public TitledGroupBg() { GridPane.setMargin(this, new Insets(-10, -10, -10, -10)); GridPane.setColumnSpan(this, 2); - label = new Label(); + label = new AutoTooltipLabel(); label.textProperty().bind(text); label.setLayoutX(8); label.setLayoutY(-8); diff --git a/gui/src/main/java/io/bisq/gui/components/TxIdTextField.java b/gui/src/main/java/io/bisq/gui/components/TxIdTextField.java index 4adb2d64f89..dddc18f010e 100644 --- a/gui/src/main/java/io/bisq/gui/components/TxIdTextField.java +++ b/gui/src/main/java/io/bisq/gui/components/TxIdTextField.java @@ -73,7 +73,7 @@ public TxIdTextField() { progressIndicatorTooltip = new Tooltip("-"); txConfidenceIndicator.setTooltip(progressIndicatorTooltip); - copyIcon = new Label(); + copyIcon = new AutoTooltipLabel(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip"))); @@ -82,7 +82,7 @@ public TxIdTextField() { Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip")); - blockExplorerIcon = new Label(); + blockExplorerIcon = new AutoTooltipLabel(); blockExplorerIcon.getStyleClass().addAll("icon", "highlight"); blockExplorerIcon.setTooltip(tooltip); AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK); diff --git a/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java b/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java index 8fda7ec3d3b..53e14fcc70e 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java @@ -25,6 +25,7 @@ import io.bisq.core.arbitration.Arbitrator; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.main.overlays.windows.UnlockArbitrationRegistrationWindow; import io.bisq.gui.util.FormBuilder; @@ -141,7 +142,7 @@ private void buildUI() { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); diff --git a/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java b/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java index e3d4d4c68d1..884479a69cf 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/settings/AccountSettingsView.java @@ -22,6 +22,7 @@ import io.bisq.common.locale.Res; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.MainView; import io.bisq.gui.main.account.AccountView; @@ -163,7 +164,7 @@ class MenuItem extends AutoTooltipToggleButton { setPrefWidth(240); setAlignment(Pos.CENTER_LEFT); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); AwesomeDude.setIcon(icon, awesomeIcon); icon.setTextFill(Paint.valueOf("#333")); icon.setPadding(new Insets(0, 5, 0, 0)); diff --git a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java index 71cad3bd5bc..d09215867c0 100644 --- a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java +++ b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java @@ -38,10 +38,7 @@ import io.bisq.core.trade.TradeManager; import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; -import io.bisq.gui.components.BusyAnimation; -import io.bisq.gui.components.HyperlinkWithIcon; -import io.bisq.gui.components.InputTextField; -import io.bisq.gui.components.TableGroupHeadline; +import io.bisq.gui.components.*; import io.bisq.gui.main.disputes.arbitrator.ArbitratorDisputeView; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.main.overlays.windows.ContractWindow; @@ -165,7 +162,7 @@ public TraderDisputeView(DisputeManager disputeManager, @Override public void initialize() { - Label label = new Label(Res.get("support.filter")); + Label label = new AutoTooltipLabel(Res.get("support.filter")); HBox.setMargin(label, new Insets(5, 0, 0, 0)); filterTextField = new InputTextField(); filterTextField.setText("open"); @@ -185,7 +182,7 @@ public void initialize() { root.getChildren().addAll(filterBox, tableView); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - Label placeholder = new Label(Res.get("support.noTickets")); + Label placeholder = new AutoTooltipLabel(Res.get("support.noTickets")); placeholder.setWrapText(true); tableView.setPlaceholder(placeholder); tableView.getSelectionModel().clearSelection(); @@ -644,7 +641,7 @@ private void onSelectDispute(Dispute dispute) { Button uploadButton = new Button(Res.get("support.addAttachments")); uploadButton.setOnAction(e -> onRequestUpload()); - sendMsgInfoLabel = new Label(); + sendMsgInfoLabel = new AutoTooltipLabel(); sendMsgInfoLabel.setVisible(false); sendMsgInfoLabel.setManaged(false); sendMsgInfoLabel.setPadding(new Insets(5, 0, 0, 0)); @@ -689,12 +686,12 @@ public ListCell call(ListView sendMsgBusyAnimationListener; final Pane bg = new Pane(); final ImageView arrow = new ImageView(); - final Label headerLabel = new Label(); - final Label messageLabel = new Label(); - final Label copyIcon = new Label(); + final Label headerLabel = new AutoTooltipLabel(); + final Label messageLabel = new AutoTooltipLabel(); + final Label copyIcon = new AutoTooltipLabel(); final HBox attachmentsBox = new HBox(); final AnchorPane messageAnchorPane = new AnchorPane(); - final Label statusIcon = new Label(); + final Label statusIcon = new AutoTooltipLabel(); final double arrowWidth = 15d; final double attachmentsBoxHeight = 20d; final double border = 10d; @@ -825,7 +822,7 @@ else if (item.storedInMailboxProperty().get()) attachmentsBox.getChildren().clear(); if (item.getAttachments() != null && item.getAttachments().size() > 0) { AnchorPane.setBottomAnchor(messageLabel, bottomBorder + attachmentsBoxHeight + 10); - attachmentsBox.getChildren().add(new Label(Res.get("support.attachments") + " ") {{ + attachmentsBox.getChildren().add(new AutoTooltipLabel(Res.get("support.attachments") + " ") {{ setPadding(new Insets(0, 0, 3, 0)); if (isMyMsg) getStyleClass().add("my-message"); @@ -833,7 +830,7 @@ else if (item.storedInMailboxProperty().get()) getStyleClass().add("message"); }}); item.getAttachments().stream().forEach(attachment -> { - final Label icon = new Label(); + final Label icon = new AutoTooltipLabel(); setPadding(new Insets(0, 0, 3, 0)); if (isMyMsg) icon.getStyleClass().add("attachment-icon"); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java b/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java index f6ee766f55f..762f9337dd9 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java @@ -25,6 +25,7 @@ import io.bisq.core.app.BisqEnvironment; import io.bisq.core.user.DontShowAgainLookup; import io.bisq.gui.app.BisqApp; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.MainView; import io.bisq.gui.util.GUIUtil; @@ -687,7 +688,7 @@ protected void addHeadLine() { if (headLine != null) { ++rowIndex; - headLineLabel = new Label(headLine); + headLineLabel = new AutoTooltipLabel(headLine); headLineLabel.setMouseTransparent(true); if (headlineStyle != null) @@ -716,7 +717,7 @@ protected void addSeparator() { protected void addMessage() { if (message != null) { - messageLabel = new Label(truncatedMessage); + messageLabel = new AutoTooltipLabel(truncatedMessage); messageLabel.setMouseTransparent(true); messageLabel.setWrapText(true); GridPane.setHalignment(messageLabel, HPos.LEFT); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java index 1904c5d75d5..0b828959d9d 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java @@ -29,6 +29,7 @@ import io.bisq.core.user.Preferences; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.components.PeerInfoIcon; import io.bisq.gui.main.overlays.windows.OfferDetailsWindow; @@ -98,7 +99,7 @@ public void initialize() { avatarColumn.setText(""); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noItems", Res.get("shared.trades")))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.trades")))); setTradeIdColumnCellFactory(); setDirectionColumnCellFactory(); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java index 68712023b87..9aedd1617d2 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java @@ -20,12 +20,16 @@ import io.bisq.common.locale.Res; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.overlays.windows.TradeDetailsWindow; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.transformation.SortedList; import javafx.fxml.FXML; -import javafx.scene.control.*; +import javafx.scene.control.TableCell; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.Tooltip; import javafx.scene.layout.VBox; import javafx.util.Callback; @@ -60,7 +64,7 @@ public void initialize() { stateColumn.setText(Res.get("shared.state")); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noItems", Res.get("shared.trades")))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.trades")))); setTradeIdColumnCellFactory(); setDirectionColumnCellFactory(); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java index 98b63d3967a..a61fcb9d77c 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java @@ -25,6 +25,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.MainView; import io.bisq.gui.main.funds.FundsView; @@ -81,7 +82,7 @@ public void initialize() { setRemoveColumnCellFactory(); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noItems", Res.get("shared.openOffers")))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.openOffers")))); offerIdColumn.setComparator((o1, o2) -> o1.getOffer().getId().compareTo(o2.getOffer().getId())); directionColumn.setComparator((o1, o2) -> o1.getOffer().getDirection().compareTo(o2.getOffer().getDirection())); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java index 3f7ddf88c41..dea591c1419 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java @@ -26,6 +26,7 @@ import io.bisq.core.user.Preferences; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.components.PeerInfoIcon; import io.bisq.gui.main.overlays.popups.Popup; @@ -39,7 +40,10 @@ import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.Scene; -import javafx.scene.control.*; +import javafx.scene.control.TableCell; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.Tooltip; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.layout.Priority; @@ -107,7 +111,7 @@ public void initialize() { setAvatarColumnCellFactory(); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - tableView.setPlaceholder(new Label(Res.get("table.placeholder.noItems", Res.get("shared.openTrades")))); + tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.openTrades")))); tableView.setMinHeight(100); tradeIdColumn.setComparator((o1, o2) -> o1.getTrade().getId().compareTo(o2.getTrade().getId())); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/TradeWizardItem.java b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/TradeWizardItem.java index 248fa101b79..19b48c0f202 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/TradeWizardItem.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/TradeWizardItem.java @@ -19,6 +19,7 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.util.Colors; import javafx.geometry.Insets; import javafx.geometry.Pos; @@ -45,7 +46,7 @@ public TradeWizardItem(Class viewClass, String title) { public void setDisabled() { setId("trade-wizard-item-background-disabled"); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setTextFill(Colors.LIGHT_GREY); AwesomeDude.setIcon(icon, AwesomeIcon.SPINNER); @@ -54,7 +55,7 @@ public void setDisabled() { public void setActive() { setId("trade-wizard-item-background-active"); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setTextFill(Colors.BLUE); AwesomeDude.setIcon(icon, AwesomeIcon.ARROW_RIGHT); @@ -63,7 +64,7 @@ public void setActive() { public void setCompleted() { setId("trade-wizard-item-background-completed"); - Label icon = new Label(); + Label icon = new AutoTooltipLabel(); icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setTextFill(Colors.GREEN); AwesomeDude.setIcon(icon, AwesomeIcon.OK); diff --git a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java index 2c990829c9c..095d112657b 100644 --- a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java +++ b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java @@ -362,7 +362,7 @@ public void updateItem(final FiatCurrency item, boolean empty) { @Override public ListCell call(ListView list) { return new ListCell() { - final Label label = new Label(); + final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); final Button removeButton = new Button("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); diff --git a/gui/src/main/java/io/bisq/gui/util/FormBuilder.java b/gui/src/main/java/io/bisq/gui/util/FormBuilder.java index b65e1b490ac..724c94f9a3b 100644 --- a/gui/src/main/java/io/bisq/gui/util/FormBuilder.java +++ b/gui/src/main/java/io/bisq/gui/util/FormBuilder.java @@ -96,7 +96,7 @@ public static Label addLabel(GridPane gridPane, int rowIndex, String title) { } public static Label addLabel(GridPane gridPane, int rowIndex, String title, double top) { - Label label = new Label(title); + Label label = new AutoTooltipLabel(title); GridPane.setRowIndex(label, rowIndex); GridPane.setMargin(label, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(label); @@ -121,7 +121,7 @@ public static Label addMultilineLabel(GridPane gridPane, int rowIndex, double to } public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top) { - Label label = new Label(text); + Label label = new AutoTooltipLabel(text); label.setWrapText(true); GridPane.setHalignment(label, HPos.LEFT); GridPane.setRowIndex(label, rowIndex); @@ -396,7 +396,7 @@ public static Tuple4 addLabelInput Label label1 = addLabel(gridPane, rowIndex, title1, 0); InputTextField inputTextField1 = new InputTextField(); - Label label2 = new Label(title2); + Label label2 = new AutoTooltipLabel(title2); HBox.setMargin(label2, new Insets(5, 0, 0, 0)); InputTextField inputTextField2 = new InputTextField(); @@ -422,7 +422,7 @@ public static Tuple4 addLabelTextFieldLabelT textField1.setEditable(false); textField1.setMouseTransparent(true); textField1.setFocusTraversable(false); - Label label2 = new Label(title2); + Label label2 = new AutoTooltipLabel(title2); HBox.setMargin(label2, new Insets(5, 0, 0, 0)); TextField textField2 = new TextField(); textField2.setEditable(false); @@ -956,7 +956,7 @@ public static Tuple3 addButtonBusyAnimationLabel(G BusyAnimation busyAnimation = new BusyAnimation(false); - Label label = new Label(); + Label label = new AutoTooltipLabel(); hBox.setAlignment(Pos.CENTER_LEFT); hBox.getChildren().addAll(button, busyAnimation, label); @@ -980,7 +980,7 @@ public static Tuple3 getEditableValueCurrencyBox(St input.setId("text-input-with-currency-text-field"); input.setPromptText(promptText); - Label currency = new Label(Res.getBaseCurrencyCode()); + Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode()); currency.setId("currency-info-label"); HBox box = new HBox(); @@ -997,7 +997,7 @@ public static Tuple3 getNonEditableValueCurrencyBox() { textField.setEditable(false); textField.setFocusTraversable(false); - Label currency = new Label(Res.getBaseCurrencyCode()); + Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode()); currency.setId("currency-info-label-disabled"); HBox box = new HBox(); @@ -1012,7 +1012,7 @@ public static Tuple3 getAmountCurrencyBox(String pr input.setId("text-input-with-currency-text-field"); input.setPromptText(promptText); - Label currency = new Label(Res.getBaseCurrencyCode()); + Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode()); currency.setId("currency-info-label"); HBox box = new HBox(); @@ -1029,7 +1029,7 @@ public static Tuple2 getTradeInputBox(HBox amountValueBox) { } public static Tuple2 getTradeInputBox(HBox amountValueBox, String descriptionText) { - Label descriptionLabel = new Label(descriptionText); + Label descriptionLabel = new AutoTooltipLabel(descriptionText); descriptionLabel.setId("input-description-label"); descriptionLabel.setPrefWidth(170); diff --git a/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java b/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java index 492e1ca2029..caca0b4db53 100644 --- a/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java +++ b/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java @@ -19,6 +19,7 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import io.bisq.gui.components.AutoTooltipLabel; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; @@ -46,7 +47,7 @@ public void start(Stage primaryStage) { List values = new ArrayList<>(Arrays.asList(AwesomeIcon.values())); values.sort((o1, o2) -> o1.name().compareTo(o2.name())); for (AwesomeIcon icon : values) { - Label label = new Label(); + Label label = new AutoTooltipLabel(); Button button = new Button(icon.name(), label); AwesomeDude.setIcon(label, icon); root.getChildren().add(button); diff --git a/gui/src/test/java/io/bisq/gui/BindingTest.java b/gui/src/test/java/io/bisq/gui/BindingTest.java index 9bbbfd421ef..26f60f77d64 100644 --- a/gui/src/test/java/io/bisq/gui/BindingTest.java +++ b/gui/src/test/java/io/bisq/gui/BindingTest.java @@ -17,6 +17,7 @@ package io.bisq.gui; +import io.bisq.gui.components.AutoTooltipLabel; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -41,7 +42,7 @@ public void start(Stage primaryStage) { VBox root = new VBox(); root.setSpacing(20); - Label label = new Label(); + Label label = new AutoTooltipLabel(); StringProperty txt = new SimpleStringProperty(); txt.set("-"); label.textProperty().bind(txt); From 7f4184f104433fdbdfc30ad7b24a28a0ff14b741 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 13:01:47 +0100 Subject: [PATCH 5/8] Show tooltip on buttons if label is truncated --- .../gui/components/AutoTooltipButton.java | 40 +++++++++++++++++++ .../main/java/io/bisq/gui/main/MainView.java | 7 ++-- .../ArbitratorRegistrationView.java | 3 +- .../altcoinaccounts/AltCoinAccountsView.java | 3 +- .../ArbitratorSelectionView.java | 3 +- .../fiataccounts/FiatAccountsView.java | 3 +- .../dao/voting/vote/CompensationViewItem.java | 3 +- .../dao/voting/vote/ParameterViewItem.java | 5 ++- .../disputes/trader/TraderDisputeView.java | 10 ++--- .../gui/main/funds/deposit/DepositView.java | 2 +- .../funds/transactions/TransactionsView.java | 3 +- .../market/offerbook/OfferBookChartView.java | 3 +- .../offer/createoffer/CreateOfferView.java | 4 +- .../main/offer/offerbook/OfferBookView.java | 3 +- .../main/offer/takeoffer/TakeOfferView.java | 8 ++-- .../io/bisq/gui/main/overlays/Overlay.java | 9 +++-- .../overlays/notifications/Notification.java | 2 +- .../windows/DisplayAlertMessageWindow.java | 4 +- .../overlays/windows/EmptyWalletWindow.java | 5 ++- .../main/overlays/windows/FilterWindow.java | 7 ++-- .../windows/SendAlertMessageWindow.java | 7 ++-- .../SendPrivateNotificationWindow.java | 5 ++- .../windows/TorNetworkSettingsWindow.java | 7 ++-- .../UnlockArbitrationRegistrationWindow.java | 5 ++- .../windows/WalletPasswordWindow.java | 7 ++-- .../DisplayUpdateDownloadWindow.java | 7 ++-- .../portfolio/openoffer/OpenOffersView.java | 3 +- .../steps/buyer/BuyerStep4View.java | 5 ++- .../settings/preferences/PreferencesView.java | 5 ++- .../java/io/bisq/gui/util/FormBuilder.java | 24 +++++------ .../java/io/bisq/gui/AwesomeFontDemo.java | 3 +- .../test/java/io/bisq/gui/BindingTest.java | 3 +- 32 files changed, 136 insertions(+), 72 deletions(-) create mode 100644 gui/src/main/java/io/bisq/gui/components/AutoTooltipButton.java diff --git a/gui/src/main/java/io/bisq/gui/components/AutoTooltipButton.java b/gui/src/main/java/io/bisq/gui/components/AutoTooltipButton.java new file mode 100644 index 00000000000..4a8ba390a83 --- /dev/null +++ b/gui/src/main/java/io/bisq/gui/components/AutoTooltipButton.java @@ -0,0 +1,40 @@ +package io.bisq.gui.components; + +import com.sun.javafx.scene.control.skin.ButtonSkin; +import javafx.scene.Node; +import javafx.scene.control.Button; +import javafx.scene.control.Skin; + +import static io.bisq.gui.components.TooltipUtil.showTooltipIfTruncated; + +public class AutoTooltipButton extends Button { + + public AutoTooltipButton() { + super(); + } + + public AutoTooltipButton(String text) { + super(text); + } + + public AutoTooltipButton(String text, Node graphic) { + super(text, graphic); + } + + @Override + protected Skin createDefaultSkin() { + return new AutoTooltipButtonSkin(this); + } + + private class AutoTooltipButtonSkin extends ButtonSkin { + public AutoTooltipButtonSkin(Button button) { + super(button); + } + + @Override + protected void layoutChildren(double x, double y, double w, double h) { + super.layoutChildren(x, y, w, h); + showTooltipIfTruncated(this, getSkinnable()); + } + } +} diff --git a/gui/src/main/java/io/bisq/gui/main/MainView.java b/gui/src/main/java/io/bisq/gui/main/MainView.java index de49bce6a05..295ae44eb49 100644 --- a/gui/src/main/java/io/bisq/gui/main/MainView.java +++ b/gui/src/main/java/io/bisq/gui/main/MainView.java @@ -28,6 +28,7 @@ import io.bisq.core.exceptions.BisqException; import io.bisq.gui.Navigation; import io.bisq.gui.common.view.*; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.components.BusyAnimation; @@ -328,7 +329,7 @@ private Tuple2, VBox> getMarketPriceBox() { final ImageView btcAverageIcon = new ImageView(); btcAverageIcon.setId("btcaverage"); - final Button btcAverageIconButton = new Button("", btcAverageIcon); + final Button btcAverageIconButton = new AutoTooltipButton("", btcAverageIcon); btcAverageIconButton.setPadding(new Insets(-1, 0, -1, 0)); btcAverageIconButton.setFocusTraversable(false); btcAverageIconButton.getStyleClass().add("hidden-icon-button"); @@ -352,7 +353,7 @@ private Tuple2, VBox> getMarketPriceBox() { final ImageView poloniexIcon = new ImageView(); poloniexIcon.setId("poloniex"); - final Button poloniexIconButton = new Button("", poloniexIcon); + final Button poloniexIconButton = new AutoTooltipButton("", poloniexIcon); poloniexIconButton.setPadding(new Insets(-3, 0, -3, 0)); poloniexIconButton.setFocusTraversable(false); poloniexIconButton.getStyleClass().add("hidden-icon-button"); @@ -480,7 +481,7 @@ private VBox createSplashScreen() { model.p2pNetworkWarnMsg.addListener(splashP2PNetworkErrorMsgListener); - Button showTorNetworkSettingsButton = new Button(Res.get("settings.net.openTorSettingsButton")); + Button showTorNetworkSettingsButton = new AutoTooltipButton(Res.get("settings.net.openTorSettingsButton")); showTorNetworkSettingsButton.setVisible(false); showTorNetworkSettingsButton.setManaged(false); showTorNetworkSettingsButton.setOnAction(e -> { diff --git a/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java b/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java index 53e14fcc70e..6c73ee8a1e8 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/arbitratorregistration/ArbitratorRegistrationView.java @@ -25,6 +25,7 @@ import io.bisq.core.arbitration.Arbitrator; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.main.overlays.windows.UnlockArbitrationRegistrationWindow; @@ -144,7 +145,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 9d503845227..885429b3539 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -29,6 +29,7 @@ import io.bisq.core.payment.payload.PaymentMethod; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.components.paymentmethods.CryptoCurrencyForm; @@ -211,7 +212,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java index 8b0362b7e6e..2106897d864 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java @@ -23,6 +23,7 @@ import io.bisq.common.util.Tuple2; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TableGroupHeadline; import io.bisq.gui.main.overlays.popups.Popup; @@ -146,7 +147,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java b/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java index 11cbc7c1836..6751c68b41d 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/fiataccounts/FiatAccountsView.java @@ -26,6 +26,7 @@ import io.bisq.core.payment.payload.PaymentMethod; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.TitledGroupBg; import io.bisq.gui.components.paymentmethods.*; @@ -224,7 +225,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { diff --git a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/CompensationViewItem.java b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/CompensationViewItem.java index c7a52bb6af0..0a7450e0855 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/CompensationViewItem.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/CompensationViewItem.java @@ -22,6 +22,7 @@ import io.bisq.core.dao.compensation.CompensationRequest; import io.bisq.core.dao.compensation.CompensationRequestPayload; import io.bisq.core.dao.vote.CompensationRequestVoteItem; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.MainView; import io.bisq.gui.main.dao.compensation.CompensationRequestDisplay; @@ -171,7 +172,7 @@ private CompensationViewItem(CompensationRequestVoteItem compensationRequestVote }); declineCheckBox.setSelected(compensationRequestVoteItem.isDeclineVote()); - removeButton = new Button(Res.get("shared.remove")); + removeButton = new AutoTooltipButton(Res.get("shared.remove")); removeButton.setOnAction(event -> { vBox.getChildren().remove(hBox); cleanupInstance(); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java index 166bb3a8010..936eef776ce 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/voting/vote/ParameterViewItem.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.core.dao.vote.VoteItem; import io.bisq.core.dao.vote.VotingDefaultValues; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import javafx.beans.property.DoubleProperty; @@ -145,10 +146,10 @@ public Double fromString(String string) { }; slider.valueProperty().addListener(sliderListener); - resetButton = new Button(Res.get("shared.reset")); + resetButton = new AutoTooltipButton(Res.get("shared.reset")); resetButton.setOnAction(event -> inputTextField.setText(String.valueOf(originalValue))); - removeButton = new Button(Res.get("shared.remove")); + removeButton = new AutoTooltipButton(Res.get("shared.remove")); removeButton.setOnAction(event -> { vBox.getChildren().remove(hBox); cleanupInstance(); diff --git a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java index d09215867c0..52ae2faf8e4 100644 --- a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java +++ b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java @@ -622,7 +622,7 @@ private void onSelectDispute(Dispute dispute) { if (!(this instanceof ArbitratorDisputeView)) inputTextArea.setPromptText(Res.get("support.input.prompt")); - sendButton = new Button(Res.get("support.send")); + sendButton = new AutoTooltipButton(Res.get("support.send")); sendButton.setDefaultButton(true); sendButton.setOnAction(e -> { if (p2PService.isBootstrapped()) { @@ -638,7 +638,7 @@ private void onSelectDispute(Dispute dispute) { }); inputTextAreaTextSubscription = EasyBind.subscribe(inputTextArea.textProperty(), t -> sendButton.setDisable(t.isEmpty())); - Button uploadButton = new Button(Res.get("support.addAttachments")); + Button uploadButton = new AutoTooltipButton(Res.get("support.addAttachments")); uploadButton.setOnAction(e -> onRequestUpload()); sendMsgInfoLabel = new AutoTooltipLabel(); @@ -654,7 +654,7 @@ private void onSelectDispute(Dispute dispute) { buttonBox.getChildren().addAll(sendButton, uploadButton, sendMsgBusyAnimation, sendMsgInfoLabel); if (!isTrader) { - Button closeDisputeButton = new Button(Res.get("support.closeTicket")); + Button closeDisputeButton = new AutoTooltipButton(Res.get("support.closeTicket")); closeDisputeButton.setOnAction(e -> onCloseDispute(selectedDispute)); closeDisputeButton.setDefaultButton(true); Pane spacer = new Pane(); @@ -938,7 +938,7 @@ public void updateItem(final Dispute item, boolean empty) { if (item != null && !empty) { if (button == null) { - button = new Button(Res.get("shared.select")); + button = new AutoTooltipButton(Res.get("shared.select")); setGraphic(button); } button.setOnAction(e -> tableView.getSelectionModel().select(item)); @@ -978,7 +978,7 @@ public void updateItem(final Dispute item, boolean empty) { if (item != null && !empty) { if (button == null) { - button = new Button(Res.get("shared.details")); + button = new AutoTooltipButton(Res.get("shared.details")); setGraphic(button); } button.setOnAction(e -> onOpenContract(item)); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java index 111e33da449..707957cf4a5 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java @@ -341,7 +341,7 @@ public void updateItem(final DepositListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { if (button == null) { - button = new Button(Res.get("shared.select")); + button = new AutoTooltipButton(Res.get("shared.select")); setGraphic(button); } button.setOnAction(e -> tableView.getSelectionModel().select(item)); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java b/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java index 02e7234937d..d998917c6f5 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java @@ -37,6 +37,7 @@ import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AddressWithIconAndDirection; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.overlays.popups.Popup; @@ -540,7 +541,7 @@ public void updateItem(final TransactionsListItem item, boolean empty) { if (confidence != null) { if (confidence.getConfidenceType() == TransactionConfidence.ConfidenceType.PENDING) { if (button == null) { - button = new Button(Res.get("funds.tx.revert")); + button = new AutoTooltipButton(Res.get("funds.tx.revert")); setGraphic(button); } button.setOnAction(e -> revertTransaction(item.getTxId(), item.getTradable())); diff --git a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java index ff60ce7bf90..8749d9c17d9 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java @@ -26,6 +26,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.main.MainView; import io.bisq.gui.main.offer.BuyOfferView; @@ -458,7 +459,7 @@ public void updateItem(final OfferListItem offerListItem, boolean empty) { UserThread.execute(() -> titleLabel.prefWidthProperty().bind(tableView.widthProperty())); boolean isSellOffer = direction == OfferPayload.Direction.SELL; - Button button = new Button(); + Button button = new AutoTooltipButton(); ImageView iconView = new ImageView(); iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white"); button.setGraphic(iconView); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java index e583a865838..80f11c5dff0 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java @@ -960,13 +960,13 @@ private void addFundingGroup() { fundingHBox.setVisible(false); fundingHBox.setManaged(false); fundingHBox.setSpacing(10); - Button fundFromSavingsWalletButton = new Button(Res.get("shared.fundFromSavingsWalletButton")); + 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 Button(Res.get("shared.fundFromExternalWalletButton")); + Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton")); fundFromExternalWalletButton.setDefaultButton(false); fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); waitingForFundsBusyAnimation = new BusyAnimation(); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java index 0b6888be818..bf6c6344ac8 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookView.java @@ -31,6 +31,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.components.PeerInfoIcon; @@ -717,7 +718,7 @@ private TableColumn getActionColumn() { public TableCell call(TableColumn column) { return new TableCell() { final ImageView iconView = new ImageView(); - final Button button = new Button(); + final Button button = new AutoTooltipButton(); boolean isTradable, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit; diff --git a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java index a81cde2f8b6..39e95854598 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferView.java @@ -720,7 +720,7 @@ private void addAmountPriceGroup() { } private void addButtons() { - nextButton = new Button(Res.get("shared.nextStep")); + nextButton = new AutoTooltipButton(Res.get("shared.nextStep")); nextButton.setDefaultButton(true); nextButton.setOnAction(e -> { if (DevEnv.DAO_TRADING_ACTIVATED) @@ -729,7 +729,7 @@ private void addButtons() { onShowPayFundsScreen(); }); - cancelButton1 = new Button(Res.get("shared.cancel")); + cancelButton1 = new AutoTooltipButton(Res.get("shared.cancel")); cancelButton1.setDefaultButton(false); cancelButton1.setId("cancel-button"); cancelButton1.setOnAction(e -> { @@ -832,13 +832,13 @@ private void addFundingGroup() { fundingHBox.setVisible(false); fundingHBox.setManaged(false); fundingHBox.setSpacing(10); - Button fundFromSavingsWalletButton = new Button(Res.get("shared.fundFromSavingsWalletButton")); + 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 Button(Res.get("shared.fundFromExternalWalletButton")); + Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton")); fundFromExternalWalletButton.setDefaultButton(false); fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); waitingForFundsBusyAnimation = new BusyAnimation(false); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java b/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java index 762f9337dd9..8200c32db8f 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/Overlay.java @@ -25,6 +25,7 @@ import io.bisq.core.app.BisqEnvironment; import io.bisq.core.user.DontShowAgainLookup; import io.bisq.gui.app.BisqApp; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.MainView; @@ -733,7 +734,7 @@ protected void addMessage() { private void addReportErrorButtons() { messageLabel.setText(Res.get("popup.reportError", truncatedMessage)); - Button logButton = new Button(Res.get("popup.reportError.log")); + 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); @@ -750,7 +751,7 @@ private void addReportErrorButtons() { } }); - Button gitHubButton = new Button(Res.get("popup.reportError.gitHub")); + Button gitHubButton = new AutoTooltipButton(Res.get("popup.reportError.gitHub")); GridPane.setHalignment(gitHubButton, HPos.RIGHT); GridPane.setRowIndex(gitHubButton, ++rowIndex); GridPane.setColumnIndex(gitHubButton, 1); @@ -786,11 +787,11 @@ protected void addDontShowAgainCheckBox() { protected void addCloseButton() { if (!hideCloseButton) { - closeButton = new Button(closeButtonText == null ? Res.get("shared.close") : closeButtonText); + closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText); closeButton.setOnAction(event -> doClose()); } if (actionHandlerOptional.isPresent() || actionButtonText != null) { - actionButton = new Button(actionButtonText == null ? Res.get("shared.ok") : actionButtonText); + actionButton = new AutoTooltipButton(actionButtonText == null ? Res.get("shared.ok") : actionButtonText); actionButton.setDefaultButton(true); //TODO app wide focus //actionButton.requestFocus(); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/notifications/Notification.java b/gui/src/main/java/io/bisq/gui/main/overlays/notifications/Notification.java index a57bbd13687..ed33b7d4275 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/notifications/Notification.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/notifications/Notification.java @@ -199,7 +199,7 @@ protected void removeEffectFromBackground() { /* @Override protected void addCloseButton() { - closeButton = new Button(Res.get("shared.close")); + closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(event -> { hide(); closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run()); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/DisplayAlertMessageWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/DisplayAlertMessageWindow.java index 68e1859593e..956b6901be6 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/DisplayAlertMessageWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/DisplayAlertMessageWindow.java @@ -19,11 +19,11 @@ import io.bisq.common.locale.Res; import io.bisq.core.alert.Alert; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.util.FormBuilder; import javafx.geometry.Insets; -import javafx.scene.control.Button; import javafx.scene.layout.GridPane; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,7 +78,7 @@ private void addContent() { headLine = Res.get("displayAlertMessageWindow.headline"); headLineLabel.getStyleClass().addAll("headline-label", "error-text"); } - closeButton = new Button(Res.get("shared.close")); + closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(e -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/EmptyWalletWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/EmptyWalletWindow.java index 9dd8fddbca3..3f6621e165e 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/EmptyWalletWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/EmptyWalletWindow.java @@ -23,6 +23,7 @@ import io.bisq.core.btc.Restrictions; import io.bisq.core.btc.wallet.WalletService; import io.bisq.core.offer.OpenOfferManager; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -113,7 +114,7 @@ private void addContent() { Tuple2 tuple = addLabelInputTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.address")); addressInputTextField = tuple.second; - emptyWalletButton = new Button(Res.get("emptyWalletWindow.button")); + emptyWalletButton = new AutoTooltipButton(Res.get("emptyWalletWindow.button")); boolean isBalanceSufficient = Restrictions.isAboveDust(totalBalance); emptyWalletButton.setDefaultButton(isBalanceSufficient); emptyWalletButton.setDisable(!isBalanceSufficient && addressInputTextField.getText().length() > 0); @@ -130,7 +131,7 @@ private void addContent() { } }); - closeButton = new Button(Res.get("shared.cancel")); + closeButton = new AutoTooltipButton(Res.get("shared.cancel")); closeButton.setOnAction(e -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/FilterWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/FilterWindow.java index 85c4247c22d..be428f123d5 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/FilterWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/FilterWindow.java @@ -22,6 +22,7 @@ import io.bisq.core.filter.Filter; import io.bisq.core.filter.FilterManager; import io.bisq.core.filter.PaymentAccountFilter; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -170,7 +171,7 @@ private void addContent() { preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork()); } - Button sendButton = new Button(Res.get("filterWindow.add")); + Button sendButton = new AutoTooltipButton(Res.get("filterWindow.add")); sendButton.setOnAction(e -> { List offerIds = new ArrayList<>(); List nodes = new ArrayList<>(); @@ -260,7 +261,7 @@ private void addContent() { new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show(); }); - Button removeFilterMessageButton = new Button(Res.get("filterWindow.remove")); + Button removeFilterMessageButton = new AutoTooltipButton(Res.get("filterWindow.remove")); removeFilterMessageButton.setOnAction(e -> { if (keyInputTextField.getText().length() > 0) { if (removeFilterMessageHandler.handle(keyInputTextField.getText())) @@ -270,7 +271,7 @@ private void addContent() { } }); - closeButton = new Button(Res.get("shared.close")); + closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(e -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendAlertMessageWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendAlertMessageWindow.java index 15f65c6818c..e6dae54253e 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendAlertMessageWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendAlertMessageWindow.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.common.util.Tuple2; import io.bisq.core.alert.Alert; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -121,7 +122,7 @@ private void addContent() { Res.get("sendAlertMessageWindow.version")).second; versionInputTextField.disableProperty().bind(isUpdateCheckBox.selectedProperty().not()); - Button sendButton = new Button(Res.get("sendAlertMessageWindow.send")); + Button sendButton = new AutoTooltipButton(Res.get("sendAlertMessageWindow.send")); sendButton.setOnAction(e -> { final String version = versionInputTextField.getText(); boolean versionOK = false; @@ -148,7 +149,7 @@ private void addContent() { } }); - Button removeAlertMessageButton = new Button(Res.get("sendAlertMessageWindow.remove")); + Button removeAlertMessageButton = new AutoTooltipButton(Res.get("sendAlertMessageWindow.remove")); removeAlertMessageButton.setOnAction(e -> { if (keyInputTextField.getText().length() > 0) { if (removeAlertMessageHandler.handle(keyInputTextField.getText())) @@ -158,7 +159,7 @@ private void addContent() { } }); - closeButton = new Button(Res.get("shared.close")); + closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(e -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendPrivateNotificationWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendPrivateNotificationWindow.java index 452f6e41282..66ab50c7ab4 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendPrivateNotificationWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/SendPrivateNotificationWindow.java @@ -22,6 +22,7 @@ import io.bisq.common.locale.Res; import io.bisq.common.util.Tuple2; import io.bisq.core.alert.PrivateNotificationPayload; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; import io.bisq.gui.main.overlays.popups.Popup; @@ -119,7 +120,7 @@ private void addContent() { Label first = labelTextAreaTuple2.first; first.setMinWidth(200); - Button sendButton = new Button(Res.get("sendPrivateNotificationWindow.send")); + Button sendButton = new AutoTooltipButton(Res.get("sendPrivateNotificationWindow.send")); sendButton.setOnAction(e -> { if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) { if (!sendPrivateNotificationHandler.handle( @@ -153,7 +154,7 @@ public void onFault(String errorMessage) { } }); - closeButton = new Button(Res.get("shared.close")); + closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(e -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/TorNetworkSettingsWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/TorNetworkSettingsWindow.java index 5b3b4e4da96..5d68191d3de 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/TorNetworkSettingsWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/TorNetworkSettingsWindow.java @@ -40,6 +40,7 @@ import io.bisq.common.util.Tuple2; import io.bisq.common.util.Utilities; import io.bisq.core.user.Preferences; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.main.overlays.Overlay; import io.bisq.network.p2p.network.DefaultPluggableTransports; import javafx.collections.FXCollections; @@ -115,17 +116,17 @@ public void show() { } protected void addCloseButton() { - closeButton = new Button(closeButtonText == null ? Res.get("shared.close") : closeButtonText); + closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText); closeButton.setOnAction(event -> doClose()); if (actionHandlerOptional.isPresent()) { - actionButton = new Button(Res.get("shared.shutDown")); + actionButton = new AutoTooltipButton(Res.get("shared.shutDown")); actionButton.setDefaultButton(true); //TODO app wide focus //actionButton.requestFocus(); actionButton.setOnAction(event -> saveAndShutDown()); - Button urlButton = new Button(Res.get("torNetworkSettingWindow.openTorWebPage")); + Button urlButton = new AutoTooltipButton(Res.get("torNetworkSettingWindow.openTorWebPage")); urlButton.setOnAction(event -> { try { Utilities.openURI(URI.create("https://bridges.torproject.org/bridges")); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java index 739804a86c1..419a39d2de8 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/UnlockArbitrationRegistrationWindow.java @@ -19,6 +19,7 @@ import io.bisq.common.app.DevEnv; import io.bisq.common.locale.Res; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.main.overlays.Overlay; @@ -121,7 +122,7 @@ private void addInputFields() { } private void addButtons() { - unlockButton = new Button(Res.get("shared.unlock")); + unlockButton = new AutoTooltipButton(Res.get("shared.unlock")); unlockButton.setDefaultButton(true); unlockButton.setDisable(keyInputTextField.getText().length() == 0); unlockButton.setOnAction(e -> { @@ -131,7 +132,7 @@ private void addButtons() { new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show(); }); - Button closeButton = new Button(Res.get("shared.close")); + Button closeButton = new AutoTooltipButton(Res.get("shared.close")); closeButton.setOnAction(event -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java index bb83438cd21..c330f7d1c35 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/WalletPasswordWindow.java @@ -23,6 +23,7 @@ import io.bisq.common.util.Tuple2; import io.bisq.core.btc.wallet.WalletsManager; import io.bisq.core.crypto.ScryptUtil; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.components.PasswordTextField; @@ -180,7 +181,7 @@ private void addButtons() { BusyAnimation busyAnimation = new BusyAnimation(false); Label deriveStatusLabel = new AutoTooltipLabel(); - unlockButton = new Button(Res.get("shared.unlock")); + unlockButton = new AutoTooltipButton(Res.get("shared.unlock")); unlockButton.setDefaultButton(true); unlockButton.setDisable(true); unlockButton.setOnAction(e -> { @@ -210,14 +211,14 @@ private void addButtons() { } }); - forgotPasswordButton = new Button(Res.get("password.forgotPassword")); + forgotPasswordButton = new AutoTooltipButton(Res.get("password.forgotPassword")); forgotPasswordButton.setOnAction(e -> { forgotPasswordButton.setDisable(true); unlockButton.setDefaultButton(false); showRestoreScreen(); }); - Button cancelButton = new Button(Res.get("shared.cancel")); + Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel")); cancelButton.setOnAction(event -> { hide(); closeHandlerOptional.ifPresent(Runnable::run); diff --git a/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java b/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java index 65ec3c64742..adc21c0daf9 100644 --- a/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java +++ b/gui/src/main/java/io/bisq/gui/main/overlays/windows/downloadupdate/DisplayUpdateDownloadWindow.java @@ -21,6 +21,7 @@ import io.bisq.common.locale.Res; import io.bisq.common.util.Utilities; import io.bisq.core.alert.Alert; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.BusyAnimation; import io.bisq.gui.main.overlays.Overlay; @@ -104,7 +105,7 @@ private void addContent() { gridPane.getChildren().add(separator); - Button downloadButton = new Button(Res.get("displayUpdateDownloadWindow.button.label")); + Button downloadButton = new AutoTooltipButton(Res.get("displayUpdateDownloadWindow.button.label")); downloadButton.setDefaultButton(true); busyAnimation = new BusyAnimation(false); @@ -265,9 +266,9 @@ private void addContent() { @Override protected void addCloseButton() { - closeButton = new Button(Res.get("displayUpdateDownloadWindow.button.ignoreDownload")); + closeButton = new AutoTooltipButton(Res.get("displayUpdateDownloadWindow.button.ignoreDownload")); closeButton.setOnAction(event -> doClose()); - actionButton = new Button(Res.get("displayUpdateDownloadWindow.button.downloadLater")); + actionButton = new AutoTooltipButton(Res.get("displayUpdateDownloadWindow.button.downloadLater")); actionButton.setDefaultButton(false); actionButton.setOnAction(event -> { cleanup(); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java index a61fcb9d77c..7d5daaa95e2 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java @@ -25,6 +25,7 @@ import io.bisq.gui.Navigation; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.HyperlinkWithIcon; import io.bisq.gui.main.MainView; @@ -320,7 +321,7 @@ public void updateItem(final OpenOfferListItem item, boolean empty) { if (item != null && !empty) { if (button == null) { iconView.setId("image-remove"); - button = new Button(Res.get("shared.remove")); + button = new AutoTooltipButton(Res.get("shared.remove")); button.setMinWidth(70); button.setGraphic(iconView); setGraphic(button); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java index 20f5856650d..8330891b098 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java @@ -31,6 +31,7 @@ import io.bisq.core.btc.wallet.BtcWalletService; import io.bisq.core.user.DontShowAgainLookup; import io.bisq.core.util.CoinUtil; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TitledGroupBg; @@ -141,11 +142,11 @@ protected void addContent() { HBox hBox = new HBox(); hBox.setSpacing(10); - useSavingsWalletButton = new Button(Res.get("portfolio.pending.step5_buyer.moveToBisqWallet")); + useSavingsWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.moveToBisqWallet")); useSavingsWalletButton.setDefaultButton(false); Label label = new AutoTooltipLabel(Res.get("shared.OR")); label.setPadding(new Insets(5, 0, 0, 0)); - withdrawToExternalWalletButton = new Button(Res.get("portfolio.pending.step5_buyer.withdrawExternal")); + withdrawToExternalWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.withdrawExternal")); withdrawToExternalWalletButton.setDefaultButton(false); hBox.getChildren().addAll(useSavingsWalletButton, label, withdrawToExternalWalletButton); GridPane.setRowIndex(hBox, ++gridRow); diff --git a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java index 095d112657b..f0101c4003e 100644 --- a/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java +++ b/gui/src/main/java/io/bisq/gui/main/settings/preferences/PreferencesView.java @@ -31,6 +31,7 @@ import io.bisq.gui.common.model.Activatable; import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TitledGroupBg; @@ -313,7 +314,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { @@ -364,7 +365,7 @@ public ListCell call(ListView list) { return new ListCell() { final Label label = new AutoTooltipLabel(); final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON); - final Button removeButton = new Button("", icon); + final Button removeButton = new AutoTooltipButton("", icon); final AnchorPane pane = new AnchorPane(label, removeButton); { diff --git a/gui/src/main/java/io/bisq/gui/util/FormBuilder.java b/gui/src/main/java/io/bisq/gui/util/FormBuilder.java index 724c94f9a3b..c83d592b613 100644 --- a/gui/src/main/java/io/bisq/gui/util/FormBuilder.java +++ b/gui/src/main/java/io/bisq/gui/util/FormBuilder.java @@ -342,7 +342,7 @@ public static Tuple3 addLabelInputTextFieldButton Label label = addLabel(gridPane, rowIndex, title, 0); InputTextField inputTextField = new InputTextField(); - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); HBox hBox = new HBox(); @@ -372,7 +372,7 @@ public static Tuple3 addLabelTextFieldButton(GridPane textField.setEditable(false); textField.setMouseTransparent(true); textField.setFocusTraversable(false); - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); HBox hBox = new HBox(); @@ -449,7 +449,7 @@ public static Tuple2 addButtonCheckBox(GridPane gridPane, int } public static Tuple2 addButtonCheckBox(GridPane gridPane, int rowIndex, String buttonTitle, String checkBoxTitle, double top) { - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); CheckBox checkBox = new CheckBox(checkBoxTitle); HBox.setMargin(checkBox, new Insets(6, 0, 0, 0)); @@ -660,7 +660,7 @@ public static Tuple3 addLabelComboBoxButton(GridPane gr HBox hBox = new HBox(); hBox.setSpacing(10); - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); ComboBox comboBox = new ComboBox(); @@ -825,7 +825,7 @@ public static Tuple2 addLabelButton(GridPane gridPane, int rowInd public static Tuple2 addLabelButton(GridPane gridPane, int rowIndex, String labelText, String buttonTitle, double top) { Label label = addLabel(gridPane, rowIndex, labelText, top); - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); GridPane.setRowIndex(button, rowIndex); GridPane.setColumnIndex(button, 1); @@ -847,7 +847,7 @@ public static Button addButtonAfterGroup(GridPane gridPane, int rowIndex, String } public static Button addButton(GridPane gridPane, int rowIndex, String title, double top) { - Button button = new Button(title); + Button button = new AutoTooltipButton(title); button.setDefaultButton(true); GridPane.setRowIndex(button, rowIndex); GridPane.setColumnIndex(button, 1); @@ -882,9 +882,9 @@ public static Tuple2 add2Buttons(GridPane gridPane, double top) { HBox hBox = new HBox(); hBox.setSpacing(10); - Button button1 = new Button(title1); + Button button1 = new AutoTooltipButton(title1); button1.setDefaultButton(true); - Button button2 = new Button(title2); + Button button2 = new AutoTooltipButton(title2); hBox.getChildren().addAll(button1, button2); GridPane.setRowIndex(hBox, rowIndex); GridPane.setColumnIndex(hBox, 1); @@ -921,10 +921,10 @@ public static Tuple3 add3Buttons(GridPane gridPane, double top) { HBox hBox = new HBox(); hBox.setSpacing(10); - Button button1 = new Button(title1); + Button button1 = new AutoTooltipButton(title1); button1.setDefaultButton(true); - Button button2 = new Button(title2); - Button button3 = new Button(title3); + Button button2 = new AutoTooltipButton(title2); + Button button3 = new AutoTooltipButton(title3); hBox.getChildren().addAll(button1, button2, button3); GridPane.setRowIndex(hBox, rowIndex); GridPane.setColumnIndex(hBox, 1); @@ -951,7 +951,7 @@ public static Tuple3 addButtonBusyAnimationLabel(G HBox hBox = new HBox(); hBox.setSpacing(10); - Button button = new Button(buttonTitle); + Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); BusyAnimation busyAnimation = new BusyAnimation(false); diff --git a/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java b/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java index caca0b4db53..3f25a0af779 100644 --- a/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java +++ b/gui/src/test/java/io/bisq/gui/AwesomeFontDemo.java @@ -19,6 +19,7 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import javafx.application.Application; import javafx.scene.Scene; @@ -48,7 +49,7 @@ public void start(Stage primaryStage) { values.sort((o1, o2) -> o1.name().compareTo(o2.name())); for (AwesomeIcon icon : values) { Label label = new AutoTooltipLabel(); - Button button = new Button(icon.name(), label); + Button button = new AutoTooltipButton(icon.name(), label); AwesomeDude.setIcon(label, icon); root.getChildren().add(button); } diff --git a/gui/src/test/java/io/bisq/gui/BindingTest.java b/gui/src/test/java/io/bisq/gui/BindingTest.java index 26f60f77d64..f1a9d509100 100644 --- a/gui/src/test/java/io/bisq/gui/BindingTest.java +++ b/gui/src/test/java/io/bisq/gui/BindingTest.java @@ -17,6 +17,7 @@ package io.bisq.gui; +import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; @@ -47,7 +48,7 @@ public void start(Stage primaryStage) { txt.set("-"); label.textProperty().bind(txt); - Button button = new Button("count up"); + Button button = new AutoTooltipButton("count up"); button.setOnAction(e -> txt.set("counter " + counter++)); root.getChildren().addAll(label, button); From 68328a8c194fa7fc8f4a67bb907f2ebdc7d48ea8 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 13:02:13 +0100 Subject: [PATCH 6/8] Remove default state that has no effect --- .../java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java index 80f11c5dff0..18d96c08d86 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferView.java @@ -961,7 +961,6 @@ private void addFundingGroup() { 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")); From 3514edb84c5478b894bed6a73024ae6d0b9181a8 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 14:31:14 +0100 Subject: [PATCH 7/8] Add tooltip for column header if text is truncated --- .../components/AutoTooltipTableColumn.java | 12 ++++++++ .../ArbitratorSelectionView.java | 9 +++--- .../active/ActiveCompensationRequestView.java | 7 +++-- .../gui/main/dao/wallet/tx/BsqTxView.java | 14 ++++++---- .../disputes/trader/TraderDisputeView.java | 28 +++++++++---------- .../gui/main/funds/deposit/DepositView.java | 10 +++---- .../gui/main/funds/locked/LockedView.java | 8 +++--- .../gui/main/funds/reserved/ReservedView.java | 8 +++--- .../funds/transactions/TransactionsView.java | 14 +++++----- .../main/funds/withdrawal/WithdrawalView.java | 6 ++-- .../market/offerbook/OfferBookChartView.java | 5 ++-- .../gui/main/market/spread/SpreadView.java | 15 +++++----- .../main/market/trades/TradesChartsView.java | 15 +++++----- .../main/offer/offerbook/OfferBookView.java | 28 ++++++++----------- .../closedtrades/ClosedTradesView.java | 16 +++++------ .../failedtrades/FailedTradesView.java | 16 +++++------ .../portfolio/openoffer/OpenOffersView.java | 16 +++++------ .../pendingtrades/PendingTradesView.java | 16 +++++------ .../settings/network/NetworkSettingsView.java | 14 +++++----- 19 files changed, 134 insertions(+), 123 deletions(-) create mode 100644 gui/src/main/java/io/bisq/gui/components/AutoTooltipTableColumn.java diff --git a/gui/src/main/java/io/bisq/gui/components/AutoTooltipTableColumn.java b/gui/src/main/java/io/bisq/gui/components/AutoTooltipTableColumn.java new file mode 100644 index 00000000000..a0e1010b7a7 --- /dev/null +++ b/gui/src/main/java/io/bisq/gui/components/AutoTooltipTableColumn.java @@ -0,0 +1,12 @@ +package io.bisq.gui.components; + +import javafx.scene.control.TableColumn; + +public class AutoTooltipTableColumn extends TableColumn { + + public AutoTooltipTableColumn(String text) { + super(); + + setGraphic(new AutoTooltipLabel(text)); + } +} diff --git a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java index 2106897d864..faff968411b 100644 --- a/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java +++ b/gui/src/main/java/io/bisq/gui/main/account/content/arbitratorselection/ArbitratorSelectionView.java @@ -25,6 +25,7 @@ import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipTableColumn; import io.bisq.gui.components.TableGroupHeadline; import io.bisq.gui.main.overlays.popups.Popup; import io.bisq.gui.util.ImageUtil; @@ -209,23 +210,23 @@ private void addArbitratorsGroup() { autoSelectAllMatchingCheckBox.setOnAction(event -> model.setAutoSelectArbitrators(autoSelectAllMatchingCheckBox.isSelected())); - TableColumn dateColumn = new TableColumn<>(Res.get("account.arbitratorSelection.regDate")); + TableColumn dateColumn = new AutoTooltipTableColumn<>(Res.get("account.arbitratorSelection.regDate")); dateColumn.setSortable(false); dateColumn.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().getRegistrationDate())); dateColumn.setMinWidth(140); dateColumn.setMaxWidth(140); - TableColumn nameColumn = new TableColumn<>(Res.get("shared.onionAddress")); + TableColumn nameColumn = new AutoTooltipTableColumn<>(Res.get("shared.onionAddress")); nameColumn.setSortable(false); nameColumn.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().getAddressString())); nameColumn.setMinWidth(90); - TableColumn languagesColumn = new TableColumn<>(Res.get("account.arbitratorSelection.languages")); + TableColumn languagesColumn = new AutoTooltipTableColumn<>(Res.get("account.arbitratorSelection.languages")); languagesColumn.setSortable(false); languagesColumn.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().getLanguageCodes())); languagesColumn.setMinWidth(130); - TableColumn selectionColumn = new TableColumn( + TableColumn selectionColumn = new AutoTooltipTableColumn( Res.get("shared.accept")) { { setMinWidth(60); diff --git a/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java b/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java index 9c6986d5db3..d6869fb6fb7 100644 --- a/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java +++ b/gui/src/main/java/io/bisq/gui/main/dao/compensation/active/ActiveCompensationRequestView.java @@ -26,6 +26,7 @@ import io.bisq.gui.common.view.ActivatableView; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipTableColumn; import io.bisq.gui.components.InputTextField; import io.bisq.gui.components.TableGroupHeadline; import io.bisq.gui.main.MainView; @@ -220,7 +221,7 @@ public void onFailure(@NotNull Throwable t) { } private void setColumns() { - TableColumn dateColumn = new TableColumn(Res.get("shared.dateTime")) { + TableColumn dateColumn = new AutoTooltipTableColumn(Res.get("shared.dateTime")) { { setMinWidth(190); setMaxWidth(190); @@ -251,7 +252,7 @@ public void updateItem(final CompensationRequest item, boolean empty) { tableView.getSortOrder().add(dateColumn); - TableColumn nameColumn = new TableColumn<>(Res.get("shared.name")); + TableColumn nameColumn = new AutoTooltipTableColumn<>(Res.get("shared.name")); nameColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue())); nameColumn.setCellFactory( new Callback, TableCell uidColumn = new TableColumn<>(Res.get("shared.id")); + TableColumn uidColumn = new AutoTooltipTableColumn<>(Res.get("shared.id")); uidColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue())); uidColumn.setCellFactory( new Callback, TableCell column = new TableColumn<>(Res.get("shared.dateTime")); + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.dateTime")); column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setMinWidth(180); column.setMaxWidth(180); @@ -272,7 +273,8 @@ public void updateItem(final BsqTxListItem item, boolean empty) { } private void addTxIdColumn() { - TableColumn column = new TableColumn<>(Res.get("shared.txId")); + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.txId")); + column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setMinWidth(60); column.setCellFactory( @@ -308,7 +310,7 @@ public void updateItem(final BsqTxListItem item, boolean empty) { } private void addAddressColumn() { - TableColumn column = new TableColumn<>(Res.get("shared.address")); + TableColumn column = new AutoTooltipTableColumn<>(Res.get("shared.address")); column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setMinWidth(140); column.setCellFactory( @@ -357,7 +359,7 @@ public void updateItem(final BsqTxListItem item, boolean empty) { } private void addAmountColumn() { - TableColumn column = new TableColumn<>(Res.get("shared.amountWithCur", "BSQ")); + TableColumn column = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", "BSQ")); column.setMinWidth(100); column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory(new Callback, @@ -385,7 +387,7 @@ public void updateItem(final BsqTxListItem item, boolean empty) { } private void addConfidenceColumn() { - TableColumn column = new TableColumn<>(Res.get("shared.confirmations")); + TableColumn column = new AutoTooltipTableColumn<>(Res.get("shared.confirmations")); column.setMinWidth(130); column.setMaxWidth(130); @@ -415,7 +417,7 @@ public void updateItem(final BsqTxListItem item, boolean empty) { } private void addTxTypeColumn() { - TableColumn column = new TableColumn<>(Res.get("dao.wallet.tx.type")); + TableColumn column = new AutoTooltipTableColumn<>(Res.get("dao.wallet.tx.type")); column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setMinWidth(70); column.setMaxWidth(column.getMinWidth()); diff --git a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java index 52ae2faf8e4..596b0a63327 100644 --- a/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java +++ b/gui/src/main/java/io/bisq/gui/main/disputes/trader/TraderDisputeView.java @@ -912,13 +912,11 @@ private void showArrivedIcon() { /////////////////////////////////////////////////////////////////////////////////////////// private TableColumn getSelectColumn() { - TableColumn column = new TableColumn(Res.get("shared.select")) { - { - setMinWidth(80); - setMaxWidth(80); - setSortable(false); - } - }; + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.select")); + column.setMinWidth(80); + column.setMaxWidth(80); + column.setSortable(false); + column.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue())); column.setCellFactory( @@ -957,7 +955,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getContractColumn() { - TableColumn column = new TableColumn(Res.get("shared.details")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.details")) { { setMinWidth(80); setSortable(false); @@ -997,7 +995,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getDateColumn() { - TableColumn column = new TableColumn(Res.get("shared.date")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.date")) { { setMinWidth(180); } @@ -1023,7 +1021,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getTradeIdColumn() { - TableColumn column = new TableColumn(Res.get("shared.tradeId")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.tradeId")) { { setMinWidth(110); } @@ -1064,7 +1062,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getBuyerOnionAddressColumn() { - TableColumn column = new TableColumn(Res.get("support.buyerAddress")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("support.buyerAddress")) { { setMinWidth(170); } @@ -1090,7 +1088,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getSellerOnionAddressColumn() { - TableColumn column = new TableColumn(Res.get("support.sellerAddress")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("support.sellerAddress")) { { setMinWidth(170); } @@ -1143,7 +1141,7 @@ protected String getSellerOnionAddressColumnLabel(Dispute item) { } private TableColumn getMarketColumn() { - TableColumn column = new TableColumn(Res.get("shared.market")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.market")) { { setMinWidth(130); } @@ -1169,7 +1167,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getRoleColumn() { - TableColumn column = new TableColumn(Res.get("support.role")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("support.role")) { { setMinWidth(130); } @@ -1199,7 +1197,7 @@ public void updateItem(final Dispute item, boolean empty) { } private TableColumn getStateColumn() { - TableColumn column = new TableColumn(Res.get("support.state")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("support.state")) { { setMinWidth(50); } diff --git a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java index 707957cf4a5..c2b40881445 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/deposit/DepositView.java @@ -109,11 +109,11 @@ private DepositView(BtcWalletService walletService, @Override public void initialize() { paymentLabelString = Res.get("funds.deposit.fundBisqWallet"); - selectColumn.setText(Res.get("shared.select")); - addressColumn.setText(Res.get("shared.address")); - balanceColumn.setText(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())); - confirmationsColumn.setText(Res.get("shared.confirmations")); - usageColumn.setText(Res.get("shared.usage")); + 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); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/locked/LockedView.java b/gui/src/main/java/io/bisq/gui/main/funds/locked/LockedView.java index 9c08434a536..bb33bfd741e 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/locked/LockedView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/locked/LockedView.java @@ -91,10 +91,10 @@ private LockedView(BtcWalletService btcWalletService, TradeManager tradeManager, @Override public void initialize() { - dateColumn.setText(Res.get("shared.dateTime")); - detailsColumn.setText(Res.get("shared.details")); - addressColumn.setText(Res.get("shared.address")); - balanceColumn.setText(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details"))); + addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address"))); + balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode()))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.locked.noFunds"))); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/reserved/ReservedView.java b/gui/src/main/java/io/bisq/gui/main/funds/reserved/ReservedView.java index 9f51431e18b..1584a0dff40 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/reserved/ReservedView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/reserved/ReservedView.java @@ -91,10 +91,10 @@ private ReservedView(BtcWalletService btcWalletService, TradeManager tradeManage @Override public void initialize() { - dateColumn.setText(Res.get("shared.dateTime")); - detailsColumn.setText(Res.get("shared.details")); - addressColumn.setText(Res.get("shared.address")); - balanceColumn.setText(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details"))); + addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address"))); + balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode()))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.reserved.noFunds"))); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java b/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java index d998917c6f5..d3e91ac5352 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/transactions/TransactionsView.java @@ -130,13 +130,13 @@ private TransactionsView(BtcWalletService btcWalletService, BsqWalletService bsq @Override public void initialize() { - dateColumn.setText(Res.get("shared.dateTime")); - detailsColumn.setText(Res.get("shared.details")); - addressColumn.setText(Res.get("shared.address")); - transactionColumn.setText(Res.get("shared.txId", Res.getBaseCurrencyCode())); - amountColumn.setText(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); - confidenceColumn.setText(Res.get("shared.confirmations", Res.getBaseCurrencyCode())); - revertTxColumn.setText(Res.get("shared.revert", Res.getBaseCurrencyCode())); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details"))); + addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address"))); + transactionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.txId", Res.getBaseCurrencyCode()))); + amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()))); + confidenceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations", Res.getBaseCurrencyCode()))); + revertTxColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.revert", Res.getBaseCurrencyCode()))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.tx.noTxAvailable"))); diff --git a/gui/src/main/java/io/bisq/gui/main/funds/withdrawal/WithdrawalView.java b/gui/src/main/java/io/bisq/gui/main/funds/withdrawal/WithdrawalView.java index e79afd31c3d..15af276f1d5 100644 --- a/gui/src/main/java/io/bisq/gui/main/funds/withdrawal/WithdrawalView.java +++ b/gui/src/main/java/io/bisq/gui/main/funds/withdrawal/WithdrawalView.java @@ -144,9 +144,9 @@ public void initialize() { toLabel.setText(Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode())); withdrawButton.setText(Res.get("funds.withdrawal.withdrawButton")); - addressColumn.setText(Res.get("shared.address")); - balanceColumn.setText(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())); - selectColumn.setText(Res.get("shared.select")); + addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address"))); + balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode()))); + selectColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.select"))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.withdrawal.noFundsAvailable"))); diff --git a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java index 8749d9c17d9..80d3cc53fbe 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartView.java @@ -28,6 +28,7 @@ import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipButton; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipTableColumn; import io.bisq.gui.main.MainView; import io.bisq.gui.main.offer.BuyOfferView; import io.bisq.gui.main.offer.SellOfferView; @@ -393,7 +394,7 @@ public void updateItem(final OfferListItem offerListItem, boolean empty) { }); // amount - TableColumn amountColumn = new TableColumn<>(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); + TableColumn amountColumn = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); amountColumn.setMinWidth(115); amountColumn.setSortable(false); amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); @@ -416,7 +417,7 @@ public void updateItem(final OfferListItem offerListItem, boolean empty) { // Lets remove that as it is not really relevant and seems to be confusing to some users // accumulated - /* TableColumn accumulatedColumn = new TableColumn<>(Res.get("shared.sumWithCur", Res.getBaseCurrencyCode())); + /* TableColumn accumulatedColumn = new AutoTooltipTableColumn<>(Res.get("shared.sumWithCur", Res.getBaseCurrencyCode())); accumulatedColumn.setMinWidth(100); accumulatedColumn.setSortable(false); accumulatedColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); diff --git a/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java b/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java index 5b88656e202..82aa0fbb0c7 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/spread/SpreadView.java @@ -22,6 +22,7 @@ import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipTableColumn; import io.bisq.gui.util.BSFormatter; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.collections.ListChangeListener; @@ -117,10 +118,10 @@ private void updateHeaders() { int numberOfSellOffers = sortedList.stream().mapToInt(item -> item.numberOfSellOffers).sum(); String total = formatter.formatCoin(Coin.valueOf(sortedList.stream().mapToLong(item -> item.totalAmount.value).sum())); - numberOfOffersColumn.setText(Res.get("market.spread.numberOfOffersColumn", numberOfOffers)); - numberOfBuyOffersColumn.setText(Res.get("market.spread.numberOfBuyOffersColumn", numberOfBuyOffers)); - numberOfSellOffersColumn.setText(Res.get("market.spread.numberOfSellOffersColumn", numberOfSellOffers)); - totalAmountColumn.setText(Res.get("market.spread.totalAmountColumn", total)); + numberOfOffersColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.numberOfOffersColumn", numberOfOffers))); + numberOfBuyOffersColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.numberOfBuyOffersColumn", numberOfBuyOffers))); + numberOfSellOffersColumn.setGraphic(new AutoTooltipLabel((Res.get("market.spread.numberOfSellOffersColumn", numberOfSellOffers)))); + totalAmountColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.totalAmountColumn", total))); } @@ -129,7 +130,7 @@ private void updateHeaders() { /////////////////////////////////////////////////////////////////////////////////////////// private TableColumn getCurrencyColumn() { - TableColumn column = new TableColumn(Res.get("shared.currency")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.currency")) { { setMinWidth(160); } @@ -157,7 +158,7 @@ public void updateItem(final SpreadItem item, boolean empty) { } private TableColumn getNumberOfOffersColumn() { - TableColumn column = new TableColumn("Total offers") { + TableColumn column = new TableColumn() { { setMinWidth(100); } @@ -269,7 +270,7 @@ public void updateItem(final SpreadItem item, boolean empty) { } private TableColumn getSpreadColumn() { - TableColumn column = new TableColumn(Res.get("market.spread.spreadColumn")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("market.spread.spreadColumn")) { { setMinWidth(110); } diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java index 6833fa8d7ac..c3f850d059e 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java @@ -28,6 +28,7 @@ import io.bisq.gui.common.view.ActivatableViewAndModel; import io.bisq.gui.common.view.FxmlView; import io.bisq.gui.components.AutoTooltipLabel; +import io.bisq.gui.components.AutoTooltipTableColumn; import io.bisq.gui.components.AutoTooltipToggleButton; import io.bisq.gui.main.market.trades.charts.price.CandleStickChart; import io.bisq.gui.main.market.trades.charts.volume.VolumeChart; @@ -186,7 +187,7 @@ else if (model.getSelectedCurrencyListItem().isPresent()) priceColumn.setSortable(!showAll); if (showAll) { - volumeColumn.setText(Res.get("shared.amount")); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount"))); priceColumnLabel.set(Res.get("shared.price")); if (!tableView.getColumns().contains(marketColumn)) tableView.getColumns().add(1, marketColumn); @@ -196,7 +197,7 @@ else if (model.getSelectedCurrencyListItem().isPresent()) volumeChart.setPrefHeight(volumeChart.getMinHeight()); priceSeries.setName(selectedTradeCurrency.getName()); String code = selectedTradeCurrency.getCode(); - volumeColumn.setText(Res.get("shared.amountWithCur", code)); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", code))); priceColumnLabel.set(formatter.getPriceWithCurrencyCode(code)); @@ -462,7 +463,7 @@ private void createTable() { VBox.setVgrow(tableView, Priority.ALWAYS); // date - TableColumn dateColumn = new TableColumn(Res.get("shared.dateTime")) { + TableColumn dateColumn = new AutoTooltipTableColumn(Res.get("shared.dateTime")) { { setMinWidth(190); setMaxWidth(190); @@ -491,7 +492,7 @@ public void updateItem(final TradeStatistics2 item, boolean empty) { tableView.getColumns().add(dateColumn); // market - marketColumn = new TableColumn(Res.get("shared.market")) { + marketColumn = new AutoTooltipTableColumn(Res.get("shared.market")) { { setMinWidth(130); setMaxWidth(130); @@ -544,7 +545,7 @@ public void updateItem(final TradeStatistics2 item, boolean empty) { tableView.getColumns().add(priceColumn); // amount - TableColumn amountColumn = new TableColumn<>(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); + TableColumn amountColumn = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); amountColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue())); amountColumn.setCellFactory( new Callback, TableCell paymentMethodColumn = new TableColumn<>(Res.get("shared.paymentMethod")); + TableColumn paymentMethodColumn = new AutoTooltipTableColumn<>(Res.get("shared.paymentMethod")); paymentMethodColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue())); paymentMethodColumn.setCellFactory( new Callback, TableCell directionColumn = new TableColumn<>(Res.get("shared.offerType")); + TableColumn directionColumn = new AutoTooltipTableColumn<>(Res.get("shared.offerType")); directionColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue())); directionColumn.setCellFactory( new Callback, TableCell { setDirectionTitles(); if (showAll) { - volumeColumn.setText(Res.get("shared.amountMinMax")); - priceColumn.setText(Res.get("shared.price")); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountMinMax"))); + priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price"))); if (!tableView.getColumns().contains(marketColumn)) tableView.getColumns().add(0, marketColumn); } else { - volumeColumn.setText(Res.get("offerbook.volume", code)); - priceColumn.setText(formatter.getPriceWithCurrencyCode(code)); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("offerbook.volume", code))); + priceColumn.setGraphic(new AutoTooltipLabel(formatter.getPriceWithCurrencyCode(code))); if (tableView.getColumns().contains(marketColumn)) tableView.getColumns().remove(marketColumn); @@ -490,11 +487,8 @@ private void openPopupForMissingAccountSetup(String headLine, String message, Cl /////////////////////////////////////////////////////////////////////////////////////////// private TableColumn getAmountColumn() { - TableColumn column = new TableColumn(Res.get("shared.BTCMinMax")) { - { - setMinWidth(150); - } - }; + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.BTCMinMax")); + column.setMinWidth(150); column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); column.setCellFactory( new Callback, TableCell getMarketColumn() { - TableColumn column = new TableColumn(Res.get("shared.market")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.market")) { { setMinWidth(120); // setMaxWidth(130); @@ -667,7 +661,7 @@ public void updateItem(final OfferBookListItem item, boolean empty) { } private TableColumn getPaymentMethodColumn() { - TableColumn column = new TableColumn(Res.get("shared.paymentMethod")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("shared.paymentMethod")) { { setMinWidth(125); } @@ -703,7 +697,7 @@ public void updateItem(final OfferBookListItem item, boolean empty) { } private TableColumn getActionColumn() { - TableColumn column = new TableColumn(Res.get("offerbook.wantTo")) { + TableColumn column = new AutoTooltipTableColumn(Res.get("offerbook.wantTo")) { { setMinWidth(80); setSortable(false); @@ -831,7 +825,7 @@ public void updateItem(final OfferBookListItem newItem, boolean empty) { } private TableColumn getAvatarColumn() { - TableColumn column = new TableColumn("") { + TableColumn column = new AutoTooltipTableColumn("") { { setMinWidth(40); setMaxWidth(40); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java index 0b828959d9d..d68c3969312 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/closedtrades/ClosedTradesView.java @@ -88,14 +88,14 @@ public ClosedTradesView(ClosedTradesViewModel model, @Override public void initialize() { - priceColumn.setText(Res.get("shared.price")); - amountColumn.setText(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); - volumeColumn.setText(Res.get("shared.volume")); - marketColumn.setText(Res.get("shared.market")); - directionColumn.setText(Res.get("shared.offerType")); - dateColumn.setText(Res.get("shared.dateTime")); - tradeIdColumn.setText(Res.get("shared.tradeId")); - stateColumn.setText(Res.get("shared.state")); + priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price"))); + amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()))); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.volume"))); + marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market"))); + directionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerType"))); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + tradeIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeId"))); + stateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.state"))); avatarColumn.setText(""); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java index 9aedd1617d2..36e445840f7 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/failedtrades/FailedTradesView.java @@ -54,14 +54,14 @@ public FailedTradesView(FailedTradesViewModel model, TradeDetailsWindow tradeDet @Override public void initialize() { - priceColumn.setText(Res.get("shared.price")); - amountColumn.setText(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); - volumeColumn.setText(Res.get("shared.volume")); - marketColumn.setText(Res.get("shared.market")); - directionColumn.setText(Res.get("shared.offerType")); - dateColumn.setText(Res.get("shared.dateTime")); - tradeIdColumn.setText(Res.get("shared.tradeId")); - stateColumn.setText(Res.get("shared.state")); + priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price"))); + amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()))); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.volume"))); + marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market"))); + directionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerType"))); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + tradeIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeId"))); + stateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.state"))); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.trades")))); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java index 7d5daaa95e2..82543a3ded9 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/openoffer/OpenOffersView.java @@ -64,14 +64,14 @@ public OpenOffersView(OpenOffersViewModel model, Navigation navigation, OfferDet @Override public void initialize() { - priceColumn.setText(Res.get("shared.price")); - amountColumn.setText(Res.get("shared.BTCMinMax")); - volumeColumn.setText(Res.get("shared.amountMinMax")); - marketColumn.setText(Res.get("shared.market")); - directionColumn.setText(Res.get("shared.offerType")); - dateColumn.setText(Res.get("shared.dateTime")); - offerIdColumn.setText(Res.get("shared.offerId")); - removeItemColumn.setText(""); + priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price"))); + amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.BTCMinMax"))); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountMinMax"))); + marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market"))); + directionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerType"))); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + offerIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerId"))); + removeItemColumn.setGraphic(new AutoTooltipLabel("")); setOfferIdColumnCellFactory(); setDirectionColumnCellFactory(); diff --git a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java index dea591c1419..a6f3d79bd36 100644 --- a/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java +++ b/gui/src/main/java/io/bisq/gui/main/portfolio/pendingtrades/PendingTradesView.java @@ -90,14 +90,14 @@ public PendingTradesView(PendingTradesViewModel model, TradeDetailsWindow tradeD @Override public void initialize() { - priceColumn.setText(Res.get("shared.price")); - amountColumn.setText(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())); - volumeColumn.setText(Res.get("shared.volume")); - marketColumn.setText(Res.get("shared.market")); - roleColumn.setText(Res.get("portfolio.pending.role")); - dateColumn.setText(Res.get("shared.dateTime")); - tradeIdColumn.setText(Res.get("shared.tradeId")); - paymentMethodColumn.setText(Res.get("shared.paymentMethod")); + priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price"))); + amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()))); + volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.volume"))); + marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market"))); + roleColumn.setGraphic(new AutoTooltipLabel(Res.get("portfolio.pending.role"))); + dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime"))); + tradeIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeId"))); + paymentMethodColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.paymentMethod"))); avatarColumn.setText(""); setTradeIdColumnCellFactory(); diff --git a/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java b/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java index 107eb00048b..b787b283c40 100644 --- a/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java +++ b/gui/src/main/java/io/bisq/gui/main/settings/network/NetworkSettingsView.java @@ -136,14 +136,14 @@ public void initialize() { reSyncSPVChainLabel.setText(Res.getWithCol("settings.net.reSyncSPVChainLabel")); reSyncSPVChainButton.setText(Res.get("settings.net.reSyncSPVChainButton")); p2PPeersLabel.setText(Res.get("settings.net.p2PPeersLabel")); - onionAddressColumn.setText(Res.get("settings.net.onionAddressColumn")); - creationDateColumn.setText(Res.get("settings.net.creationDateColumn")); - connectionTypeColumn.setText(Res.get("settings.net.connectionTypeColumn")); + onionAddressColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.onionAddressColumn"))); + creationDateColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.creationDateColumn"))); + connectionTypeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.connectionTypeColumn"))); totalTrafficLabel.setText(Res.get("settings.net.totalTrafficLabel")); - roundTripTimeColumn.setText(Res.get("settings.net.roundTripTimeColumn")); - sentBytesColumn.setText(Res.get("settings.net.sentBytesColumn")); - receivedBytesColumn.setText(Res.get("settings.net.receivedBytesColumn")); - peerTypeColumn.setText(Res.get("settings.net.peerTypeColumn")); + roundTripTimeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.roundTripTimeColumn"))); + sentBytesColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.sentBytesColumn"))); + receivedBytesColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.receivedBytesColumn"))); + peerTypeColumn.setGraphic(new AutoTooltipLabel(Res.get("settings.net.peerTypeColumn"))); openTorSettingsButton.setText(Res.get("settings.net.openTorSettingsButton")); GridPane.setMargin(bitcoinPeersLabel, new Insets(4, 0, 0, 0)); From a02ee47960fa453e623a29347da09f8ddc5962dd Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 21 Dec 2017 16:00:53 +0100 Subject: [PATCH 8/8] Add auto tooltip for binded column header --- .../io/bisq/gui/main/market/trades/TradesChartsView.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java index c3f850d059e..4bb6303e0a3 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsView.java @@ -98,6 +98,7 @@ public class TradesChartsView extends ActivatableViewAndModel parentHeightListener; private Pane rootParent; + private ChangeListener priceColumnLabelListener; /////////////////////////////////////////////////////////////////////////////////////////// @@ -143,6 +144,8 @@ public void initialize() { tradeStatisticsByCurrencyListener = c -> nrOfTradeStatisticsLabel.setText(Res.get("market.trades.nrOfTrades", model.tradeStatisticsByCurrency.size())); parentHeightListener = (observable, oldValue, newValue) -> layout(); + + priceColumnLabelListener = (o, oldVal, newVal) -> priceColumn.setGraphic(new AutoTooltipLabel(newVal)); } @Override @@ -177,7 +180,7 @@ else if (model.getSelectedCurrencyListItem().isPresent()) model.tradeStatisticsByCurrency.addListener(tradeStatisticsByCurrencyListener); priceAxisY.labelProperty().bind(priceColumnLabel); - priceColumn.textProperty().bind(priceColumnLabel); + priceColumnLabel.addListener(priceColumnLabelListener); currencySelectionBinding = EasyBind.combine( model.showAllTradeCurrenciesProperty, model.selectedTradeCurrencyProperty, @@ -244,7 +247,7 @@ protected void deactivate() { model.tradeStatisticsByCurrency.removeListener(tradeStatisticsByCurrencyListener); priceAxisY.labelProperty().unbind(); - priceColumn.textProperty().unbind(); + priceColumn.textProperty().removeListener(priceColumnLabelListener); currencySelectionSubscriber.unsubscribe();