Improved general appearance of Envoy
This commit is contained in:
@ -3,7 +3,6 @@ package envoy.client.ui;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import envoy.data.Contact;
|
||||
import envoy.data.Group;
|
||||
@ -38,22 +37,23 @@ public class ContactListCell extends ListCell<Contact> {
|
||||
if (contact instanceof User) {
|
||||
// user specific info
|
||||
infoLabel = new Label(((User) contact).getStatus().toString());
|
||||
Color textColor = null;
|
||||
String textColor = null;
|
||||
switch (((User) contact).getStatus()) {
|
||||
case ONLINE:
|
||||
textColor = Color.LIMEGREEN;
|
||||
textColor = "limegreen";
|
||||
break;
|
||||
case AWAY:
|
||||
textColor = Color.ORANGERED;
|
||||
textColor = "orangered";
|
||||
break;
|
||||
case BUSY:
|
||||
textColor = Color.RED;
|
||||
textColor = "red";
|
||||
break;
|
||||
case OFFLINE:
|
||||
textColor = Color.GRAY;
|
||||
textColor = "gray";
|
||||
break;
|
||||
}
|
||||
infoLabel.setTextFill(textColor);
|
||||
// infoLabel.setTextFill(textColor) does not work as it gets overridden by CSS;
|
||||
infoLabel.setStyle("-fx-text-fill: " + textColor);
|
||||
} else
|
||||
// group specific infos
|
||||
infoLabel = new Label(String.valueOf(((Group) contact).getContacts().size()) + " members");
|
||||
|
@ -85,6 +85,10 @@ public final class ChatScene {
|
||||
messageList.setCellFactory(listView -> new MessageListCell());
|
||||
userList.setCellFactory(listView -> new ContactListCell());
|
||||
|
||||
// Unfortunately, remainingChars.setTextFill(...) does not work as it is most
|
||||
// likely overridden by CSS
|
||||
remainingChars.setStyle("-fx-text-fill: #00FF00; -fx-opacity: 1; -fx-background-color: transparent;");
|
||||
|
||||
// Listen to received messages
|
||||
eventBus.register(MessageCreationEvent.class, e -> {
|
||||
final var message = e.get();
|
||||
@ -94,7 +98,7 @@ public final class ChatScene {
|
||||
if (chat.equals(currentChat)) {
|
||||
try {
|
||||
currentChat.read(writeProxy);
|
||||
} catch (IOException e1) {
|
||||
} catch (final IOException e1) {
|
||||
logger.log(Level.WARNING, "Could not read current chat: ", e1);
|
||||
}
|
||||
Platform.runLater(messageList::refresh);
|
||||
@ -177,7 +181,7 @@ public final class ChatScene {
|
||||
// Read the current chat
|
||||
try {
|
||||
currentChat.read(writeProxy);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
logger.log(Level.WARNING, "Could not read current chat.", e);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user