Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make arbitration chat messages selectable #1326

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,12 @@ public ListCell<DisputeCommunicationMessage> call(ListView<DisputeCommunicationM
statusIcon.getStyleClass().add("small-text");
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
messageAnchorPane.getChildren().addAll(bg, arrow, headerLabel, messageLabel, copyIcon, attachmentsBox, statusIcon);
messageLabel.setOnMouseClicked(event -> {
if (2 > event.getClickCount()) {
return;
}
GUIUtil.showSelectableTextModal(headerLabel.getText(), messageLabel.getText());
});
}

@Override
Expand Down
30 changes: 23 additions & 7 deletions gui/src/main/java/io/bisq/gui/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@
import io.bisq.gui.main.overlays.popups.Popup;
import io.bisq.network.p2p.P2PService;
import javafx.beans.property.DoubleProperty;
import javafx.collections.ObservableList;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ScrollBar;
import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.stage.*;
import javafx.util.StringConverter;
import lombok.extern.slf4j.Slf4j;
import org.bitcoinj.core.Address;
Expand All @@ -64,7 +63,6 @@
import org.bitcoinj.uri.BitcoinURI;
import org.bitcoinj.wallet.DeterministicSeed;

import javax.annotation.Nullable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand All @@ -73,9 +71,9 @@
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.nio.file.Paths;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Slf4j
public class GUIUtil {
Expand Down Expand Up @@ -446,4 +444,22 @@ public static void restoreSeedWords(DeterministicSeed seed, WalletsManager walle
.show();
}));
}

public static void showSelectableTextModal(String title, String text) {
TextArea textArea = new TextArea();
textArea.setText(text);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setPrefSize(800, 600);

Scene scene = new Scene(textArea);
Stage stage = new Stage();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this code comes from ContractWindow.java.
That class also sets owner (I'm not sure what that is for).
https://github.com/bisq-network/exchange/blob/master/gui/src/main/java/io/bisq/gui/main/overlays/windows/ContractWindow.java#L205

if (null != title) {
stage.setTitle(title);
}
stage.setScene(scene);
stage.initModality(Modality.NONE);
stage.initStyle(StageStyle.UTILITY);
stage.show();
}
}