[bisq-network/bisq] Fix incorrect tx link to tx explorer - fixes #5548 (#5563)

Kai notifications at github.com
Sat Jun 12 09:08:20 CEST 2021


@KaiWitt commented on this pull request.



> +    @Getter
+    private final TextField textField;
+    private final Label copyIcon, blockExplorerIcon, missingAddressWarningIcon;
+    @Setter
+    private boolean isBsq;
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////////
+    // Constructor
+    ///////////////////////////////////////////////////////////////////////////////////////////
+
+    public ExplorerAddressTextField() {
+        copyIcon = new Label();
+        copyIcon.setLayoutY(3);
+        copyIcon.getStyleClass().addAll("icon", "highlight");
+        copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));

```suggestion
        copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard")));
```

> +    private boolean isBsq;
+
+
+    ///////////////////////////////////////////////////////////////////////////////////////////
+    // Constructor
+    ///////////////////////////////////////////////////////////////////////////////////////////
+
+    public ExplorerAddressTextField() {
+        copyIcon = new Label();
+        copyIcon.setLayoutY(3);
+        copyIcon.getStyleClass().addAll("icon", "highlight");
+        copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
+        AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
+        AnchorPane.setRightAnchor(copyIcon, 30.0);
+
+        Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));

There is `tooltip.openBlockchainForAddress=Open external blockchain explorer for address: {0}` in displayStrings.properties, or maybe a new string is needed

> +        AnchorPane.setRightAnchor(copyIcon, 30.0);
+
+        Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));
+
+        blockExplorerIcon = new Label();
+        blockExplorerIcon.getStyleClass().addAll("icon", "highlight");
+        blockExplorerIcon.setTooltip(tooltip);
+        AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
+        blockExplorerIcon.setMinWidth(20);
+        AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
+        AnchorPane.setTopAnchor(blockExplorerIcon, 4.0);
+
+        missingAddressWarningIcon = new Label();
+        missingAddressWarningIcon.getStyleClass().addAll("icon", "error-icon");
+        AwesomeDude.setIcon(missingAddressWarningIcon, AwesomeIcon.WARNING_SIGN);
+        missingAddressWarningIcon.setTooltip(new Tooltip(Res.get("txIdTextField.missingTx.warning.tooltip")));

needs a new dispay string, you're using a string for txIds

> +        AnchorPane.setRightAnchor(missingAddressWarningIcon, 52.0);
+        AnchorPane.setTopAnchor(missingAddressWarningIcon, 4.0);
+        missingAddressWarningIcon.setVisible(false);
+        missingAddressWarningIcon.setManaged(false);
+
+        textField = new JFXTextField();
+        textField.setId("address-text-field");
+        textField.setEditable(false);
+        textField.setTooltip(tooltip);
+        AnchorPane.setRightAnchor(textField, 80.0);
+        AnchorPane.setLeftAnchor(textField, 0.0);
+        textField.focusTraversableProperty().set(focusTraversableProperty().get());
+        getChildren().addAll(textField, missingAddressWarningIcon, blockExplorerIcon, copyIcon);
+    }
+
+    public void setup(@Nullable String addressId) {

```suggestion
    public void setup(@Nullable String address) {
```

> +    public static void setPreferences(Preferences preferences) {
+        ExplorerAddressTextField.preferences = preferences;
+    }

setters should be further down the file, after variable declarations and constructors

> +        blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(addressId));
+        copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(addressId));
+    }
+
+    public void cleanup() {
+        textField.setOnMouseClicked(null);
+        blockExplorerIcon.setOnMouseClicked(null);
+        copyIcon.setOnMouseClicked(null);
+        textField.setText("");
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////////////
+    // Private
+    ///////////////////////////////////////////////////////////////////////////////////////////
+
+    private void openBlockExplorer(String addressId) {

```suggestion
    private void openBlockExplorer(String address) {
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5563#pullrequestreview-682302956
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210612/7e52e557/attachment.htm>


More information about the bisq-github mailing list