diff --git a/desktop/src/main/java/bisq/desktop/components/TextFieldWithIcon.java b/desktop/src/main/java/bisq/desktop/components/TextFieldWithIcon.java index 97e237c831c..5aa5909164e 100644 --- a/desktop/src/main/java/bisq/desktop/components/TextFieldWithIcon.java +++ b/desktop/src/main/java/bisq/desktop/components/TextFieldWithIcon.java @@ -29,13 +29,9 @@ import javafx.geometry.Pos; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import lombok.Getter; public class TextFieldWithIcon extends AnchorPane { - public static final Logger log = LoggerFactory.getLogger(TextFieldWithIcon.class); @Getter private final Label iconLabel; @Getter @@ -45,7 +41,6 @@ public class TextFieldWithIcon extends AnchorPane { public TextFieldWithIcon() { textField = new JFXTextField(); textField.setEditable(false); - textField.setMouseTransparent(true); textField.setFocusTraversable(false); setLeftAnchor(textField, 0d); setRightAnchor(textField, 0d); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java index 836b69dc634..c51d9ed8bac 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java @@ -61,7 +61,6 @@ import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.Label; import javafx.scene.control.TextArea; import javafx.scene.control.Tooltip; import javafx.scene.input.KeyCode; @@ -152,18 +151,18 @@ private void addContent() { PaymentAccountPayload sellerPaymentAccountPayload = contract.getSellerPaymentAccountPayload(); addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("contractWindow.title")); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.get("shared.offerId"), offer.getId(), - Layout.TWICE_FIRST_ROW_DISTANCE).second.setMouseTransparent(false); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("contractWindow.dates"), + addConfirmationLabelTextField(gridPane, rowIndex, Res.get("shared.offerId"), offer.getId(), + Layout.TWICE_FIRST_ROW_DISTANCE); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("contractWindow.dates"), DisplayUtils.formatDateTime(offer.getDate()) + " / " + DisplayUtils.formatDateTime(dispute.getTradeDate())); String currencyCode = offer.getCurrencyCode(); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.offerType"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.offerType"), DisplayUtils.getDirectionBothSides(offer.getDirection(), currencyCode)); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradePrice"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradePrice"), FormattingUtils.formatPrice(contract.getTradePrice())); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeAmount"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradeAmount"), formatter.formatCoinWithCode(contract.getTradeAmount())); - addConfirmationLabelLabel(gridPane, + addConfirmationLabelTextField(gridPane, ++rowIndex, VolumeUtil.formatVolumeLabel(currencyCode, ":"), VolumeUtil.formatVolumeWithCode(contract.getTradeVolume())); @@ -174,17 +173,17 @@ private void addContent() { Res.getWithColAndCap("shared.seller") + " " + formatter.formatCoinWithCode(offer.getSellerSecurityDeposit()); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("contractWindow.btcAddresses"), - contract.getBuyerPayoutAddressString() + " / " + contract.getSellerPayoutAddressString()).second.setMouseTransparent(false); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + contract.getBuyerPayoutAddressString() + " / " + contract.getSellerPayoutAddressString()); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("contractWindow.onions"), contract.getBuyerNodeAddress().getFullAddress() + " / " + contract.getSellerNodeAddress().getFullAddress()); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("contractWindow.accountAge"), getAccountAge(contract.getBuyerPaymentAccountPayload(), @@ -194,24 +193,22 @@ private void addContent() { DisputeManager> disputeManager = getDisputeManager(dispute); String nrOfDisputesAsBuyer = disputeManager != null ? disputeManager.getNrOfDisputes(true, contract) : ""; String nrOfDisputesAsSeller = disputeManager != null ? disputeManager.getNrOfDisputes(false, contract) : ""; - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("contractWindow.numDisputes"), nrOfDisputesAsBuyer + " / " + nrOfDisputesAsSeller); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.buyer")), contract.getBuyerPaymentAccountPayload() != null ? contract.getBuyerPaymentAccountPayload().getPaymentDetails() - : "NA") - .second.setMouseTransparent(false); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, + : "NA"); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.seller")), sellerPaymentAccountPayload != null ? sellerPaymentAccountPayload.getPaymentDetails() - : "NA") - .second.setMouseTransparent(false); + : "NA"); String title = ""; String agentKeyBaseUserName = ""; @@ -237,7 +234,7 @@ private void addContent() { NodeAddress agentNodeAddress = disputeManager.getAgentNodeAddress(dispute); if (agentNodeAddress != null) { String value = agentKeyBaseUserName + " (" + agentNodeAddress.getFullAddress() + ")"; - addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, title, value); + addConfirmationLabelTextField(gridPane, ++rowIndex, title, value); } } @@ -250,25 +247,18 @@ private void addContent() { countries = CountryUtil.getCodesString(acceptedCountryCodes); tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes)); } - Label acceptedCountries = addConfirmationLabelLabel(gridPane, - ++rowIndex, - Res.get("shared.acceptedTakerCountries"), - countries).second; - if (tooltip != null) acceptedCountries.setTooltip(new Tooltip()); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.acceptedTakerCountries"), countries) + .second.setTooltip(tooltip); } if (showAcceptedBanks) { if (offer.getPaymentMethod().equals(PaymentMethod.SAME_BANK)) { - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.bankName"), acceptedBanks.get(0)); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.bankName"), acceptedBanks.get(0)); } else if (offer.getPaymentMethod().equals(PaymentMethod.SPECIFIC_BANKS)) { String value = Joiner.on(", ").join(acceptedBanks); Tooltip tooltip = new Tooltip(Res.get("shared.acceptedBanks") + value); - Label acceptedBanksTextField = addConfirmationLabelLabel(gridPane, - ++rowIndex, - Res.get("shared.acceptedBanks"), - value).second; - acceptedBanksTextField.setMouseTransparent(false); - acceptedBanksTextField.setTooltip(tooltip); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.acceptedBanks"), value) + .second.setTooltip(tooltip); } } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java index 91c2661d14e..dd632b0e082 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java @@ -286,16 +286,16 @@ private void addContent() { private void addInfoPane() { Contract contract = dispute.getContract(); addTitledGroupBg(gridPane, ++rowIndex, 17, Res.get("disputeSummaryWindow.title")).getStyleClass().add("last"); - addConfirmationLabelLabel(gridPane, rowIndex, Res.get("shared.tradeId"), dispute.getShortTradeId(), + addConfirmationLabelTextField(gridPane, rowIndex, Res.get("shared.tradeId"), dispute.getShortTradeId(), Layout.TWICE_FIRST_ROW_DISTANCE); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.openDate"), DisplayUtils.formatDateTime(dispute.getOpeningDate())); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.openDate"), DisplayUtils.formatDateTime(dispute.getOpeningDate())); role = dispute.getRoleString(); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.role"), role); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeAmount"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.role"), role); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradeAmount"), formatter.formatCoinWithCode(contract.getTradeAmount())); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradePrice"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradePrice"), FormattingUtils.formatPrice(contract.getTradePrice())); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeVolume"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradeVolume"), VolumeUtil.formatVolumeWithCode(contract.getTradeVolume())); String securityDeposit = Res.getWithColAndCap("shared.buyer") + " " + @@ -304,7 +304,7 @@ private void addInfoPane() { Res.getWithColAndCap("shared.seller") + " " + formatter.formatCoinWithCode(contract.getOfferPayload().getSellerSecurityDeposit()); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); boolean isMediationDispute = getDisputeManager(dispute) instanceof MediationManager; if (isMediationDispute) { @@ -320,7 +320,7 @@ private void addInfoPane() { for (Map.Entry entry : dispute.getExtraDataMap().entrySet()) { extraDataSummary += "[" + entry.getKey() + ":" + entry.getValue() + "] "; } - addConfirmationLabelLabelWithCopyIcon(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.extraInfo"), extraDataSummary); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.extraInfo"), extraDataSummary); } } else { delayedPayoutTxStatus = addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.delayedPayoutStatus"), "Checking...").second; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java index 7c31f5f896a..332133d61cc 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -18,7 +18,6 @@ package bisq.desktop.main.overlays.windows; import bisq.desktop.components.BisqTextArea; -import bisq.desktop.components.TextFieldWithCopyIcon; import bisq.desktop.components.TxIdTextField; import bisq.desktop.main.MainView; import bisq.desktop.main.overlays.Overlay; @@ -155,26 +154,26 @@ private void addContent() { String toSpend = " " + Res.get("shared.toSpend"); String offerType = Res.get("shared.offerType"); if (tradeManager.isBuyer(offer)) { - addConfirmationLabelLabel(gridPane, rowIndex, offerType, + addConfirmationLabelTextField(gridPane, rowIndex, offerType, DisplayUtils.getDirectionForBuyer(myOffer, offer.getCurrencyCode()), Layout.TWICE_FIRST_ROW_DISTANCE); fiatDirectionInfo = toSpend; btcDirectionInfo = toReceive; } else { - addConfirmationLabelLabel(gridPane, rowIndex, offerType, + addConfirmationLabelTextField(gridPane, rowIndex, offerType, DisplayUtils.getDirectionForSeller(myOffer, offer.getCurrencyCode()), Layout.TWICE_FIRST_ROW_DISTANCE); fiatDirectionInfo = toReceive; btcDirectionInfo = toSpend; } - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.btcAmount") + btcDirectionInfo, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.btcAmount") + btcDirectionInfo, formatter.formatCoinWithCode(trade.getTradeAmount())); - addConfirmationLabelLabel(gridPane, ++rowIndex, + addConfirmationLabelTextField(gridPane, ++rowIndex, VolumeUtil.formatVolumeLabel(offer.getCurrencyCode()) + fiatDirectionInfo, VolumeUtil.formatVolumeWithCode(trade.getTradeVolume())); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradePrice"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradePrice"), FormattingUtils.formatPrice(trade.getTradePrice())); String paymentMethodText = Res.get(offer.getPaymentMethod().getId()); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), paymentMethodText); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), paymentMethodText); // second group rows = 7; @@ -214,9 +213,9 @@ private void addContent() { rows++; addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.details"), Layout.GROUP_DISTANCE); - addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.get("shared.tradeId"), + addConfirmationLabelTextField(gridPane, rowIndex, Res.get("shared.tradeId"), trade.getId(), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradeDate"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradeDate"), DisplayUtils.formatDateTime(trade.getDate())); String securityDeposit = Res.getWithColAndCap("shared.buyer") + " " + @@ -225,29 +224,29 @@ private void addContent() { Res.getWithColAndCap("shared.seller") + " " + formatter.formatCoinWithCode(offer.getSellerSecurityDeposit()); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); String txFee = Res.get("shared.makerTxFee", formatter.formatCoinWithCode(offer.getTxFee())) + " / " + Res.get("shared.takerTxFee", formatter.formatCoinWithCode(trade.getTxFee().multiply(3))); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.txFee"), txFee); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.txFee"), txFee); NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress(); NodeAddress mediatorNodeAddress = trade.getMediatorNodeAddress(); if (arbitratorNodeAddress != null && mediatorNodeAddress != null) { - addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.agentAddresses"), arbitratorNodeAddress.getFullAddress() + " / " + mediatorNodeAddress.getFullAddress()); } if (trade.getTradingPeerNodeAddress() != null) - addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradingPeersOnion"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradingPeersOnion"), trade.getTradingPeerNodeAddress().getFullAddress()); if (showXmrProofResult) { // As the window is already overloaded we replace the tradingPeersPubKeyHash field with the auto-conf state // if XMR is the currency - addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("portfolio.pending.step3_seller.autoConf.status.label"), GUIUtil.getProofResultAsString(trade.getAssetTxProofResult())); } @@ -262,10 +261,9 @@ private void addContent() { ""; String postFix = buyersAccountAge.isEmpty() ? "" : " / " + buyersAccountAge; - TextFieldWithCopyIcon tf = addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.buyer")), - paymentDetails + postFix).second; - tf.setTooltip(new Tooltip(tf.getText())); + paymentDetails + postFix).second.setTooltip(new Tooltip(paymentDetails + postFix)); } if (sellerPaymentAccountPayload != null) { String paymentDetails = sellerPaymentAccountPayload.getPaymentDetails(); @@ -275,13 +273,12 @@ private void addContent() { Res.get("peerInfoIcon.tooltip.unknownAge") : ""; String postFix = sellersAccountAge.isEmpty() ? "" : " / " + sellersAccountAge; - TextFieldWithCopyIcon tf = addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentDetails", Res.get("shared.seller")), - paymentDetails + postFix).second; - tf.setTooltip(new Tooltip(tf.getText())); + paymentDetails + postFix).second.setTooltip(new Tooltip(paymentDetails + postFix)); } if (buyerPaymentAccountPayload == null && sellerPaymentAccountPayload == null) - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), Res.get(contract.getPaymentMethodId())); } @@ -327,7 +324,7 @@ private void addContent() { textArea.scrollTopProperty().addListener(changeListener); textArea.setScrollTop(30); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradeState"), trade.getState().getPhase().name()); + addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradeState"), trade.getState().getPhase().name()); } Tuple3 tuple = add2ButtonsWithBox(gridPane, ++rowIndex, diff --git a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java index 5313041a1de..2f00671c37f 100644 --- a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java +++ b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java @@ -22,7 +22,6 @@ import bisq.desktop.components.BisqTextArea; import bisq.desktop.components.BusyAnimation; import bisq.desktop.components.TableGroupHeadline; -import bisq.desktop.components.TextFieldWithIcon; import bisq.desktop.main.overlays.popups.Popup; import bisq.desktop.util.DisplayUtils; import bisq.desktop.util.GUIUtil; @@ -102,7 +101,7 @@ import javax.annotation.Nullable; public class ChatView extends AnchorPane { - public static final Logger log = LoggerFactory.getLogger(TextFieldWithIcon.class); + public static final Logger log = LoggerFactory.getLogger(ChatView.class); // UI private TextArea inputTextArea; @@ -416,7 +415,7 @@ protected void updateItem(ChatMessage message, boolean empty) { String metaData = DisplayUtils.formatDateTime(new Date(message.getDate())); if (!message.isSystemMessage()) metaData = (isMyMsg ? "Sent " : "Received ") + metaData - + (isMyMsg ? "" : " from " + counterpartyName); + + (isMyMsg ? "" : " from " + counterpartyName); headerLabel.setText(metaData); messageLabel.setText(message.getMessage()); attachmentsBox.getChildren().clear(); diff --git a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java index 472ee4d8620..6961273312f 100644 --- a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java @@ -393,6 +393,33 @@ public static Tuple2 addConfirmationLabelLabel(GridPane gridPane, return new Tuple2<>(label1, label2); } + public static Tuple2 addConfirmationLabelTextField(GridPane gridPane, + int rowIndex, + String title1, + String title2) { + return addConfirmationLabelTextField(gridPane, rowIndex, title1, title2, 0); + } + + public static Tuple2 addConfirmationLabelTextField(GridPane gridPane, + int rowIndex, + String title1, + String title2, + double top) { + Label label1 = addLabel(gridPane, rowIndex, title1); + label1.getStyleClass().add("confirmation-label"); + TextField label2 = new BisqTextField(title2); + gridPane.getChildren().add(label2); + label2.getStyleClass().add("confirmation-text-field-as-label"); + label2.setEditable(false); + label2.setFocusTraversable(false); + GridPane.setRowIndex(label2, rowIndex); + GridPane.setColumnIndex(label2, 1); + GridPane.setMargin(label1, new Insets(top, 0, 0, 0)); + GridPane.setHalignment(label1, HPos.LEFT); + GridPane.setMargin(label2, new Insets(top, 0, 0, 0)); + return new Tuple2<>(label1, label2); + } + public static Tuple2 addConfirmationLabelLabelWithCopyIcon(GridPane gridPane, int rowIndex, String title1, @@ -446,7 +473,6 @@ public static Tuple2 addTopLabelTextFieldWithIcon(Grid double top) { TextFieldWithIcon textFieldWithIcon = new TextFieldWithIcon(); - textFieldWithIcon.setMouseTransparent(true); textFieldWithIcon.setFocusTraversable(false); return new Tuple2<>(addTopLabelWithVBox(gridPane, rowIndex, columnIndex, title, textFieldWithIcon, top).first, textFieldWithIcon);