From f51348002072a2061957caa783d8df06869b6342 Mon Sep 17 00:00:00 2001 From: delvh Date: Thu, 18 Jun 2020 22:20:34 +0200 Subject: [PATCH 1/5] 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 @@ - - - + + + + + + + From ef40c171d9d24214476a458b8b088ef0ffa8f090 Mon Sep 17 00:00:00 2001 From: delvh Date: Fri, 19 Jun 2020 16:57:20 +0200 Subject: [PATCH 2/5] Fixed invisibility bug --- src/main/resources/css/dark.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/css/dark.css b/src/main/resources/css/dark.css index 0e92317..1f8d181 100644 --- a/src/main/resources/css/dark.css +++ b/src/main/resources/css/dark.css @@ -18,7 +18,7 @@ -fx-background-color: lightgray; } -.list-view, .list-cell, .label, .text-area .content, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content { +.list-view, .list-cell, .label, .text-area .content, .text-field, .password-field, .tooltip, .pane, .pane .content, .vbox, .titled-pane > .title, .titled-pane > *.content { -fx-background-color: dimgray; } From d3896372598d2fdec8b671f95d2c483f3c5b421a Mon Sep 17 00:00:00 2001 From: delvh Date: Sun, 21 Jun 2020 17:04:27 +0200 Subject: [PATCH 3/5] Moved remainingCharsLabel styling from code to CSS --- src/main/java/envoy/client/ui/controller/ChatScene.java | 4 ---- src/main/resources/css/base.css | 6 ++++++ src/main/resources/fxml/ChatScene.fxml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index bcfbcc3..0f8b0b0 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -85,10 +85,6 @@ 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(); diff --git a/src/main/resources/css/base.css b/src/main/resources/css/base.css index aa2b6fb..43b5c3a 100644 --- a/src/main/resources/css/base.css +++ b/src/main/resources/css/base.css @@ -6,3 +6,9 @@ -fx-scale-x: 1.05; -fx-scale-y: 1.05; } + +#remainingCharsLabel { + -fx-text-fill: #00FF00; + -fx-opacity: 1; + -fx-background-color: transparent; +} diff --git a/src/main/resources/fxml/ChatScene.fxml b/src/main/resources/fxml/ChatScene.fxml index 45067b4..9d95fba 100644 --- a/src/main/resources/fxml/ChatScene.fxml +++ b/src/main/resources/fxml/ChatScene.fxml @@ -76,7 +76,7 @@ -