From cfd323725f696d61515331f1213038822be2ba8b Mon Sep 17 00:00:00 2001 From: delvh Date: Thu, 18 Jun 2020 22:20:34 +0200 Subject: [PATCH] Improved general appearance of Envoy --- .../java/envoy/client/ui/ContactListCell.java | 14 ++-- .../envoy/client/ui/controller/ChatScene.java | 8 ++- src/main/resources/css/base.css | 5 ++ src/main/resources/css/dark.css | 27 ++++++- src/main/resources/css/light.css | 2 +- src/main/resources/fxml/ChatScene.fxml | 58 +++++++++++++-- .../resources/fxml/ContactSearchScene.fxml | 27 +++++-- .../resources/fxml/GroupCreationScene.fxml | 22 +++++- src/main/resources/fxml/LoginScene.fxml | 70 ++++++++++++++++--- src/main/resources/fxml/SettingsScene.fxml | 27 ++++++- 10 files changed, 222 insertions(+), 38 deletions(-) diff --git a/src/main/java/envoy/client/ui/ContactListCell.java b/src/main/java/envoy/client/ui/ContactListCell.java index 5cb04ca..bf9f117 100644 --- a/src/main/java/envoy/client/ui/ContactListCell.java +++ b/src/main/java/envoy/client/ui/ContactListCell.java @@ -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 { 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"); diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index 5195b08..bcfbcc3 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -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); } diff --git a/src/main/resources/css/base.css b/src/main/resources/css/base.css index eeff6ef..aa2b6fb 100644 --- a/src/main/resources/css/base.css +++ b/src/main/resources/css/base.css @@ -1,3 +1,8 @@ .button { -fx-background-radius: 5em; } + +.button:hover { + -fx-scale-x: 1.05; + -fx-scale-y: 1.05; +} diff --git a/src/main/resources/css/dark.css b/src/main/resources/css/dark.css index e10a301..0e92317 100644 --- a/src/main/resources/css/dark.css +++ b/src/main/resources/css/dark.css @@ -1,4 +1,27 @@ -.button{ - -fx-background-color: rgb(105,0,153); +* { -fx-text-fill: white; } + +.root { + -fx-background-color: black; +} + +.button { + -fx-background-color: rgb(105.0,0.0,153.0); +} + +.button:pressed { + -fx-background-color: darkgray; +} + +.button:disabled { + -fx-background-color: lightgray; +} + +.list-view, .list-cell, .label, .text-area .content, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content { + -fx-background-color: dimgray; +} + +.alert.information.dialog-pane, .alert.warning.dialog-pane, .alert.error.dialog-pane { + -fx-background-color: black; +} diff --git a/src/main/resources/css/light.css b/src/main/resources/css/light.css index 34a1f74..f29be8c 100644 --- a/src/main/resources/css/light.css +++ b/src/main/resources/css/light.css @@ -1,3 +1,3 @@ .button{ - -fx-background-color: snow; + -fx-background-color: orangered; } diff --git a/src/main/resources/fxml/ChatScene.fxml b/src/main/resources/fxml/ChatScene.fxml index 5323930..45067b4 100644 --- a/src/main/resources/fxml/ChatScene.fxml +++ b/src/main/resources/fxml/ChatScene.fxml @@ -5,6 +5,7 @@ + @@ -22,12 +23,51 @@ - - - + + + + + + +