From f0a8b303d5a8e764a67a95adb461cef75715831b Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sat, 6 Jun 2020 15:03:43 +0200 Subject: [PATCH] Cleanup and Reformatting --- .../java/envoy/client/DeveloperComments.java | 17 ---- src/main/java/envoy/client/data/Settings.java | 83 ++++++------------- 2 files changed, 26 insertions(+), 74 deletions(-) delete mode 100644 src/main/java/envoy/client/DeveloperComments.java diff --git a/src/main/java/envoy/client/DeveloperComments.java b/src/main/java/envoy/client/DeveloperComments.java deleted file mode 100644 index 781d58c..0000000 --- a/src/main/java/envoy/client/DeveloperComments.java +++ /dev/null @@ -1,17 +0,0 @@ -package envoy.client; - -/** - * Project: envoy-client
- * File: DeveloperComments.java
- * Created: 19 Apr 2020
- * - * @author Leon Hofmeister - * @since Envoy Client v0.1-beta - */ -public class DeveloperComments { - - // "Schau, es hat sich behindert" - Kai, 2020 - - // LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes - -} diff --git a/src/main/java/envoy/client/data/Settings.java b/src/main/java/envoy/client/data/Settings.java index fbbe108..4e36369 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. @@ -69,10 +69,12 @@ 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)); } /** @@ -81,9 +83,7 @@ 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,12 +101,9 @@ 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.")); } /** @@ -115,25 +112,19 @@ 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}. @@ -141,18 +132,14 @@ 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"); - } + public boolean isUsingDefaultTheme() { return getCurrentThemeName().equals("dark") || getCurrentThemeName().equals("light"); } /** * @return {@code true}, if pressing the {@code Enter} key suffices to send a @@ -160,9 +147,7 @@ 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. @@ -172,17 +157,13 @@ 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. @@ -190,31 +171,23 @@ 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 @@ -222,16 +195,12 @@ 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); } }