From 067cbbdcf841ef66621af627ee315948aeb229f2 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 9 May 2020 10:57:30 +0200 Subject: [PATCH 1/6] added fundamental css files, theoretically added css support --- src/main/java/envoy/client/data/Settings.java | 92 +++++++++++++------ src/main/java/envoy/client/ui/Startup.java | 46 ++++++++-- src/main/resources/fxml/themes/base.css | 5 + src/main/resources/fxml/themes/custom.css | 0 src/main/resources/fxml/themes/dark.css | 7 ++ src/main/resources/fxml/themes/light.css | 0 6 files changed, 114 insertions(+), 36 deletions(-) create mode 100644 src/main/resources/fxml/themes/base.css create mode 100644 src/main/resources/fxml/themes/custom.css create mode 100644 src/main/resources/fxml/themes/dark.css create mode 100644 src/main/resources/fxml/themes/light.css diff --git a/src/main/java/envoy/client/data/Settings.java b/src/main/java/envoy/client/data/Settings.java index 419d22a..fbbe108 100644 --- a/src/main/java/envoy/client/data/Settings.java +++ b/src/main/java/envoy/client/data/Settings.java @@ -27,8 +27,8 @@ import envoy.util.SerializationUtils; public class Settings { // Actual settings accessible by the rest of the application - private Map> items; - private Map themes; + private Map> items; + private Map themes; /** * Settings are stored in this file. @@ -46,8 +46,8 @@ public class Settings { private static Settings settings = new Settings(); /** - * The way to instantiate the settings. - * Is set to private to deny other instances of that object. + * The way to instantiate the settings. Is set to private to deny other + * instances of that object. * * @since Envoy Client v0.2-alpha */ @@ -69,12 +69,10 @@ public class Settings { } // Load standard themes not defined in the themes file - themes.put("dark", - new Theme("dark", Color.black, Color.darkGray, Color.white, new Color(165, 60, 232), Color.white, Color.orange, Color.blue, - Color.white, Color.white)); - themes.put("light", - new Theme("light", new Color(235, 235, 235), Color.white, Color.white, Color.darkGray, Color.black, Color.orange, Color.darkGray, - Color.black, Color.black)); + themes.put("dark", new Theme("dark", Color.black, Color.darkGray, Color.white, new Color(165, 60, 232), + Color.white, Color.orange, Color.blue, Color.white, Color.white)); + themes.put("light", new Theme("light", new Color(235, 235, 235), Color.white, Color.white, Color.darkGray, + Color.black, Color.orange, Color.darkGray, Color.black, Color.black)); } /** @@ -83,7 +81,9 @@ public class Settings { * @return the instance of Settings * @since Envoy Client v0.2-alpha */ - public static Settings getInstance() { return settings; } + public static Settings getInstance() { + return settings; + } /** * Updates the preferences when the save button is clicked. @@ -101,9 +101,12 @@ public class Settings { } private void supplementDefaults() { - items.putIfAbsent("enterToSend", new SettingsItem<>(true, "Enter to send", "Sends a message by pressing the enter key.")); - items.putIfAbsent("onCloseMode", new SettingsItem<>(true, "Hide on close", "Hides the chat window when it is closed.")); - items.putIfAbsent("currentTheme", new SettingsItem<>("dark", "Current Theme Name", "The name of the currently selected theme.")); + items.putIfAbsent("enterToSend", + new SettingsItem<>(true, "Enter to send", "Sends a message by pressing the enter key.")); + items.putIfAbsent("onCloseMode", + new SettingsItem<>(true, "Hide on close", "Hides the chat window when it is closed.")); + items.putIfAbsent("currentTheme", + new SettingsItem<>("dark", "Current Theme Name", "The name of the currently selected theme.")); } /** @@ -112,19 +115,25 @@ public class Settings { * @param theme the {@link Theme} to add * @since Envoy Client v0.2-alpha */ - public void addNewThemeToMap(Theme theme) { getThemes().put(theme.getThemeName(), theme); } + public void addNewThemeToMap(Theme theme) { + getThemes().put(theme.getThemeName(), theme); + } /** * @return the name of the currently active {@link Theme} * @since Envoy Client v0.2-alpha */ - public String getCurrentThemeName() { return (String) items.get("currentTheme").get(); } + public String getCurrentThemeName() { + return (String) items.get("currentTheme").get(); + } /** * @return the currently active {@link Theme} * @since Envoy Client v0.1-beta */ - public Theme getCurrentTheme() { return getTheme(getCurrentThemeName()); } + public Theme getCurrentTheme() { + return getTheme(getCurrentThemeName()); + } /** * Sets the name of the current {@link Theme}. @@ -132,7 +141,18 @@ public class Settings { * @param themeName the name to set * @since Envoy Client v0.2-alpha */ - public void setCurrentTheme(String themeName) { ((SettingsItem) items.get("currentTheme")).set(themeName); } + public void setCurrentTheme(String themeName) { + ((SettingsItem) items.get("currentTheme")).set(themeName); + } + + /** + * @return whether the current {@link Theme} is one of the default themes. + * Currently checks for dark and light theme. + * @since Envoy Client v0.1-beta + */ + public boolean isUsingDefaultTheme() { + return getCurrentThemeName().equals("dark") || getCurrentThemeName().equals("light"); + } /** * @return {@code true}, if pressing the {@code Enter} key suffices to send a @@ -140,7 +160,9 @@ public class Settings { * {@code Control} key. * @since Envoy Client v0.2-alpha */ - public Boolean isEnterToSend() { return (Boolean) items.get("enterToSend").get(); } + public Boolean isEnterToSend() { + return (Boolean) items.get("enterToSend").get(); + } /** * Changes the keystrokes performed by the user to send a message. @@ -150,13 +172,17 @@ public class Settings { * conjunction with the {@code Control} key. * @since Envoy Client v0.2-alpha */ - public void setEnterToSend(boolean enterToSend) { ((SettingsItem) items.get("enterToSend")).set(enterToSend); } + public void setEnterToSend(boolean enterToSend) { + ((SettingsItem) items.get("enterToSend")).set(enterToSend); + } /** * @return the current on close mode. * @since Envoy Client v0.3-alpha */ - public Boolean getCurrentOnCloseMode() { return (Boolean) items.get("onCloseMode").get(); } + public Boolean getCurrentOnCloseMode() { + return (Boolean) items.get("onCloseMode").get(); + } /** * Sets the current on close mode. @@ -164,23 +190,31 @@ public class Settings { * @param currentOnCloseMode the on close mode that should be set. * @since Envoy Client v0.3-alpha */ - public void setCurrentOnCloseMode(boolean currentOnCloseMode) { ((SettingsItem) items.get("onCloseMode")).set(currentOnCloseMode); } + public void setCurrentOnCloseMode(boolean currentOnCloseMode) { + ((SettingsItem) items.get("onCloseMode")).set(currentOnCloseMode); + } /** * @return the items */ - public Map> getItems() { return items; } + public Map> getItems() { + return items; + } /** * @param items the items to set */ - public void setItems(Map> items) { this.items = items; } + public void setItems(Map> items) { + this.items = items; + } /** * @return a {@code Map} of all themes with their names as keys * @since Envoy Client v0.2-alpha */ - public Map getThemes() { return themes; } + public Map getThemes() { + return themes; + } /** * Sets the {@code Map} of all themes with their names as keys @@ -188,12 +222,16 @@ public class Settings { * @param themes the theme map to set * @since Envoy Client v0.2-alpha */ - public void setThemes(Map themes) { this.themes = themes; } + public void setThemes(Map themes) { + this.themes = themes; + } /** * @param themeName the name of the {@link Theme} to get * @return the {@link Theme} with the specified name * @since Envoy Client v0.3-alpha */ - public Theme getTheme(String themeName) { return themes.get(themeName); } + public Theme getTheme(String themeName) { + return themes.get(themeName); + } } diff --git a/src/main/java/envoy/client/ui/Startup.java b/src/main/java/envoy/client/ui/Startup.java index 9b5405a..12d54e4 100644 --- a/src/main/java/envoy/client/ui/Startup.java +++ b/src/main/java/envoy/client/ui/Startup.java @@ -3,6 +3,7 @@ package envoy.client.ui; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.file.Paths; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,11 +45,14 @@ public final class Startup extends Application { private FXMLLoader loader = new FXMLLoader(); private Stage stage; + private Scene previousScene; - private Scene previousScene; + private final String[] CSSPaths = { "file://./src/main/resources/fxml/themes/base.css", + "file://./src/main/resources/fxml/themes/" + (settings.isUsingDefaultTheme() ? settings.getCurrentThemeName() : "custom") + ".css" }; - private static final ClientConfig config = ClientConfig.getInstance(); - private static final Logger logger = EnvoyLog.getLogger(Startup.class); + private static final Settings settings = Settings.getInstance(); + private static final ClientConfig config = ClientConfig.getInstance(); + private static final Logger logger = EnvoyLog.getLogger(Startup.class); /** * {@inheritDoc} @@ -150,7 +154,8 @@ public final class Startup extends Application { * @param fxmlLocation the location of the fxml file * @param layout the layout to use * @param savePrevious if true, the previous stage will be stored in this - * instance of Startup, else the variable storing it will be + * instance of Startup, else the variable storing it will + * be * set to null * @since Envoy Client v0.1-beta */ @@ -160,13 +165,17 @@ public final class Startup extends Application { // Clearing the loader so that a new Scene can be initialised loader = new FXMLLoader(); var rootNode = loader.load(getClass().getResourceAsStream(fxmlLocation)); - var chatScene = new Scene(rootNode); - previousScene = (savePrevious) ? stage.getScene() : null; - stage.setScene(chatScene); + var scene = new Scene(rootNode); + previousScene = savePrevious ? stage.getScene() : null; + // Setting the visual appearance + scene.getStylesheets().addAll(CSSPaths); + System.out.println(Paths.get(".").toAbsolutePath().normalize().toString()); + stage.setScene(scene); stage.show(); // return loader.getController(); } catch (IOException e) { new Alert(AlertType.ERROR, "The screen could not be updated due to reasons. (...bad programming...)"); + System.err.println("input: FXMLLocation: " + fxmlLocation + ", CSS paths: " + CSSPaths); e.printStackTrace(); logger.severe("Something happened (while loading the new scene from " + fxmlLocation + ")"); } @@ -175,7 +184,7 @@ public final class Startup extends Application { /** * Changes the visual scene back to the saved value. The currently active scene - * can be saved. + * can be saved, but must not be. * * @param storeCurrent the old scene to store, if wanted. Can be null * @since Envoy Client v0.1-beta @@ -185,7 +194,7 @@ public final class Startup extends Application { if (previousScene == null) throw new IllegalStateException("Someone tried restoring a null scene. (Something happened)"); else { // switching previous and current - var temp = (storeCurrent) ? stage.getScene() : null; + var temp = storeCurrent ? stage.getScene() : null; stage.setScene(previousScene); previousScene = temp; stage.show(); @@ -224,4 +233,23 @@ public final class Startup extends Application { if (loader.getController() == null) throw new NullPointerException("Cannot deliver current controller as its undefined (duh!)"); else return loader.getController(); } + + /** + * @return the CSSPaths + * @since Envoy Client v0.1-beta + */ + public String[] getCSSPaths() { return CSSPaths; } + + /** + * Changes the currently displayed theme + * + * @since Envoy Client v0.1-beta + */ + public void changeTheme() { + // the base.css file should never be changed during runtime + CSSPaths[1] = "file://.fxml/themes/" + (settings.isUsingDefaultTheme() ? settings.getCurrentThemeName() : "custom") + ".css"; + var styleSheets = stage.getScene().getStylesheets(); + styleSheets.remove(styleSheets.size() - 1); + styleSheets.add(CSSPaths[1]); + } } diff --git a/src/main/resources/fxml/themes/base.css b/src/main/resources/fxml/themes/base.css new file mode 100644 index 0000000..8cfc8ca --- /dev/null +++ b/src/main/resources/fxml/themes/base.css @@ -0,0 +1,5 @@ +.root{ + -fx-font: 200pt "Serif"; + --background=#00FF00; + background: var(--background); +} \ No newline at end of file diff --git a/src/main/resources/fxml/themes/custom.css b/src/main/resources/fxml/themes/custom.css new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/fxml/themes/dark.css b/src/main/resources/fxml/themes/dark.css new file mode 100644 index 0000000..06326dd --- /dev/null +++ b/src/main/resources/fxml/themes/dark.css @@ -0,0 +1,7 @@ +.root{ + --background=#000000; + background: var(--background); +} +.button{ + color: rgb(105,0,153); +} \ No newline at end of file diff --git a/src/main/resources/fxml/themes/light.css b/src/main/resources/fxml/themes/light.css new file mode 100644 index 0000000..e69de29 From 50a9026b0190870a5fa0cb90b8e9ff2f7a1da529 Mon Sep 17 00:00:00 2001 From: kske Date: Sat, 9 May 2020 09:50:41 +0200 Subject: [PATCH 2/6] Remove ui.primary package --- .../client/ui/primary/PrimaryButton.java | 63 --------- .../client/ui/primary/PrimaryScrollBar.java | 126 ------------------ .../client/ui/primary/PrimaryScrollPane.java | 85 ------------ .../client/ui/primary/PrimaryTextArea.java | 70 ---------- .../ui/primary/PrimaryToggleSwitch.java | 61 --------- .../envoy/client/ui/primary/package-info.java | 17 --- 6 files changed, 422 deletions(-) delete mode 100644 src/main/java/envoy/client/ui/primary/PrimaryButton.java delete mode 100644 src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java delete mode 100644 src/main/java/envoy/client/ui/primary/PrimaryScrollPane.java delete mode 100644 src/main/java/envoy/client/ui/primary/PrimaryTextArea.java delete mode 100644 src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java delete mode 100644 src/main/java/envoy/client/ui/primary/package-info.java diff --git a/src/main/java/envoy/client/ui/primary/PrimaryButton.java b/src/main/java/envoy/client/ui/primary/PrimaryButton.java deleted file mode 100644 index de7852c..0000000 --- a/src/main/java/envoy/client/ui/primary/PrimaryButton.java +++ /dev/null @@ -1,63 +0,0 @@ -package envoy.client.ui.primary; - -import java.awt.Graphics; - -import javax.swing.JButton; - -/** - * Project: envoy-client
- * File: PrimaryButton.javaEvent.java
- * Created: 07.12.2019
- * - * @author Kai S. K. Engelbart - * @author Maximilian Käfer - * @since Envoy Client v0.2-alpha - */ -public class PrimaryButton extends JButton { - - private static final long serialVersionUID = 0L; - - private int arcSize; - - /** - * Creates a primary button - * - * @param title the title of the button - * @since Envoy 0.2-alpha - */ - public PrimaryButton(String title) { this(title, 6); } - - /** - * Creates a primary button - * - * @param title the title of the button - * @param arcSize the size of the arc used to draw the round button edges - * @since Envoy 0.2-alpha - */ - public PrimaryButton(String title, int arcSize) { - super(title); - setBorderPainted(false); - setFocusPainted(false); - setContentAreaFilled(false); - this.arcSize = arcSize; - } - - @Override - protected void paintComponent(Graphics g) { - g.setColor(getBackground()); - g.fillRoundRect(0, 0, getWidth(), getHeight(), arcSize, arcSize); - super.paintComponent(g); - } - - /** - * @return the arcSize - * @since Envoy 0.2-alpha - */ - public int getArcSize() { return arcSize; } - - /** - * @param arcSize the arcSize to set - * @since Envoy 0.2-alpha - */ - public void setArcSize(int arcSize) { this.arcSize = arcSize; } -} diff --git a/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java b/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java deleted file mode 100644 index 371bd05..0000000 --- a/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java +++ /dev/null @@ -1,126 +0,0 @@ -package envoy.client.ui.primary; - -import java.awt.*; - -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JScrollBar; -import javax.swing.plaf.basic.BasicScrollBarUI; - -import envoy.client.data.Settings; -import envoy.client.ui.Theme; - -/** - * Project: envoy-client
- * File: PrimaryScrollBar.java
- * Created: 14.12.2019
- * - * @author Maximilian Käfer - * @since Envoy Client v0.2-alpha - */ -public class PrimaryScrollBar extends BasicScrollBarUI { - - private final Dimension d = new Dimension(); - private final int arcSize; - private final Color scrollBarColor; - private final Color hoverColor; - private final Color draggingColor; - private final boolean isVertical; - - /** - * Initializes a {@link PrimaryScrollBar} with a color scheme. - * - * @param arcSize the size of the arc used to draw the round scroll bar - * edges - * @param scrollBarColor the default color - * @param hoverColor the color while hovering - * @param draggingColor the color while dragging - * @param isVertical indicates whether this is a vertical - * {@link PrimaryScrollBar} - */ - public PrimaryScrollBar(int arcSize, Color scrollBarColor, Color hoverColor, Color draggingColor, boolean isVertical) { - this.arcSize = arcSize; - this.scrollBarColor = scrollBarColor; - this.hoverColor = hoverColor; - this.draggingColor = draggingColor; - this.isVertical = isVertical; - } - - /** - * Initializes a {@link PrimaryScrollBar} using a color scheme specified in a - * {@link Theme} - * - * @param theme the {@link Theme} to be applied to this - * {@link PrimaryScrollBar} - * @param isVertical indicates whether this is a vertical - * {@link PrimaryScrollBar} - */ - public PrimaryScrollBar(Theme theme, boolean isVertical) { - this(5, theme.getInteractableBackgroundColor(), new Color(theme.getInteractableBackgroundColor().getRGB() - 50), - new Color(theme.getInteractableBackgroundColor().getRGB() + 170), isVertical); - } - - /** - * {@inheritDoc} - */ - @Override - protected JButton createDecreaseButton(int orientation) { - JButton button = new JButton(); - button.setPreferredSize(d); - return button; - } - - /** - * {@inheritDoc} - */ - @Override - protected JButton createIncreaseButton(int orientation) { - JButton button = new JButton(); - button.setPreferredSize(d); - return button; - } - - /** - * {@inheritDoc} - */ - @Override - protected void paintTrack(Graphics g, JComponent c, Rectangle r) {} - - /** - * {@inheritDoc} - */ - @Override - protected void paintThumb(Graphics g, JComponent c, Rectangle r) { - Graphics2D g2 = (Graphics2D) g.create(); - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - Color color; - JScrollBar sb = (JScrollBar) c; - - if (!sb.isEnabled()) return; - - if (isDragging) color = draggingColor; - else if (isThumbRollover()) color = hoverColor; - else color = scrollBarColor; - - g2.setPaint(color); - if (isVertical) { - g2.fillRoundRect(r.x - 9, r.y, r.width, r.height, arcSize, arcSize); - g2.setPaint(Settings.getInstance().getCurrentTheme().getCellColor()); - g2.drawRoundRect(r.x - 9, r.y, r.width, r.height, arcSize, arcSize); - } else { - g2.fillRoundRect(r.x, r.y + 9, r.width, r.height - 10, arcSize, arcSize); - g2.setPaint(Settings.getInstance().getCurrentTheme().getCellColor()); - g2.drawRoundRect(r.x, r.y + 9, r.width, r.height - 10, arcSize, arcSize); - } - g2.dispose(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setThumbBounds(int x, int y, int width, int height) { - super.setThumbBounds(x, y, width, height); - scrollbar.repaint(); - } -} diff --git a/src/main/java/envoy/client/ui/primary/PrimaryScrollPane.java b/src/main/java/envoy/client/ui/primary/PrimaryScrollPane.java deleted file mode 100644 index e02502b..0000000 --- a/src/main/java/envoy/client/ui/primary/PrimaryScrollPane.java +++ /dev/null @@ -1,85 +0,0 @@ -package envoy.client.ui.primary; - -import javax.swing.JScrollPane; - -import envoy.client.ui.Theme; - -/** - * Project: envoy-client
- * File: PrimaryScrollPane.java
- * Created: 15 Dec 2019
- * - * @author Kai S. K. Engelbart - * @author Maximilian Käfer - */ -public class PrimaryScrollPane extends JScrollPane { - - private static final long serialVersionUID = 0L; - - private int verticalScrollBarMaximum = getVerticalScrollBar().getMaximum(); - private boolean chatOpened = false; - - /** - * Initializes a {@link JScrollPane} with the primary Envoy design scheme - * - * @since Envoy Client v0.2-alpha - */ - public PrimaryScrollPane() { setBorder(null); } - - /** - * Styles the vertical and horizontal scroll bars. - * - * @param theme the color set used to color the component - * @since Envoy Client v0.2-alpha - */ - public void applyTheme(Theme theme) { - setForeground(theme.getBackgroundColor()); - setBackground(theme.getCellColor()); - - getVerticalScrollBar().setBackground(theme.getCellColor()); - getVerticalScrollBar().setUI(new PrimaryScrollBar(theme, true)); - - getHorizontalScrollBar().setBackground(theme.getCellColor()); - getHorizontalScrollBar().setUI(new PrimaryScrollBar(theme, false)); - } - - /** - * Implements autoscroll functionality for the vertical scroll bar.
- *
- * Functionality to automatically scroll down when user views
- * the bottom of the chat while there are new messages added.
- *
- * When chat is opened, the vertical scroll bar starts at the bottom.
- *
- * When rereading messages, the chat doesn't scroll down if new messages
- * are added. (Besides see first point) - * - * @since Envoy Client v0.2-alpha - */ - public void autoscroll() { - // Automatic scrolling to the bottom - getVerticalScrollBar().addAdjustmentListener(e -> { - if (verticalScrollBarMaximum == e.getAdjustable().getMaximum()) return; - - if (chatOpened) { - e.getAdjustable().setValue(e.getAdjustable().getMaximum()); - verticalScrollBarMaximum = getVerticalScrollBar().getMaximum(); - chatOpened = false; - return; - } - if (getVerticalScrollBar().getValue() + getVerticalScrollBar().getVisibleAmount() + 100 >= getVerticalScrollBar().getMaximum()) { - e.getAdjustable().setValue(e.getAdjustable().getMaximum()); - verticalScrollBarMaximum = getVerticalScrollBar().getMaximum(); - } - }); - } - - /** - * Indicates a chat being opened by the user to this {@link PrimaryScrollPane} - * triggering it to automatically scroll down. - * - * @param chatOpened indicates the chat opening status - * @since Envoy Client v0.2-alpha - */ - public void setChatOpened(boolean chatOpened) { this.chatOpened = chatOpened; } -} diff --git a/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java b/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java deleted file mode 100644 index 37d05eb..0000000 --- a/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java +++ /dev/null @@ -1,70 +0,0 @@ -package envoy.client.ui.primary; - -import java.awt.Font; -import java.awt.Graphics; - -import javax.swing.JTextArea; -import javax.swing.border.EmptyBorder; - -/** - * Project: envoy-client
- * File: PrimaryTextArea.javaEvent.java
- * Created: 07.12.2019
- * - * @author Maximilian Käfer - * @since Envoy Client v0.2-alpha - */ -public class PrimaryTextArea extends JTextArea { - - private static final long serialVersionUID = 0L; - private int arcSize; - - /** - * Creates the text area - * - * @param borderSpace the space between components - * @since Envoy 0.2-alpha - */ - public PrimaryTextArea(int borderSpace) { this(6, borderSpace); } - - /** - * Creates the text area - * - * @param arcSize is the diameter of the arc at the four corners. - * @param borderSpace is the insets of the border on all four sides. - * @since Envoy 0.2-alpha - */ - public PrimaryTextArea(int arcSize, int borderSpace) { - super(); - setWrapStyleWord(true); - setLineWrap(true); - setBorder(null); - setFont(new Font("Arial", Font.PLAIN, 17)); - setBorder(new EmptyBorder(borderSpace, borderSpace, borderSpace, borderSpace)); - setOpaque(false); - - this.arcSize = arcSize; - } - - /** - * {@inheritDoc} - */ - @Override - protected void paintComponent(Graphics g) { - g.setColor(getBackground()); - g.fillRoundRect(0, 0, getWidth(), getHeight(), arcSize, arcSize); - super.paintComponent(g); - } - - /** - * @return the arcSize - the diameter of the arc at the four corners. - * @since Envoy 0.2-alpha - */ - public int getArcSize() { return arcSize; } - - /** - * @param arcSize the arcSize to set - * @since Envoy 0.2-alpha - */ - public void setArcSize(int arcSize) { this.arcSize = arcSize; } -} diff --git a/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java b/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java deleted file mode 100644 index 87afed9..0000000 --- a/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java +++ /dev/null @@ -1,61 +0,0 @@ -package envoy.client.ui.primary; - -import java.awt.Dimension; -import java.awt.Graphics; - -import javax.swing.JButton; - -import envoy.client.data.Settings; -import envoy.client.data.SettingsItem; -import envoy.client.ui.Color; - -/** - * This component can be used to toggle between two options. This will change - * the state of a {@code boolean} {@link SettingsItem}.
- *
- * Project: envoy-client
- * File: PrimaryToggleSwitch.java
- * Created: 21 Dec 2019
- * - * @author Maximilian Käfer - * @author Kai S. K. Engelbart - * @since Envoy Client v0.3-alpha - */ -public class PrimaryToggleSwitch extends JButton { - - private boolean state; - - private static final long serialVersionUID = 0L; - - /** - * Initializes a {@link PrimaryToggleSwitch}. - * - * @param settingsItem the {@link SettingsItem} that is controlled by this - * {@link PrimaryToggleSwitch} - * @since Envoy Client v0.3-alpha - */ - public PrimaryToggleSwitch(SettingsItem settingsItem) { - setPreferredSize(new Dimension(50, 25)); - setMinimumSize(new Dimension(50, 25)); - setMaximumSize(new Dimension(50, 25)); - - setBorderPainted(false); - setFocusPainted(false); - setContentAreaFilled(false); - - state = settingsItem.get(); - addActionListener((evt) -> { state = !state; settingsItem.set(state); revalidate(); repaint(); }); - } - - /** - * {@inheritDoc} - */ - @Override - public void paintComponent(Graphics g) { - g.setColor(state ? Color.GREEN : Color.LIGHT_GRAY); - g.fillRoundRect(0, 0, getWidth(), getHeight(), 25, 25); - - g.setColor(Settings.getInstance().getCurrentTheme().getInteractableBackgroundColor()); - g.fillRoundRect(state ? 25 : 0, 0, 25, 25, 25, 25); - } -} diff --git a/src/main/java/envoy/client/ui/primary/package-info.java b/src/main/java/envoy/client/ui/primary/package-info.java deleted file mode 100644 index d4c54fa..0000000 --- a/src/main/java/envoy/client/ui/primary/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This package defines all "primary" components that were defined specifically - * for the visual improvement of Envoy. However, they can still be used in - * general for other projects.
- * Primary elements are supposed to provide the main functionality of a UI - * component.
- *
- * Project: envoy-client
- * File: package-info.java
- * Created: 14 Mar 2020
- * - * @author Leon Hofmeister - * @author Kai S. K. Engelbart - * @author Maximilian Käfer - * @since Envoy Client v0.1-beta - */ -package envoy.client.ui.primary; From fa42516c6f9084bb1e79f45d95f0bf9e33098f4a Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 30 May 2020 15:28:11 +0200 Subject: [PATCH 3/6] Added ability to load CSS files --- src/main/java/envoy/client/ui/Startup.java | 70 ++++++++----------- src/main/resources/client.properties | 4 +- src/main/resources/css/base.css | 4 ++ .../resources/{fxml/themes => css}/custom.css | 0 .../resources/{fxml/themes => css}/dark.css | 0 .../resources/{fxml/themes => css}/light.css | 0 src/main/resources/fxml/themes/base.css | 5 -- 7 files changed, 37 insertions(+), 46 deletions(-) create mode 100644 src/main/resources/css/base.css rename src/main/resources/{fxml/themes => css}/custom.css (100%) rename src/main/resources/{fxml/themes => css}/dark.css (100%) rename src/main/resources/{fxml/themes => css}/light.css (100%) delete mode 100644 src/main/resources/fxml/themes/base.css diff --git a/src/main/java/envoy/client/ui/Startup.java b/src/main/java/envoy/client/ui/Startup.java index 12d54e4..8e367a6 100644 --- a/src/main/java/envoy/client/ui/Startup.java +++ b/src/main/java/envoy/client/ui/Startup.java @@ -3,7 +3,6 @@ package envoy.client.ui; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.nio.file.Paths; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; @@ -20,11 +19,13 @@ import javafx.scene.layout.Pane; import javafx.stage.Stage; import envoy.client.data.*; +import envoy.client.event.ThemeChangeEvent; import envoy.client.net.Client; import envoy.client.net.WriteProxy; import envoy.data.Message; import envoy.data.User; import envoy.data.User.UserStatus; +import envoy.event.EventBus; import envoy.exception.EnvoyException; import envoy.util.EnvoyLog; @@ -47,9 +48,6 @@ public final class Startup extends Application { private Stage stage; private Scene previousScene; - private final String[] CSSPaths = { "file://./src/main/resources/fxml/themes/base.css", - "file://./src/main/resources/fxml/themes/" + (settings.isUsingDefaultTheme() ? settings.getCurrentThemeName() : "custom") + ".css" }; - private static final Settings settings = Settings.getInstance(); private static final ClientConfig config = ClientConfig.getInstance(); private static final Logger logger = EnvoyLog.getLogger(Startup.class); @@ -62,17 +60,17 @@ public final class Startup extends Application { this.stage = stage; try { // Load the configuration from client.properties first - Properties properties = new Properties(); + final Properties properties = new Properties(); properties.load(Startup.class.getClassLoader().getResourceAsStream("client.properties")); config.load(properties); // Override configuration values with command line arguments - String[] args = getParameters().getRaw().toArray(new String[0]); + final String[] args = getParameters().getRaw().toArray(new String[0]); if (args.length > 0) config.load(args); // Check if all mandatory configuration values have been initialized if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized"); - } catch (Exception e) { + } catch (final Exception e) { new Alert(AlertType.ERROR, "Error loading configuration values:\n" + e); e.printStackTrace(); System.exit(1); @@ -90,7 +88,7 @@ public final class Startup extends Application { new Alert(AlertType.WARNING, "Ignoring local database.\nMessages will not be saved!").showAndWait(); } else try { localDB = new PersistentLocalDB(new File(config.getHomeDirectory(), config.getLocalDB().getPath())); - } catch (IOException e3) { + } catch (final IOException e3) { logger.log(Level.SEVERE, "Could not initialize local database", e3); new Alert(AlertType.ERROR, "Could not initialize local database!\n" + e3).showAndWait(); System.exit(1); @@ -111,9 +109,9 @@ public final class Startup extends Application { try { localDB.initializeUserStorage(); localDB.loadUserData(); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { // The local database file has not yet been created, probably first login - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); new Alert(AlertType.ERROR, "Error while loading local database: " + e + "\nChats will not be stored locally.").showAndWait(); } @@ -140,8 +138,10 @@ public final class Startup extends Application { Platform.runLater(() -> { ((ChatSceneController) loader.getController()).initializeData(this, localDB, client, writeProxy); }); stage.setTitle("Envoy"); stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/envoy_logo.png"))); - stage.show(); + // TODO: Add capability to change custom CSS. In case of switching to a default + // theme, no further action is required + EventBus.getInstance().register(ThemeChangeEvent.class, theme -> applyCSS()); // Relay unread messages from cache if (cache != null && client.isOnline()) cache.relay(); @@ -154,8 +154,7 @@ public final class Startup extends Application { * @param fxmlLocation the location of the fxml file * @param layout the layout to use * @param savePrevious if true, the previous stage will be stored in this - * instance of Startup, else the variable storing it will - * be + * instance of Startup, else the variable storing it will be * set to null * @since Envoy Client v0.1-beta */ @@ -164,18 +163,16 @@ public final class Startup extends Application { try { // Clearing the loader so that a new Scene can be initialised loader = new FXMLLoader(); - var rootNode = loader.load(getClass().getResourceAsStream(fxmlLocation)); - var scene = new Scene(rootNode); + final var rootNode = loader.load(getClass().getResourceAsStream(fxmlLocation)); + final var scene = new Scene(rootNode); previousScene = savePrevious ? stage.getScene() : null; // Setting the visual appearance - scene.getStylesheets().addAll(CSSPaths); - System.out.println(Paths.get(".").toAbsolutePath().normalize().toString()); stage.setScene(scene); + applyCSS(); stage.show(); - // return loader.getController(); - } catch (IOException e) { + } catch (final IOException e) { new Alert(AlertType.ERROR, "The screen could not be updated due to reasons. (...bad programming...)"); - System.err.println("input: FXMLLocation: " + fxmlLocation + ", CSS paths: " + CSSPaths); + System.err.println("input: FXMLLocation: " + fxmlLocation); e.printStackTrace(); logger.severe("Something happened (while loading the new scene from " + fxmlLocation + ")"); } @@ -194,8 +191,9 @@ public final class Startup extends Application { if (previousScene == null) throw new IllegalStateException("Someone tried restoring a null scene. (Something happened)"); else { // switching previous and current - var temp = storeCurrent ? stage.getScene() : null; + final var temp = storeCurrent ? stage.getScene() : null; stage.setScene(previousScene); + applyCSS(); previousScene = temp; stage.show(); } @@ -208,7 +206,6 @@ public final class Startup extends Application { @Override public void stop() throws Exception { try { - // Save Settings and PersistentLocalDB on shutdown logger.info("Closing connection..."); client.close(); @@ -216,14 +213,11 @@ public final class Startup extends Application { logger.info("Saving local database and settings..."); localDB.save(); Settings.getInstance().save(); - } catch (Exception e) { + } catch (final Exception e) { logger.log(Level.SEVERE, "Unable to save local files", e); } } - @SuppressWarnings("javadoc") - public static void main(String[] args) { launch(args); } - /** * @return the controller of the current scene or a {@link NullPointerException} * if there is none @@ -235,21 +229,19 @@ public final class Startup extends Application { } /** - * @return the CSSPaths - * @since Envoy Client v0.1-beta - */ - public String[] getCSSPaths() { return CSSPaths; } - - /** - * Changes the currently displayed theme + * Sets the CSS files used for each scene. Should be called when the theme + * changes. * * @since Envoy Client v0.1-beta */ - public void changeTheme() { - // the base.css file should never be changed during runtime - CSSPaths[1] = "file://.fxml/themes/" + (settings.isUsingDefaultTheme() ? settings.getCurrentThemeName() : "custom") + ".css"; - var styleSheets = stage.getScene().getStylesheets(); - styleSheets.remove(styleSheets.size() - 1); - styleSheets.add(CSSPaths[1]); + public void applyCSS() { + final var styleSheets = stage.getScene().getStylesheets(); + styleSheets.clear(); + styleSheets.add(getClass().getResource("/css/base.css").toExternalForm()); + styleSheets.add(getClass().getResource("/css/" + (settings.isUsingDefaultTheme() ? settings.getCurrentThemeName() : "custom") + ".css") + .toExternalForm()); } + + @SuppressWarnings("javadoc") + public static void main(String[] args) { launch(args); } } diff --git a/src/main/resources/client.properties b/src/main/resources/client.properties index 2641927..609d61a 100644 --- a/src/main/resources/client.properties +++ b/src/main/resources/client.properties @@ -1,3 +1,3 @@ -server=http://kske.feste-ip.net -port=43315 +server=localhost +port=8080 localDB=.\\localDB diff --git a/src/main/resources/css/base.css b/src/main/resources/css/base.css new file mode 100644 index 0000000..059fefb --- /dev/null +++ b/src/main/resources/css/base.css @@ -0,0 +1,4 @@ +*{ + -fx-font: 14pt "Serif"; + -fx-background-color:#000000; + } diff --git a/src/main/resources/fxml/themes/custom.css b/src/main/resources/css/custom.css similarity index 100% rename from src/main/resources/fxml/themes/custom.css rename to src/main/resources/css/custom.css diff --git a/src/main/resources/fxml/themes/dark.css b/src/main/resources/css/dark.css similarity index 100% rename from src/main/resources/fxml/themes/dark.css rename to src/main/resources/css/dark.css diff --git a/src/main/resources/fxml/themes/light.css b/src/main/resources/css/light.css similarity index 100% rename from src/main/resources/fxml/themes/light.css rename to src/main/resources/css/light.css diff --git a/src/main/resources/fxml/themes/base.css b/src/main/resources/fxml/themes/base.css deleted file mode 100644 index 8cfc8ca..0000000 --- a/src/main/resources/fxml/themes/base.css +++ /dev/null @@ -1,5 +0,0 @@ -.root{ - -fx-font: 200pt "Serif"; - --background=#00FF00; - background: var(--background); -} \ No newline at end of file From ca9b72b1dec516522ba5895788e889d0abe18d35 Mon Sep 17 00:00:00 2001 From: kske Date: Sat, 6 Jun 2020 10:19:33 +0200 Subject: [PATCH 4/6] Add proper layout to ChatWindow, fix user field selection in LoginDialog --- .settings/org.eclipse.jdt.core.prefs | 361 ++++++++++++++++++ .settings/org.eclipse.jdt.ui.prefs | 2 + .../java/envoy/client/ui/LoginDialog.java | 13 +- src/main/resources/css/base.css | 8 +- src/main/resources/fxml/ChatScene.fxml | 44 +-- src/main/resources/fxml/LoginDialog.fxml | 40 +- 6 files changed, 399 insertions(+), 69 deletions(-) diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 7d167b0..5e625c6 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -128,3 +128,364 @@ org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=true +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=1 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=true +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=true +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=84 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=80 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=84 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=true +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_if_single_item +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_if_single_item +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_always +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_if_single_item +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=true +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=150 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=separate_lines_if_wrapped +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.text_block_indentation=0 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index d1f3908..f6a7cc1 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,6 @@ eclipse.preferences.version=1 +formatter_profile=_KSKE +formatter_settings_version=18 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;javafx;org;com;envoy; org.eclipse.jdt.ui.javadoc=true diff --git a/src/main/java/envoy/client/ui/LoginDialog.java b/src/main/java/envoy/client/ui/LoginDialog.java index 9126a67..de8d618 100644 --- a/src/main/java/envoy/client/ui/LoginDialog.java +++ b/src/main/java/envoy/client/ui/LoginDialog.java @@ -61,8 +61,8 @@ public final class LoginDialog extends Dialog { * * @param client the client used to perform the handshake * @param localDB the local database used for offline login - * @param receivedMessageCache the cache storing messages received during the - * handshake + * @param receivedMessageCache the cache storing messages received during + * the handshake * @throws IOException if an exception occurs during loading * @since Envoy Client v0.1-beta */ @@ -99,6 +99,9 @@ public final class LoginDialog extends Dialog { setOnShown(e -> { if (config.hasLoginCredentials()) performHandshake(config.getLoginCredentials()); }); setDialogPane(dialogPane); + + // Set initial cursor + Platform.runLater(userTextField::requestFocus); } @FXML @@ -107,9 +110,6 @@ public final class LoginDialog extends Dialog { // Show an alert after an unsuccessful handshake eventBus.register(HandshakeRejectionEvent.class, e -> Platform.runLater(() -> { clearPasswordFields(); new Alert(AlertType.ERROR, e.get()).showAndWait(); })); - - // Set initial cursor - userTextField.requestFocus(); } @FXML @@ -144,7 +144,8 @@ public final class LoginDialog extends Dialog { if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown"); client.setSender(clientUser); Platform.runLater(() -> { - new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n" + e) + new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n" + + e) .showAndWait(); hide(); }); diff --git a/src/main/resources/css/base.css b/src/main/resources/css/base.css index 059fefb..be1533f 100644 --- a/src/main/resources/css/base.css +++ b/src/main/resources/css/base.css @@ -1,4 +1,4 @@ -*{ - -fx-font: 14pt "Serif"; - -fx-background-color:#000000; - } +* { + /* -fx-font: 14.0pt "Serif"; */ + /* -fx-background-color:#000000; */ +} diff --git a/src/main/resources/fxml/ChatScene.fxml b/src/main/resources/fxml/ChatScene.fxml index 43af60d..34e444a 100644 --- a/src/main/resources/fxml/ChatScene.fxml +++ b/src/main/resources/fxml/ChatScene.fxml @@ -8,41 +8,23 @@ - + - - + + + - - - + + + - -