update all copy icons

This commit is contained in:
woodser 2025-05-28 18:18:46 -04:00
parent 84a540a717
commit b71d156aaf
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF
12 changed files with 117 additions and 89 deletions

View file

@ -78,22 +78,22 @@ public class AddressTextField extends AnchorPane {
AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN); AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN);
extWalletIcon.setOnMouseClicked(e -> openWallet()); extWalletIcon.setOnMouseClicked(e -> openWallet());
Label copyIcon = new Label(); Label copyLabel = new Label();
copyIcon.setLayoutY(Layout.FLOATING_ICON_Y); copyLabel.setLayoutY(Layout.FLOATING_ICON_Y);
copyIcon.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon", "highlight");
Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard"))); Tooltip.install(copyLabel, new Tooltip(Res.get("addressTextField.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyLabel.setGraphic(GUIUtil.getCopyIcon());
copyIcon.setOnMouseClicked(e -> { copyLabel.setOnMouseClicked(e -> {
if (address.get() != null && address.get().length() > 0) if (address.get() != null && address.get().length() > 0)
Utilities.copyToClipboard(address.get()); Utilities.copyToClipboard(address.get());
}); });
AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(copyLabel, 30.0);
AnchorPane.setRightAnchor(extWalletIcon, 5.0); AnchorPane.setRightAnchor(extWalletIcon, 5.0);
AnchorPane.setRightAnchor(textField, 55.0); AnchorPane.setRightAnchor(textField, 55.0);
AnchorPane.setLeftAnchor(textField, 0.0); AnchorPane.setLeftAnchor(textField, 0.0);
getChildren().addAll(textField, copyIcon, extWalletIcon); getChildren().addAll(textField, copyLabel, extWalletIcon);
} }
private void openWallet() { private void openWallet() {

View file

@ -23,6 +23,7 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
import haveno.common.util.Utilities; import haveno.common.util.Utilities;
import haveno.core.locale.Res; import haveno.core.locale.Res;
import haveno.core.user.Preferences; import haveno.core.user.Preferences;
import haveno.desktop.util.GUIUtil;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
@ -38,19 +39,19 @@ public class ExplorerAddressTextField extends AnchorPane {
@Getter @Getter
private final TextField textField; private final TextField textField;
private final Label copyIcon, missingAddressWarningIcon; private final Label copyLabel, missingAddressWarningIcon;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public ExplorerAddressTextField() { public ExplorerAddressTextField() {
copyIcon = new Label(); copyLabel = new Label();
copyIcon.setLayoutY(3); copyLabel.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon", "highlight");
copyIcon.setTooltip(new Tooltip(Res.get("explorerAddressTextField.copyToClipboard"))); copyLabel.setTooltip(new Tooltip(Res.get("explorerAddressTextField.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyLabel.setGraphic(GUIUtil.getCopyIcon());
AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(copyLabel, 30.0);
Tooltip tooltip = new Tooltip(Res.get("explorerAddressTextField.blockExplorerIcon.tooltip")); Tooltip tooltip = new Tooltip(Res.get("explorerAddressTextField.blockExplorerIcon.tooltip"));
@ -71,27 +72,27 @@ public class ExplorerAddressTextField extends AnchorPane {
AnchorPane.setRightAnchor(textField, 80.0); AnchorPane.setRightAnchor(textField, 80.0);
AnchorPane.setLeftAnchor(textField, 0.0); AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get()); textField.focusTraversableProperty().set(focusTraversableProperty().get());
getChildren().addAll(textField, missingAddressWarningIcon, copyIcon); getChildren().addAll(textField, missingAddressWarningIcon, copyLabel);
} }
public void setup(@Nullable String address) { public void setup(@Nullable String address) {
if (address == null) { if (address == null) {
textField.setText(Res.get("shared.na")); textField.setText(Res.get("shared.na"));
textField.setId("address-text-field-error"); textField.setId("address-text-field-error");
copyIcon.setVisible(false); copyLabel.setVisible(false);
copyIcon.setManaged(false); copyLabel.setManaged(false);
missingAddressWarningIcon.setVisible(true); missingAddressWarningIcon.setVisible(true);
missingAddressWarningIcon.setManaged(true); missingAddressWarningIcon.setManaged(true);
return; return;
} }
textField.setText(address); textField.setText(address);
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(address)); copyLabel.setOnMouseClicked(e -> Utilities.copyToClipboard(address));
} }
public void cleanup() { public void cleanup() {
textField.setOnMouseClicked(null); textField.setOnMouseClicked(null);
copyIcon.setOnMouseClicked(null); copyLabel.setOnMouseClicked(null);
textField.setText(""); textField.setText("");
} }
} }

View file

@ -17,9 +17,9 @@
package haveno.desktop.components; package haveno.desktop.components;
import de.jensd.fx.fontawesome.AwesomeIcon;
import haveno.common.util.Utilities; import haveno.common.util.Utilities;
import haveno.core.locale.Res; import haveno.core.locale.Res;
import haveno.desktop.util.GUIUtil;
import haveno.desktop.util.Layout; import haveno.desktop.util.Layout;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
@ -30,8 +30,6 @@ import javafx.scene.layout.AnchorPane;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import static haveno.desktop.util.FormBuilder.getIcon;
public class FundsTextField extends InfoTextField { public class FundsTextField extends InfoTextField {
public static final Logger log = LoggerFactory.getLogger(FundsTextField.class); public static final Logger log = LoggerFactory.getLogger(FundsTextField.class);
@ -47,11 +45,12 @@ public class FundsTextField extends InfoTextField {
textField.textProperty().unbind(); textField.textProperty().unbind();
textField.textProperty().bind(Bindings.concat(textProperty())); // TODO: removed `, " ", fundsStructure` for haveno to fix "Funds needed: .123 XMR (null)" bug textField.textProperty().bind(Bindings.concat(textProperty())); // TODO: removed `, " ", fundsStructure` for haveno to fix "Funds needed: .123 XMR (null)" bug
Label copyIcon = getIcon(AwesomeIcon.COPY); Label copyLabel = new Label();
copyIcon.setLayoutY(Layout.FLOATING_ICON_Y); copyLabel.setLayoutY(Layout.FLOATING_ICON_Y);
copyIcon.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon", "highlight");
Tooltip.install(copyIcon, new Tooltip(Res.get("shared.copyToClipboard"))); Tooltip.install(copyLabel, new Tooltip(Res.get("shared.copyToClipboard")));
copyIcon.setOnMouseClicked(e -> { copyLabel.setGraphic(GUIUtil.getCopyIcon());
copyLabel.setOnMouseClicked(e -> {
String text = getText(); String text = getText();
if (text != null && text.length() > 0) { if (text != null && text.length() > 0) {
String copyText; String copyText;
@ -65,11 +64,11 @@ public class FundsTextField extends InfoTextField {
} }
}); });
AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(copyLabel, 30.0);
AnchorPane.setRightAnchor(infoIcon, 62.0); AnchorPane.setRightAnchor(infoIcon, 62.0);
AnchorPane.setRightAnchor(textField, 55.0); AnchorPane.setRightAnchor(textField, 55.0);
getChildren().add(copyIcon); getChildren().add(copyLabel);
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -59,7 +59,7 @@ public class InfoTextField extends AnchorPane {
textField.setId("info-field"); textField.setId("info-field");
infoIcon = getIcon(AwesomeIcon.INFO_SIGN); infoIcon = getIcon(AwesomeIcon.INFO_SIGN);
infoIcon.setLayoutY(Layout.FLOATING_ICON_Y); infoIcon.setLayoutY(Layout.FLOATING_ICON_Y - 2);
infoIcon.getStyleClass().addAll("icon", "info"); infoIcon.getStyleClass().addAll("icon", "info");
AnchorPane.setRightAnchor(infoIcon, 7.0); AnchorPane.setRightAnchor(infoIcon, 7.0);

View file

@ -18,10 +18,9 @@
package haveno.desktop.components; package haveno.desktop.components;
import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXTextField;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import haveno.common.util.Utilities; import haveno.common.util.Utilities;
import haveno.core.locale.Res; import haveno.core.locale.Res;
import haveno.desktop.util.GUIUtil;
import haveno.desktop.util.Layout; import haveno.desktop.util.Layout;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty; import javafx.beans.property.StringProperty;
@ -46,13 +45,13 @@ public class TextFieldWithCopyIcon extends AnchorPane {
} }
public TextFieldWithCopyIcon(String customStyleClass) { public TextFieldWithCopyIcon(String customStyleClass) {
Label copyIcon = new Label(); Label copyLabel = new Label();
copyIcon.setLayoutY(Layout.FLOATING_ICON_Y); copyLabel.setLayoutY(Layout.FLOATING_ICON_Y);
copyIcon.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon", "highlight");
if (customStyleClass != null) copyIcon.getStyleClass().add(customStyleClass + "-icon"); if (customStyleClass != null) copyLabel.getStyleClass().add(customStyleClass + "-icon");
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); copyLabel.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyLabel.setGraphic(GUIUtil.getCopyIcon());
copyIcon.setOnMouseClicked(e -> { copyLabel.setOnMouseClicked(e -> {
String text = getText(); String text = getText();
if (text != null && text.length() > 0) { if (text != null && text.length() > 0) {
String copyText; String copyText;
@ -78,15 +77,15 @@ public class TextFieldWithCopyIcon extends AnchorPane {
textField.setEditable(false); textField.setEditable(false);
if (customStyleClass != null) textField.getStyleClass().add(customStyleClass); if (customStyleClass != null) textField.getStyleClass().add(customStyleClass);
textField.textProperty().bindBidirectional(text); textField.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(copyIcon, 5.0); AnchorPane.setRightAnchor(copyLabel, 5.0);
AnchorPane.setRightAnchor(textField, 30.0); AnchorPane.setRightAnchor(textField, 30.0);
AnchorPane.setLeftAnchor(textField, 0.0); AnchorPane.setLeftAnchor(textField, 0.0);
AnchorPane.setTopAnchor(copyIcon, 0.0); AnchorPane.setTopAnchor(copyLabel, 0.0);
AnchorPane.setBottomAnchor(copyIcon, 0.0); AnchorPane.setBottomAnchor(copyLabel, 0.0);
AnchorPane.setTopAnchor(textField, 0.0); AnchorPane.setTopAnchor(textField, 0.0);
AnchorPane.setBottomAnchor(textField, 0.0); AnchorPane.setBottomAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get()); textField.focusTraversableProperty().set(focusTraversableProperty().get());
getChildren().addAll(textField, copyIcon); getChildren().addAll(textField, copyLabel);
} }
public void setPromptText(String value) { public void setPromptText(String value) {

View file

@ -52,7 +52,7 @@ public class TxIdTextField extends AnchorPane {
private final TextField textField; private final TextField textField;
private final Tooltip progressIndicatorTooltip; private final Tooltip progressIndicatorTooltip;
private final TxConfidenceIndicator txConfidenceIndicator; private final TxConfidenceIndicator txConfidenceIndicator;
private final Label copyIcon, blockExplorerIcon, missingTxWarningIcon; private final Label copyLabel, blockExplorerIcon, missingTxWarningIcon;
private MoneroWalletListener walletListener; private MoneroWalletListener walletListener;
private ChangeListener<Number> tradeListener; private ChangeListener<Number> tradeListener;
@ -75,12 +75,12 @@ public class TxIdTextField extends AnchorPane {
progressIndicatorTooltip = new Tooltip("-"); progressIndicatorTooltip = new Tooltip("-");
txConfidenceIndicator.setTooltip(progressIndicatorTooltip); txConfidenceIndicator.setTooltip(progressIndicatorTooltip);
copyIcon = new Label(); copyLabel = new Label();
copyIcon.setLayoutY(Layout.FLOATING_ICON_Y); copyLabel.setLayoutY(Layout.FLOATING_ICON_Y);
copyIcon.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon", "highlight");
copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip"))); copyLabel.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyLabel.setGraphic(GUIUtil.getCopyIcon());
AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(copyLabel, 30.0);
Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip")); Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));
@ -109,7 +109,7 @@ public class TxIdTextField extends AnchorPane {
AnchorPane.setRightAnchor(textField, 80.0); AnchorPane.setRightAnchor(textField, 80.0);
AnchorPane.setLeftAnchor(textField, 0.0); AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get()); textField.focusTraversableProperty().set(focusTraversableProperty().get());
getChildren().addAll(textField, missingTxWarningIcon, blockExplorerIcon, copyIcon, txConfidenceIndicator); getChildren().addAll(textField, missingTxWarningIcon, blockExplorerIcon, copyLabel, txConfidenceIndicator);
} }
public void setup(@Nullable String txId) { public void setup(@Nullable String txId) {
@ -132,8 +132,8 @@ public class TxIdTextField extends AnchorPane {
textField.setId("address-text-field-error"); textField.setId("address-text-field-error");
blockExplorerIcon.setVisible(false); blockExplorerIcon.setVisible(false);
blockExplorerIcon.setManaged(false); blockExplorerIcon.setManaged(false);
copyIcon.setVisible(false); copyLabel.setVisible(false);
copyIcon.setManaged(false); copyLabel.setManaged(false);
txConfidenceIndicator.setVisible(false); txConfidenceIndicator.setVisible(false);
missingTxWarningIcon.setVisible(true); missingTxWarningIcon.setVisible(true);
missingTxWarningIcon.setManaged(true); missingTxWarningIcon.setManaged(true);
@ -159,7 +159,7 @@ public class TxIdTextField extends AnchorPane {
textField.setText(txId); textField.setText(txId);
textField.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId)); textField.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId)); blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(txId)); copyLabel.setOnMouseClicked(e -> Utilities.copyToClipboard(txId));
txConfidenceIndicator.setVisible(true); txConfidenceIndicator.setVisible(true);
// update off main thread // update off main thread
@ -178,7 +178,7 @@ public class TxIdTextField extends AnchorPane {
trade = null; trade = null;
textField.setOnMouseClicked(null); textField.setOnMouseClicked(null);
blockExplorerIcon.setOnMouseClicked(null); blockExplorerIcon.setOnMouseClicked(null);
copyIcon.setOnMouseClicked(null); copyLabel.setOnMouseClicked(null);
textField.setText(""); textField.setText("");
} }

View file

@ -39,7 +39,7 @@
-fx-text-fill: -bs-color-primary; -fx-text-fill: -bs-color-primary;
} }
.highlight, .highlight-static { .highlight, .highlight-static, .highlight.label .glyph-icon {
-fx-text-fill: -fx-accent; -fx-text-fill: -fx-accent;
-fx-fill: -fx-accent; -fx-fill: -fx-accent;
} }
@ -973,6 +973,10 @@ tree-table-view:focused {
-fx-text-fill: -bs-background-color; -fx-text-fill: -bs-background-color;
} }
.copy-icon-disputes.label .glyph-icon {
-fx-fill: -bs-background-color;
}
.copy-icon:hover { .copy-icon:hover {
-fx-text-fill: -bs-text-color; -fx-text-fill: -bs-text-color;
} }
@ -2257,6 +2261,13 @@ textfield */
-fx-text-fill: -bs-rd-error-red; -fx-text-fill: -bs-rd-error-red;
} }
.popup-headline-information.label .glyph-icon,
.popup-headline-warning.label .glyph-icon,
.popup-icon-information.label .glyph-icon,
.popup-icon-warning.label .glyph-icon {
-fx-fill: -bs-color-primary;
}
.popup-bg { .popup-bg {
-fx-font-size: 1.077em; -fx-font-size: 1.077em;
-fx-background-color: -bs-color-background-popup-overlay; -fx-background-color: -bs-color-background-popup-overlay;
@ -2386,10 +2397,18 @@ textfield */
-fx-text-fill: -bs-text-color; -fx-text-fill: -bs-text-color;
} }
.message.label .glyph-icon {
-fx-fill: -bs-text-color;
}
.my-message { .my-message {
-fx-text-fill: -bs-background-color; -fx-text-fill: -bs-background-color;
} }
.my-message.label .glyph-icon {
-fx-fill: -bs-background-color;
}
.message-header { .message-header {
-fx-text-fill: -bs-color-gray-3; -fx-text-fill: -bs-color-gray-3;
-fx-font-size: 0.846em; -fx-font-size: 0.846em;

View file

@ -19,6 +19,8 @@ package haveno.desktop.main.overlays;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import haveno.common.Timer; import haveno.common.Timer;
import haveno.common.UserThread; import haveno.common.UserThread;
import haveno.common.config.Config; import haveno.common.config.Config;
@ -168,7 +170,7 @@ public abstract class Overlay<T extends Overlay<T>> {
protected boolean showScrollPane = false; protected boolean showScrollPane = false;
protected TextArea messageTextArea; protected TextArea messageTextArea;
protected Label headlineIcon, copyIcon, headLineLabel; protected Label headlineIcon, copyLabel, headLineLabel;
protected String headLine, message, closeButtonText, actionButtonText, protected String headLine, message, closeButtonText, actionButtonText,
secondaryActionButtonText, dontShowAgainId, dontShowAgainText, secondaryActionButtonText, dontShowAgainId, dontShowAgainText,
truncatedMessage; truncatedMessage;
@ -766,12 +768,13 @@ public abstract class Overlay<T extends Overlay<T>> {
if (headLineLabel != null) { if (headLineLabel != null) {
if (copyIcon != null) { if (copyLabel != null) {
copyIcon.getStyleClass().add("popup-icon-information"); copyLabel.getStyleClass().add("popup-icon-information");
copyIcon.setManaged(true); copyLabel.setManaged(true);
copyIcon.setVisible(true); copyLabel.setVisible(true);
FormBuilder.getIconForLabel(AwesomeIcon.COPY, copyIcon, "1.1em"); MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.2em");
copyIcon.addEventHandler(MOUSE_CLICKED, mouseEvent -> { copyLabel.setGraphic(copyIcon);
copyLabel.addEventHandler(MOUSE_CLICKED, mouseEvent -> {
if (message != null) { if (message != null) {
Utilities.copyToClipboard(getClipboardText()); Utilities.copyToClipboard(getClipboardText());
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard")); Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
@ -838,15 +841,15 @@ public abstract class Overlay<T extends Overlay<T>> {
headLineLabel.setStyle(headlineStyle); headLineLabel.setStyle(headlineStyle);
if (message != null) { if (message != null) {
copyIcon = new Label(); copyLabel = new Label();
copyIcon.setManaged(false); copyLabel.setManaged(false);
copyIcon.setVisible(false); copyLabel.setVisible(false);
copyIcon.setPadding(new Insets(3)); copyLabel.setPadding(new Insets(3));
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); copyLabel.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
final Pane spacer = new Pane(); final Pane spacer = new Pane();
HBox.setHgrow(spacer, Priority.ALWAYS); HBox.setHgrow(spacer, Priority.ALWAYS);
spacer.setMinSize(Layout.PADDING, 1); spacer.setMinSize(Layout.PADDING, 1);
hBox.getChildren().addAll(headlineIcon, headLineLabel, spacer, copyIcon); hBox.getChildren().addAll(headlineIcon, headLineLabel, spacer, copyLabel);
} else { } else {
hBox.getChildren().addAll(headlineIcon, headLineLabel); hBox.getChildren().addAll(headlineIcon, headLineLabel);
} }

View file

@ -418,7 +418,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
// add copy button // add copy button
Label copyLabel = new Label(); Label copyLabel = new Label();
copyLabel.getStyleClass().addAll("icon", "highlight"); copyLabel.getStyleClass().addAll("icon");
copyLabel.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); copyLabel.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.2em"); MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.2em");
copyIcon.setFill(Color.WHITE); copyIcon.setFill(Color.WHITE);

View file

@ -43,7 +43,8 @@ import com.google.common.io.ByteStreams;
import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.scene.Node; import javafx.scene.Node;
@ -272,7 +273,7 @@ public class ChatView extends AnchorPane {
ImageView arrow = new ImageView(); ImageView arrow = new ImageView();
Label headerLabel = new AutoTooltipLabel(); Label headerLabel = new AutoTooltipLabel();
Label messageLabel = new AutoTooltipLabel(); Label messageLabel = new AutoTooltipLabel();
Label copyIcon = new Label(); Label copyLabel = new Label();
HBox attachmentsBox = new HBox(); HBox attachmentsBox = new HBox();
AnchorPane messageAnchorPane = new AnchorPane(); AnchorPane messageAnchorPane = new AnchorPane();
Label statusIcon = new Label(); Label statusIcon = new Label();
@ -293,10 +294,10 @@ public class ChatView extends AnchorPane {
statusIcon.getStyleClass().add("small-text"); statusIcon.getStyleClass().add("small-text");
statusInfoLabel.getStyleClass().add("small-text"); statusInfoLabel.getStyleClass().add("small-text");
statusInfoLabel.setPadding(new Insets(3, 0, 0, 0)); statusInfoLabel.setPadding(new Insets(3, 0, 0, 0));
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); copyLabel.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
statusHBox.setSpacing(5); statusHBox.setSpacing(5);
statusHBox.getChildren().addAll(statusIcon, statusInfoLabel); statusHBox.getChildren().addAll(statusIcon, statusInfoLabel);
messageAnchorPane.getChildren().addAll(bg, arrow, headerLabel, messageLabel, copyIcon, attachmentsBox, statusHBox); messageAnchorPane.getChildren().addAll(bg, arrow, headerLabel, messageLabel, copyLabel, attachmentsBox, statusHBox);
} }
@Override @Override
@ -304,7 +305,7 @@ public class ChatView extends AnchorPane {
UserThread.execute(() -> { UserThread.execute(() -> {
super.updateItem(message, empty); super.updateItem(message, empty);
if (message != null && !empty) { if (message != null && !empty) {
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(messageLabel.getText())); copyLabel.setOnMouseClicked(e -> Utilities.copyToClipboard(messageLabel.getText()));
messageLabel.setOnMouseClicked(event -> { messageLabel.setOnMouseClicked(event -> {
if (2 > event.getClickCount()) { if (2 > event.getClickCount()) {
return; return;
@ -320,7 +321,7 @@ public class ChatView extends AnchorPane {
AnchorPane.clearConstraints(headerLabel); AnchorPane.clearConstraints(headerLabel);
AnchorPane.clearConstraints(arrow); AnchorPane.clearConstraints(arrow);
AnchorPane.clearConstraints(messageLabel); AnchorPane.clearConstraints(messageLabel);
AnchorPane.clearConstraints(copyIcon); AnchorPane.clearConstraints(copyLabel);
AnchorPane.clearConstraints(statusHBox); AnchorPane.clearConstraints(statusHBox);
AnchorPane.clearConstraints(attachmentsBox); AnchorPane.clearConstraints(attachmentsBox);
@ -329,7 +330,7 @@ public class ChatView extends AnchorPane {
AnchorPane.setTopAnchor(headerLabel, 0d); AnchorPane.setTopAnchor(headerLabel, 0d);
AnchorPane.setBottomAnchor(arrow, bottomBorder + 5d); AnchorPane.setBottomAnchor(arrow, bottomBorder + 5d);
AnchorPane.setTopAnchor(messageLabel, 25d); AnchorPane.setTopAnchor(messageLabel, 25d);
AnchorPane.setTopAnchor(copyIcon, 25d); AnchorPane.setTopAnchor(copyLabel, 25d);
AnchorPane.setBottomAnchor(attachmentsBox, bottomBorder + 10); AnchorPane.setBottomAnchor(attachmentsBox, bottomBorder + 10);
boolean senderIsTrader = message.isSenderIsTrader(); boolean senderIsTrader = message.isSenderIsTrader();
@ -342,20 +343,20 @@ public class ChatView extends AnchorPane {
headerLabel.getStyleClass().removeAll("message-header", "my-message-header", "success-text", headerLabel.getStyleClass().removeAll("message-header", "my-message-header", "success-text",
"highlight-static"); "highlight-static");
messageLabel.getStyleClass().removeAll("my-message", "message"); messageLabel.getStyleClass().removeAll("my-message", "message");
copyIcon.getStyleClass().removeAll("my-message", "message"); copyLabel.getStyleClass().removeAll("my-message", "message");
if (message.isSystemMessage()) { if (message.isSystemMessage()) {
headerLabel.getStyleClass().addAll("message-header", "success-text"); headerLabel.getStyleClass().addAll("message-header", "success-text");
bg.setId("message-bubble-green"); bg.setId("message-bubble-green");
messageLabel.getStyleClass().add("my-message"); messageLabel.getStyleClass().add("my-message");
copyIcon.getStyleClass().add("my-message"); copyLabel.getStyleClass().add("my-message");
message.addWeakMessageStateListener(() -> UserThread.execute(() -> updateMsgState(message))); message.addWeakMessageStateListener(() -> UserThread.execute(() -> updateMsgState(message)));
updateMsgState(message); updateMsgState(message);
} else if (isMyMsg) { } else if (isMyMsg) {
headerLabel.getStyleClass().add("my-message-header"); headerLabel.getStyleClass().add("my-message-header");
bg.setId("message-bubble-blue"); bg.setId("message-bubble-blue");
messageLabel.getStyleClass().add("my-message"); messageLabel.getStyleClass().add("my-message");
copyIcon.getStyleClass().add("my-message"); copyLabel.getStyleClass().add("my-message");
if (supportSession.isClient()) if (supportSession.isClient())
arrow.setId("bubble_arrow_blue_left"); arrow.setId("bubble_arrow_blue_left");
else else
@ -376,7 +377,7 @@ public class ChatView extends AnchorPane {
headerLabel.getStyleClass().add("message-header"); headerLabel.getStyleClass().add("message-header");
bg.setId("message-bubble-grey"); bg.setId("message-bubble-grey");
messageLabel.getStyleClass().add("message"); messageLabel.getStyleClass().add("message");
copyIcon.getStyleClass().add("message"); copyLabel.getStyleClass().add("message");
if (supportSession.isClient()) if (supportSession.isClient())
arrow.setId("bubble_arrow_grey_right"); arrow.setId("bubble_arrow_grey_right");
else else
@ -390,7 +391,7 @@ public class ChatView extends AnchorPane {
AnchorPane.setRightAnchor(bg, border); AnchorPane.setRightAnchor(bg, border);
AnchorPane.setLeftAnchor(messageLabel, padding); AnchorPane.setLeftAnchor(messageLabel, padding);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight); AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight);
AnchorPane.setRightAnchor(copyIcon, padding); AnchorPane.setRightAnchor(copyLabel, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding); AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding); AnchorPane.setRightAnchor(attachmentsBox, padding);
AnchorPane.setLeftAnchor(statusHBox, padding); AnchorPane.setLeftAnchor(statusHBox, padding);
@ -401,7 +402,7 @@ public class ChatView extends AnchorPane {
AnchorPane.setLeftAnchor(arrow, border); AnchorPane.setLeftAnchor(arrow, border);
AnchorPane.setLeftAnchor(messageLabel, padding + arrowWidth); AnchorPane.setLeftAnchor(messageLabel, padding + arrowWidth);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight); AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight);
AnchorPane.setRightAnchor(copyIcon, padding); AnchorPane.setRightAnchor(copyLabel, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding + arrowWidth); AnchorPane.setLeftAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.setRightAnchor(attachmentsBox, padding); AnchorPane.setRightAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(statusHBox, padding); AnchorPane.setRightAnchor(statusHBox, padding);
@ -412,7 +413,7 @@ public class ChatView extends AnchorPane {
AnchorPane.setRightAnchor(arrow, border); AnchorPane.setRightAnchor(arrow, border);
AnchorPane.setLeftAnchor(messageLabel, padding); AnchorPane.setLeftAnchor(messageLabel, padding);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight + arrowWidth); AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight + arrowWidth);
AnchorPane.setRightAnchor(copyIcon, padding + arrowWidth); AnchorPane.setRightAnchor(copyLabel, padding + arrowWidth);
AnchorPane.setLeftAnchor(attachmentsBox, padding); AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding + arrowWidth); AnchorPane.setRightAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.setLeftAnchor(statusHBox, padding); AnchorPane.setLeftAnchor(statusHBox, padding);
@ -455,8 +456,9 @@ public class ChatView extends AnchorPane {
} }
// Need to set it here otherwise style is not correct // Need to set it here otherwise style is not correct
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY, "16.0"); copyLabel.getStyleClass().addAll("icon", "copy-icon-disputes");
copyIcon.getStyleClass().addAll("icon", "copy-icon-disputes"); MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "16.0");
copyLabel.setGraphic(copyIcon);
// TODO There are still some cell rendering issues on updates // TODO There are still some cell rendering issues on updates
setGraphic(messageAnchorPane); setGraphic(messageAnchorPane);
@ -466,7 +468,7 @@ public class ChatView extends AnchorPane {
messageAnchorPane.prefWidthProperty().unbind(); messageAnchorPane.prefWidthProperty().unbind();
copyIcon.setOnMouseClicked(null); copyLabel.setOnMouseClicked(null);
messageLabel.setOnMouseClicked(null); messageLabel.setOnMouseClicked(null);
setGraphic(null); setGraphic(null);
} }

View file

@ -28,6 +28,7 @@ import com.googlecode.jcsv.writer.internal.CSVWriterBuilder;
import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import haveno.common.UserThread; import haveno.common.UserThread;
import haveno.common.config.Config; import haveno.common.config.Config;
import haveno.common.file.CorruptedStorageFileHandler; import haveno.common.file.CorruptedStorageFileHandler;
@ -1275,4 +1276,8 @@ public class GUIUtil {
lockLabel.setStyle(lockLabel.getStyle() + " -fx-text-fill: white;"); lockLabel.setStyle(lockLabel.getStyle() + " -fx-text-fill: white;");
return lockLabel; return lockLabel;
} }
public static MaterialDesignIconView getCopyIcon() {
return new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.35em");
}
} }

View file

@ -41,5 +41,5 @@ public class Layout {
public static final double GRID_GAP = 5d; public static final double GRID_GAP = 5d;
public static final double LIST_ROW_HEIGHT = 34; public static final double LIST_ROW_HEIGHT = 34;
public static final double ROUNDED_ARC = 20; public static final double ROUNDED_ARC = 20;
public static final double FLOATING_ICON_Y = 7; // adjust when .jfx-text-field padding is changed for right icons public static final double FLOATING_ICON_Y = 9; // adjust when .jfx-text-field padding is changed for right icons
} }