Skip to content

Commit

Permalink
Merge pull request #3680 from stejbac/fix-malformed-chat-message-bubbles
Browse files Browse the repository at this point in the history
Fix #3662: Malformed trade chat & dispute speech bubbles
  • Loading branch information
ripcurlx authored Nov 26, 2019
2 parents a7b9cfd + 64a548a commit c705853
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions desktop/src/main/java/bisq/desktop/main/shared/ChatView.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public ListCell<ChatMessage> call(ListView<ChatMessage> list) {
}

@Override
public void updateItem(ChatMessage message, boolean empty) {
protected void updateItem(ChatMessage message, boolean empty) {
super.updateItem(message, empty);
if (message != null && !empty) {
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(messageLabel.getText()));
Expand All @@ -312,6 +312,14 @@ public void updateItem(ChatMessage message, boolean empty) {
messageAnchorPane.prefWidthProperty()
.bind(messageListView.widthProperty().subtract(padding + GUIUtil.getScrollbarWidth(messageListView)));

AnchorPane.clearConstraints(bg);
AnchorPane.clearConstraints(headerLabel);
AnchorPane.clearConstraints(arrow);
AnchorPane.clearConstraints(messageLabel);
AnchorPane.clearConstraints(copyIcon);
AnchorPane.clearConstraints(statusHBox);
AnchorPane.clearConstraints(attachmentsBox);

AnchorPane.setTopAnchor(bg, 15d);
AnchorPane.setBottomAnchor(bg, bottomBorder);
AnchorPane.setTopAnchor(headerLabel, 0d);
Expand Down Expand Up @@ -381,7 +389,6 @@ public void updateItem(ChatMessage message, boolean empty) {
AnchorPane.setRightAnchor(copyIcon, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding);
AnchorPane.clearConstraints(statusHBox);
AnchorPane.setLeftAnchor(statusHBox, padding);
} else if (senderIsTrader) {
AnchorPane.setLeftAnchor(headerLabel, padding + arrowWidth);
Expand All @@ -393,19 +400,17 @@ public void updateItem(ChatMessage message, boolean empty) {
AnchorPane.setRightAnchor(copyIcon, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.setRightAnchor(attachmentsBox, padding);
AnchorPane.clearConstraints(statusHBox);
AnchorPane.setRightAnchor(statusHBox, padding);
} else {
AnchorPane.setRightAnchor(headerLabel, padding + arrowWidth);
AnchorPane.setLeftAnchor(bg, border);
AnchorPane.setRightAnchor(bg, border + arrowWidth);
AnchorPane.setLeftAnchor(bg, border);
AnchorPane.setRightAnchor(arrow, border);
AnchorPane.setLeftAnchor(messageLabel, padding);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight + arrowWidth);
AnchorPane.setRightAnchor(copyIcon, padding + arrowWidth);
AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.clearConstraints(statusHBox);
AnchorPane.setLeftAnchor(statusHBox, padding);
}
AnchorPane.setBottomAnchor(statusHBox, 7d);
Expand Down Expand Up @@ -453,14 +458,6 @@ public void updateItem(ChatMessage message, boolean empty) {

messageAnchorPane.prefWidthProperty().unbind();

AnchorPane.clearConstraints(bg);
AnchorPane.clearConstraints(headerLabel);
AnchorPane.clearConstraints(arrow);
AnchorPane.clearConstraints(messageLabel);
AnchorPane.clearConstraints(copyIcon);
AnchorPane.clearConstraints(statusHBox);
AnchorPane.clearConstraints(attachmentsBox);

copyIcon.setOnMouseClicked(null);
messageLabel.setOnMouseClicked(null);
setGraphic(null);
Expand Down

0 comments on commit c705853

Please sign in to comment.