Formatting

This commit is contained in:
DieGurke 2019-12-22 21:48:19 +01:00
parent abe36d999a
commit 141b2371cc
6 changed files with 168 additions and 170 deletions

View File

@ -13,8 +13,11 @@ public class OnCloseChangeEvent implements Event<Integer>{
private Integer closeMode; private Integer closeMode;
/** /**
* @param closeMode This is the on close mode for the client, that should be set. * @param closeMode This is the on close mode for the client, that should be
* </br> 0 = ExitOnClose </br> 1 = HideOnClose * set.
* </br>
* 0 = ExitOnClose </br>
* 1 = HideOnClose
* @since Envoy 0.3-alpha * @since Envoy 0.3-alpha
*/ */
public OnCloseChangeEvent(int closeMode) { this.closeMode = closeMode; } public OnCloseChangeEvent(int closeMode) { this.closeMode = closeMode; }

View File

@ -1,7 +1,7 @@
package envoy.client.ui; package envoy.client.ui;
import java.awt.*; import java.awt.*;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.*; import javax.swing.*;
@ -9,13 +9,12 @@ import javax.swing.*;
import envoy.client.Settings; import envoy.client.Settings;
import envoy.client.event.Event; import envoy.client.event.Event;
import envoy.client.event.EventBus; import envoy.client.event.EventBus;
import envoy.client.event.EventHandler;
import envoy.client.event.OnCloseChangeEvent;
import envoy.client.ui.settings.ThemeCustomizationPanel;
import envoy.client.util.EnvoyLog; import envoy.client.util.EnvoyLog;
/** /**
* This Component can be used to toggle between two options. e.g. on and off </br></br> * This Component can be used to toggle between two options. e.g. on and off
* </br>
* </br>
* *
* Project: <strong>envoy-client</strong><br> * Project: <strong>envoy-client</strong><br>
* File: <strong>PrimaryToggleSwitch.java</strong><br> * File: <strong>PrimaryToggleSwitch.java</strong><br>
@ -27,7 +26,6 @@ import envoy.client.util.EnvoyLog;
public class PrimaryToggleSwitch extends JPanel { public class PrimaryToggleSwitch extends JPanel {
private static final long serialVersionUID = -721155303106833184L; private static final long serialVersionUID = -721155303106833184L;
private boolean initialState;
JButton b = new JButton(""); JButton b = new JButton("");
private boolean currentState; private boolean currentState;
private int variable; private int variable;
@ -36,7 +34,9 @@ public class PrimaryToggleSwitch extends JPanel{
/** /**
* This is the constructor for the PrimaryToggleSwitch. * This is the constructor for the PrimaryToggleSwitch.
* *
* @param initialState The state the toggleSwitch is standardly set to. </br> true: off </br> false: on * @param initialState The state the toggleSwitch is standardly set to. </br>
* true: off </br>
* false: on
* @param eventName the path of the event class * @param eventName the path of the event class
* @since Envoy v0.3-alpha * @since Envoy v0.3-alpha
*/ */
@ -45,7 +45,6 @@ public class PrimaryToggleSwitch extends JPanel{
super(); super();
setEnabled(true); setEnabled(true);
setVisible(true); setVisible(true);
this.initialState = initialState;
setPreferredSize(new Dimension(50, 25)); setPreferredSize(new Dimension(50, 25));
setMinimumSize(new Dimension(50, 25)); setMinimumSize(new Dimension(50, 25));
@ -55,8 +54,7 @@ public class PrimaryToggleSwitch extends JPanel{
b.setMinimumSize(new Dimension(25, 25)); b.setMinimumSize(new Dimension(25, 25));
b.setMaximumSize(new Dimension(25, 25)); b.setMaximumSize(new Dimension(25, 25));
b.setBackground(Settings.getInstance().getThemes() b.setBackground(Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()).getInteractableBackgroundColor());
.get(Settings.getInstance().getCurrentTheme()).getInteractableBackgroundColor());
GridBagLayout gbl_toggleSwitch = new GridBagLayout(); GridBagLayout gbl_toggleSwitch = new GridBagLayout();
gbl_toggleSwitch.columnWidths = new int[] { 1, 1 }; gbl_toggleSwitch.columnWidths = new int[] { 1, 1 };
@ -100,7 +98,10 @@ public class PrimaryToggleSwitch extends JPanel{
/** /**
* This method sets the state of the {@link PrimaryToggleSwitch}. * This method sets the state of the {@link PrimaryToggleSwitch}.
* *
* @param state This is the state of the {@link PrimaryToggleSwitch}, that should be set. </br> true: off </br> false: on * @param state This is the state of the {@link PrimaryToggleSwitch}, that
* should be set. </br>
* true: off </br>
* false: on
* @since Envoy 0.3-alpha * @since Envoy 0.3-alpha
*/ */
public void setState(boolean state) { public void setState(boolean state) {

View File

@ -4,8 +4,6 @@ import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -14,7 +12,6 @@ import javax.swing.JTextPane;
import envoy.client.Settings; import envoy.client.Settings;
import envoy.client.event.EventBus; import envoy.client.event.EventBus;
import envoy.client.event.OnCloseChangeEvent; import envoy.client.event.OnCloseChangeEvent;
import envoy.client.event.ThemeChangeEvent;
import envoy.client.ui.PrimaryToggleSwitch; import envoy.client.ui.PrimaryToggleSwitch;
import envoy.client.ui.Theme; import envoy.client.ui.Theme;
import envoy.client.util.EnvoyLog; import envoy.client.util.EnvoyLog;
@ -42,7 +39,9 @@ public class General extends SettingsPanel {
JTextPane onCloseModeState = new JTextPane(); JTextPane onCloseModeState = new JTextPane();
/** /**
* This is the constructor for the General class. Here the user can set general settings for the client. * This is the constructor for the General class. Here the user can set general
* settings for the client.
*
* @since Envoy 0.3-alpha * @since Envoy 0.3-alpha
*/ */
public General() { public General() {
@ -107,7 +106,8 @@ public class General extends SettingsPanel {
/** /**
* This method changes the on close mode of the client. * This method changes the on close mode of the client.
* *
* @param state This is the integer that defines weather the toggleSwitch is on or off. * @param state This is the integer that defines weather the toggleSwitch is on
* or off.
* @since Envoy v0.3-alpha * @since Envoy v0.3-alpha
*/ */
public void changeOnClose(int state) { public void changeOnClose(int state) {

View File

@ -51,8 +51,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public ThemeCustomizationPanel() { public ThemeCustomizationPanel() {
temporaryTheme = new Theme("temporaryTheme", temporaryTheme = new Theme("temporaryTheme", Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
GridBagLayout gbl_themeLayout = new GridBagLayout(); GridBagLayout gbl_themeLayout = new GridBagLayout();
@ -125,8 +124,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
themeArray = Arrays.copyOf(themeArray, themeArray.length + 1); themeArray = Arrays.copyOf(themeArray, themeArray.length + 1);
themeArray[themeArray.length - 1] = Settings.getInstance().getThemes().get(name).getThemeName(); themeArray[themeArray.length - 1] = Settings.getInstance().getThemes().get(name).getThemeName();
temporaryTheme = new Theme("temporaryTheme", temporaryTheme = new Theme("temporaryTheme", Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme()));
themes.addItem(themeArray[themeArray.length - 1]); themes.addItem(themeArray[themeArray.length - 1]);
themes.setSelectedIndex(themeArray.length - 1); themes.setSelectedIndex(themeArray.length - 1);
@ -172,10 +170,8 @@ public class ThemeCustomizationPanel extends SettingsPanel {
private void buildCustomizeElements(Theme theme) { private void buildCustomizeElements(Theme theme) {
buildCustomizeElement(theme, theme.getBackgroundColor(), "Background", "backgroundColor", 1); buildCustomizeElement(theme, theme.getBackgroundColor(), "Background", "backgroundColor", 1);
buildCustomizeElement(theme, theme.getCellColor(), "Cells", "cellColor", 2); buildCustomizeElement(theme, theme.getCellColor(), "Cells", "cellColor", 2);
buildCustomizeElement(theme, theme.getInteractableForegroundColor(), "Interactable Foreground", buildCustomizeElement(theme, theme.getInteractableForegroundColor(), "Interactable Foreground", "interactableForegroundColor", 3);
"interactableForegroundColor", 3); buildCustomizeElement(theme, theme.getInteractableBackgroundColor(), "Interactable Background", "interactableBackgroundColor", 4);
buildCustomizeElement(theme, theme.getInteractableBackgroundColor(), "Interactable Background",
"interactableBackgroundColor", 4);
buildCustomizeElement(theme, theme.getMessageColorChat(), "Messages Chat", "messageColorChat", 5); buildCustomizeElement(theme, theme.getMessageColorChat(), "Messages Chat", "messageColorChat", 5);
buildCustomizeElement(theme, theme.getDateColorChat(), "Date Chat", "dateColorCat", 6); buildCustomizeElement(theme, theme.getDateColorChat(), "Date Chat", "dateColorCat", 6);
buildCustomizeElement(theme, theme.getSelectionColor(), "Selection", "selectionColor", 7); buildCustomizeElement(theme, theme.getSelectionColor(), "Selection", "selectionColor", 7);
@ -233,7 +229,5 @@ public class ThemeCustomizationPanel extends SettingsPanel {
colorsPanel.add(button, gbc_button); colorsPanel.add(button, gbc_button);
} }
private Color getInvertedColor(Color color) { private Color getInvertedColor(Color color) { return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()); }
return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
}
} }