Cleanup and Reformatting
This commit is contained in:
parent
6ffa144daf
commit
f0a8b303d5
@ -1,17 +0,0 @@
|
|||||||
package envoy.client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Project: <strong>envoy-client</strong><br>
|
|
||||||
* File: <strong>DeveloperComments.java</strong><br>
|
|
||||||
* Created: <strong>19 Apr 2020</strong><br>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
|
|
||||||
}
|
|
@ -27,8 +27,8 @@ import envoy.util.SerializationUtils;
|
|||||||
public class Settings {
|
public class Settings {
|
||||||
|
|
||||||
// Actual settings accessible by the rest of the application
|
// Actual settings accessible by the rest of the application
|
||||||
private Map<String, SettingsItem<?>> items;
|
private Map<String, SettingsItem<?>> items;
|
||||||
private Map<String, Theme> themes;
|
private Map<String, Theme> themes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings are stored in this file.
|
* Settings are stored in this file.
|
||||||
@ -69,10 +69,12 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load standard themes not defined in the themes file
|
// 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),
|
themes.put("dark",
|
||||||
Color.white, Color.orange, Color.blue, Color.white, Color.white));
|
new Theme("dark", Color.black, Color.darkGray, Color.white, new Color(165, 60, 232), Color.white, Color.orange, Color.blue,
|
||||||
themes.put("light", new Theme("light", new Color(235, 235, 235), Color.white, Color.white, Color.darkGray,
|
Color.white, Color.white));
|
||||||
Color.black, Color.orange, Color.darkGray, Color.black, Color.black));
|
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
|
* @return the instance of Settings
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public static Settings getInstance() {
|
public static Settings getInstance() { return settings; }
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the preferences when the save button is clicked.
|
* Updates the preferences when the save button is clicked.
|
||||||
@ -101,12 +101,9 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void supplementDefaults() {
|
private void supplementDefaults() {
|
||||||
items.putIfAbsent("enterToSend",
|
items.putIfAbsent("enterToSend", new SettingsItem<>(true, "Enter to send", "Sends a message by pressing the enter key."));
|
||||||
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("onCloseMode",
|
items.putIfAbsent("currentTheme", new SettingsItem<>("dark", "Current Theme Name", "The name of the currently selected theme."));
|
||||||
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
|
* @param theme the {@link Theme} to add
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public void addNewThemeToMap(Theme theme) {
|
public void addNewThemeToMap(Theme theme) { getThemes().put(theme.getThemeName(), theme); }
|
||||||
getThemes().put(theme.getThemeName(), theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name of the currently active {@link Theme}
|
* @return the name of the currently active {@link Theme}
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public String getCurrentThemeName() {
|
public String getCurrentThemeName() { return (String) items.get("currentTheme").get(); }
|
||||||
return (String) items.get("currentTheme").get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the currently active {@link Theme}
|
* @return the currently active {@link Theme}
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public Theme getCurrentTheme() {
|
public Theme getCurrentTheme() { return getTheme(getCurrentThemeName()); }
|
||||||
return getTheme(getCurrentThemeName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the current {@link Theme}.
|
* Sets the name of the current {@link Theme}.
|
||||||
@ -141,18 +132,14 @@ public class Settings {
|
|||||||
* @param themeName the name to set
|
* @param themeName the name to set
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public void setCurrentTheme(String themeName) {
|
public void setCurrentTheme(String themeName) { ((SettingsItem<String>) items.get("currentTheme")).set(themeName); }
|
||||||
((SettingsItem<String>) items.get("currentTheme")).set(themeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the current {@link Theme} is one of the default themes.
|
* @return whether the current {@link Theme} is one of the default themes.
|
||||||
* Currently checks for dark and light theme.
|
* Currently checks for dark and light theme.
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
public boolean isUsingDefaultTheme() {
|
public boolean isUsingDefaultTheme() { return getCurrentThemeName().equals("dark") || getCurrentThemeName().equals("light"); }
|
||||||
return getCurrentThemeName().equals("dark") || getCurrentThemeName().equals("light");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true}, if pressing the {@code Enter} key suffices to send a
|
* @return {@code true}, if pressing the {@code Enter} key suffices to send a
|
||||||
@ -160,9 +147,7 @@ public class Settings {
|
|||||||
* {@code Control} key.
|
* {@code Control} key.
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public Boolean isEnterToSend() {
|
public Boolean isEnterToSend() { return (Boolean) items.get("enterToSend").get(); }
|
||||||
return (Boolean) items.get("enterToSend").get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the keystrokes performed by the user to send a message.
|
* Changes the keystrokes performed by the user to send a message.
|
||||||
@ -172,17 +157,13 @@ public class Settings {
|
|||||||
* conjunction with the {@code Control} key.
|
* conjunction with the {@code Control} key.
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public void setEnterToSend(boolean enterToSend) {
|
public void setEnterToSend(boolean enterToSend) { ((SettingsItem<Boolean>) items.get("enterToSend")).set(enterToSend); }
|
||||||
((SettingsItem<Boolean>) items.get("enterToSend")).set(enterToSend);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current on close mode.
|
* @return the current on close mode.
|
||||||
* @since Envoy Client v0.3-alpha
|
* @since Envoy Client v0.3-alpha
|
||||||
*/
|
*/
|
||||||
public Boolean getCurrentOnCloseMode() {
|
public Boolean getCurrentOnCloseMode() { return (Boolean) items.get("onCloseMode").get(); }
|
||||||
return (Boolean) items.get("onCloseMode").get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current on close mode.
|
* Sets the current on close mode.
|
||||||
@ -190,31 +171,23 @@ public class Settings {
|
|||||||
* @param currentOnCloseMode the on close mode that should be set.
|
* @param currentOnCloseMode the on close mode that should be set.
|
||||||
* @since Envoy Client v0.3-alpha
|
* @since Envoy Client v0.3-alpha
|
||||||
*/
|
*/
|
||||||
public void setCurrentOnCloseMode(boolean currentOnCloseMode) {
|
public void setCurrentOnCloseMode(boolean currentOnCloseMode) { ((SettingsItem<Boolean>) items.get("onCloseMode")).set(currentOnCloseMode); }
|
||||||
((SettingsItem<Boolean>) items.get("onCloseMode")).set(currentOnCloseMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the items
|
* @return the items
|
||||||
*/
|
*/
|
||||||
public Map<String, SettingsItem<?>> getItems() {
|
public Map<String, SettingsItem<?>> getItems() { return items; }
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param items the items to set
|
* @param items the items to set
|
||||||
*/
|
*/
|
||||||
public void setItems(Map<String, SettingsItem<?>> items) {
|
public void setItems(Map<String, SettingsItem<?>> items) { this.items = items; }
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a {@code Map<String, Theme>} of all themes with their names as keys
|
* @return a {@code Map<String, Theme>} of all themes with their names as keys
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public Map<String, Theme> getThemes() {
|
public Map<String, Theme> getThemes() { return themes; }
|
||||||
return themes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@code Map<String, Theme>} of all themes with their names as keys
|
* Sets the {@code Map<String, Theme>} of all themes with their names as keys
|
||||||
@ -222,16 +195,12 @@ public class Settings {
|
|||||||
* @param themes the theme map to set
|
* @param themes the theme map to set
|
||||||
* @since Envoy Client v0.2-alpha
|
* @since Envoy Client v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public void setThemes(Map<String, Theme> themes) {
|
public void setThemes(Map<String, Theme> themes) { this.themes = themes; }
|
||||||
this.themes = themes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param themeName the name of the {@link Theme} to get
|
* @param themeName the name of the {@link Theme} to get
|
||||||
* @return the {@link Theme} with the specified name
|
* @return the {@link Theme} with the specified name
|
||||||
* @since Envoy Client v0.3-alpha
|
* @since Envoy Client v0.3-alpha
|
||||||
*/
|
*/
|
||||||
public Theme getTheme(String themeName) {
|
public Theme getTheme(String themeName) { return themes.get(themeName); }
|
||||||
return themes.get(themeName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user