Improved message coloring, messageStatus display only for own messages
additionally loaded the message status icons smaller and (visually) hid the vertical scrollbars (they can still be used, but cannot be seen). Lastly checked all context menu functions for a NullPointerException, as also no element can be selected when the context menu is created.
This commit is contained in:
parent
4ad61e3152
commit
a823029c07
@ -39,10 +39,7 @@ public class ContactListCell extends ListCell<Contact> {
|
||||
final var statusLabel = new Label(user.getStatus().toString());
|
||||
statusLabel.getStyleClass().add(user.getStatus().toString().toLowerCase());
|
||||
vbox.getChildren().add(statusLabel);
|
||||
} else {
|
||||
// Member count
|
||||
vbox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members"));
|
||||
}
|
||||
} else vbox.getChildren().add(new Label(((Group) contact).getContacts().size() + " members"));
|
||||
setGraphic(vbox);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class MessageListCell extends ListCell<Message> {
|
||||
|
||||
static {
|
||||
try {
|
||||
statusImages = IconUtil.loadByEnum(MessageStatus.class, 32);
|
||||
statusImages = IconUtil.loadByEnum(MessageStatus.class, 16);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
EnvoyLog.getLogger(MessageListCell.class).log(Level.WARNING, "could not load status icons: ", e);
|
||||
@ -54,9 +54,11 @@ public class MessageListCell extends ListCell<Message> {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
final var cell = new VBox(new Label(dateFormat.format(message.getCreationDate())), new Label(message.getText()),
|
||||
new Label("", new ImageView(statusImages.get(message.getStatus()))));
|
||||
cell.getStyleClass().add(message.getRecipientID() == user.getID() ? "received-message" : "own-message");
|
||||
final var cell = new VBox(new Label(dateFormat.format(message.getCreationDate())), new Label(message.getText()));
|
||||
if (message.getRecipientID() == user.getID()) {
|
||||
cell.getChildren().add(new Label("", new ImageView(statusImages.get(message.getStatus()))));
|
||||
cell.getStyleClass().add("own-message");
|
||||
} else cell.getStyleClass().add("received-message");
|
||||
cell.paddingProperty().setValue(new Insets(5, 20, 5, 20));
|
||||
setGraphic(cell);
|
||||
}
|
||||
|
@ -321,34 +321,35 @@ public final class ChatScene {
|
||||
|
||||
@FXML
|
||||
private void copyMessage() {
|
||||
try {
|
||||
Toolkit.getDefaultToolkit()
|
||||
.getSystemClipboard()
|
||||
.setContents(new StringSelection(messageList.getSelectionModel().getSelectedItem().getText()), null);
|
||||
} catch (final NullPointerException e) {}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void deleteMessage() {}
|
||||
private void deleteMessage() { try {} catch (final NullPointerException e) {} }
|
||||
|
||||
@FXML
|
||||
private void forwardMessage() {}
|
||||
private void forwardMessage() { try {} catch (final NullPointerException e) {} }
|
||||
|
||||
@FXML
|
||||
private void quoteMessage() {}
|
||||
private void quoteMessage() { try {} catch (final NullPointerException e) {} }
|
||||
|
||||
@FXML
|
||||
private void deleteContact() {
|
||||
// TODO: Fill with content
|
||||
userList.getSelectionModel().getSelectedItem();
|
||||
}
|
||||
private void deleteContact() { try {} catch (final NullPointerException e) {} }
|
||||
|
||||
@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) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,11 @@
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.scroll-bar:horizontal, .scroll-bar *, .scroll-bar:horizontal > *{
|
||||
-fx-background-color: transparent;
|
||||
-fx-text-fill: transparent;
|
||||
}
|
||||
|
||||
.online {
|
||||
-fx-text-fill: limegreen;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
}
|
||||
|
||||
.button {
|
||||
-fx-background-color: darkviolet;
|
||||
-fx-background-color: rgb(105.0,0.0,153.0);
|
||||
}
|
||||
|
||||
.button:pressed {
|
||||
@ -23,15 +23,15 @@
|
||||
}
|
||||
|
||||
.list-cell:selected, .list-cell:selected > *, .menu-item:hover {
|
||||
-fx-background-color: darkviolet;
|
||||
-fx-background-color: rgb(105.0,0.0,153.0);
|
||||
}
|
||||
|
||||
.received-message {
|
||||
-fx-background-color: seagreen;
|
||||
-fx-background-color: gray;
|
||||
}
|
||||
|
||||
.own-message {
|
||||
-fx-background-color: gray;
|
||||
-fx-background-color: #8fa88f;
|
||||
}
|
||||
|
||||
.alert.information.dialog-pane, .alert.warning.dialog-pane, .alert.error.dialog-pane {
|
||||
|
@ -7,10 +7,10 @@
|
||||
-fx-text-fill: black;
|
||||
}
|
||||
|
||||
.received-message {
|
||||
-fx-background-color: lightgreen;
|
||||
}
|
||||
|
||||
.own-message , .menu-item {
|
||||
.received-message, .menu-item {
|
||||
-fx-background-color: lightgray;
|
||||
}
|
||||
|
||||
.own-message {
|
||||
-fx-background-color: lightgreen;
|
||||
}
|
||||
|
Reference in New Issue
Block a user