Apply suggestions from @CyB3RC0nN0R's code review
This commit is contained in:
parent
d80bc39221
commit
bbd5f61486
@ -31,7 +31,7 @@ public class MessageListCell extends ListCell<Message> {
|
||||
|
||||
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm");
|
||||
private static Map<MessageStatus, Image> statusImages;
|
||||
private static User user;
|
||||
private static User client;
|
||||
|
||||
static {
|
||||
try {
|
||||
@ -55,7 +55,7 @@ public class MessageListCell extends ListCell<Message> {
|
||||
setGraphic(null);
|
||||
} else {
|
||||
final var cell = new VBox(new Label(dateFormat.format(message.getCreationDate())), new Label(message.getText()));
|
||||
if (message.getRecipientID() == user.getID()) {
|
||||
if (message.getRecipientID() == client.getID()) {
|
||||
cell.getChildren().add(new Label("", new ImageView(statusImages.get(message.getStatus()))));
|
||||
cell.getStyleClass().add("own-message");
|
||||
} else cell.getStyleClass().add("received-message");
|
||||
@ -65,8 +65,8 @@ public class MessageListCell extends ListCell<Message> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user the user to set
|
||||
* @param client the user who chats with another person
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public static void setUser(User user) { MessageListCell.user = user; }
|
||||
public static void setUser(User client) { MessageListCell.client = client; }
|
||||
}
|
||||
|
@ -342,14 +342,12 @@ public final class ChatScene {
|
||||
|
||||
@FXML
|
||||
private void copyAndPostMessage() {
|
||||
try {
|
||||
final var messageText = messageTextArea.getText();
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null);
|
||||
postMessage();
|
||||
messageTextArea.setText(messageText);
|
||||
updateRemainingCharsLabel();
|
||||
postButton.setDisable(messageText.isBlank());
|
||||
} catch (final NullPointerException e) {}
|
||||
final var messageText = messageTextArea.getText();
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null);
|
||||
postMessage();
|
||||
messageTextArea.setText(messageText);
|
||||
updateRemainingCharsLabel();
|
||||
postButton.setDisable(messageText.isBlank());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user