mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Add link icon
This commit is contained in:
parent
e9c0ffc858
commit
cff4db450c
@ -52,6 +52,7 @@ public class TxIdTextField extends AnchorPane {
|
||||
private final Tooltip progressIndicatorTooltip;
|
||||
private final ConfidenceProgressIndicator progressIndicator;
|
||||
private final Label copyIcon;
|
||||
private final Label blockExplorerIcon;
|
||||
private TxConfidenceListener txConfidenceListener;
|
||||
|
||||
|
||||
@ -78,20 +79,23 @@ public class TxIdTextField extends AnchorPane {
|
||||
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
|
||||
AnchorPane.setRightAnchor(copyIcon, 30.0);
|
||||
|
||||
blockExplorerIcon = new Label();
|
||||
blockExplorerIcon.getStyleClass().add("external-link-icon");
|
||||
AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
|
||||
blockExplorerIcon.setMinWidth(20);
|
||||
AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
|
||||
AnchorPane.setTopAnchor(blockExplorerIcon, 4.0);
|
||||
|
||||
textField = new TextField();
|
||||
textField.setId("address-text-field");
|
||||
textField.setEditable(false);
|
||||
Tooltip.install(textField, new Tooltip("Open a blockchain explorer with that transactions ID"));
|
||||
AnchorPane.setRightAnchor(textField, 55.0);
|
||||
AnchorPane.setRightAnchor(textField, 80.0);
|
||||
AnchorPane.setLeftAnchor(textField, 0.0);
|
||||
textField.focusTraversableProperty().set(focusTraversableProperty().get());
|
||||
//TODO app wide focus
|
||||
//focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());
|
||||
|
||||
getChildren().addAll(textField, copyIcon, progressIndicator);
|
||||
getChildren().addAll(textField, copyIcon, blockExplorerIcon, progressIndicator);
|
||||
}
|
||||
|
||||
|
||||
public void setup(String txID) {
|
||||
if (txConfidenceListener != null)
|
||||
walletService.removeTxConfidenceListener(txConfidenceListener);
|
||||
@ -106,7 +110,26 @@ public class TxIdTextField extends AnchorPane {
|
||||
updateConfidence(walletService.getConfidenceForTxId(txID));
|
||||
|
||||
textField.setText(txID);
|
||||
textField.setOnMouseClicked(mouseEvent -> {
|
||||
textField.setOnMouseClicked(mouseEvent -> openBlockExplorer(txID));
|
||||
blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(txID));
|
||||
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(txID));
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (walletService != null && txConfidenceListener != null)
|
||||
walletService.removeTxConfidenceListener(txConfidenceListener);
|
||||
|
||||
textField.setOnMouseClicked(null);
|
||||
blockExplorerIcon.setOnMouseClicked(null);
|
||||
copyIcon.setOnMouseClicked(null);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void openBlockExplorer(String txID) {
|
||||
try {
|
||||
if (preferences != null)
|
||||
Utilities.openWebPage(preferences.getBlockChainExplorer().txUrl + txID);
|
||||
@ -115,26 +138,8 @@ public class TxIdTextField extends AnchorPane {
|
||||
new Popup().warning("Opening browser failed. Please check your internet " +
|
||||
"connection.").show();
|
||||
}
|
||||
});
|
||||
|
||||
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(txID));
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (walletService != null && txConfidenceListener != null)
|
||||
walletService.removeTxConfidenceListener(txConfidenceListener);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters/Setters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void updateConfidence(TransactionConfidence confidence) {
|
||||
if (confidence != null) {
|
||||
switch (confidence.getConfidenceType()) {
|
||||
|
Loading…
Reference in New Issue
Block a user