Clean-up, moved Settings and SettingsItem into the data package
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
package envoy.client;
 | 
			
		||||
package envoy.client.data;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
@@ -6,7 +6,6 @@ import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.prefs.Preferences;
 | 
			
		||||
 | 
			
		||||
import envoy.client.data.Config;
 | 
			
		||||
import envoy.client.ui.Color;
 | 
			
		||||
import envoy.client.ui.Theme;
 | 
			
		||||
import envoy.util.SerializationUtils;
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package envoy.client;
 | 
			
		||||
package envoy.client.data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
@@ -12,7 +12,7 @@ import envoy.event.Event;
 | 
			
		||||
 * @author Leon Hofmeister
 | 
			
		||||
 * @since Envoy v0.3-alpha
 | 
			
		||||
 */
 | 
			
		||||
public class HandshakeSuccessfulEvent implements Event<Void> {
 | 
			
		||||
public class HandshakeSuccessfulEvent extends Event.Valueless {
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = -157972384126278855L;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,9 +12,9 @@ import javax.swing.border.EmptyBorder;
 | 
			
		||||
import javax.swing.event.DocumentEvent;
 | 
			
		||||
import javax.swing.event.DocumentListener;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Chat;
 | 
			
		||||
import envoy.client.data.LocalDb;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.event.MessageCreationEvent;
 | 
			
		||||
import envoy.client.event.ThemeChangeEvent;
 | 
			
		||||
import envoy.client.net.Client;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import java.awt.Font;
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.event.SendEvent;
 | 
			
		||||
import envoy.client.ui.list.ComponentList;
 | 
			
		||||
import envoy.client.ui.list.ComponentListCellRenderer;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,8 +8,8 @@ import java.util.Arrays;
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
import javax.swing.border.EmptyBorder;
 | 
			
		||||
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.event.HandshakeSuccessfulEvent;
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.data.LoginCredentials;
 | 
			
		||||
import envoy.event.EventBus;
 | 
			
		||||
import envoy.event.HandshakeRejectionEvent;
 | 
			
		||||
@@ -26,20 +26,20 @@ import envoy.event.HandshakeRejectionEvent;
 | 
			
		||||
public class LoginDialog extends JDialog {
 | 
			
		||||
 | 
			
		||||
	private final JPanel	contentPanel;
 | 
			
		||||
	private JTextField			textField;
 | 
			
		||||
	private JPasswordField		passwordField;
 | 
			
		||||
	private JPasswordField		repeatPasswordField;
 | 
			
		||||
	private JTextField		textField;
 | 
			
		||||
	private JPasswordField	passwordField;
 | 
			
		||||
	private JPasswordField	repeatPasswordField;
 | 
			
		||||
 | 
			
		||||
	private JLabel	lblUserName;
 | 
			
		||||
	private JLabel	lblPassword;
 | 
			
		||||
	private JLabel	lblRepeatPassword;
 | 
			
		||||
  private JLabel			errorMessage;
 | 
			
		||||
  
 | 
			
		||||
	private JLabel	errorMessage;
 | 
			
		||||
 | 
			
		||||
	private GridBagConstraints	gbc_lblRepeatPassword;
 | 
			
		||||
	private GridBagConstraints	gbc_repeatPasswordField;
 | 
			
		||||
  private GridBagConstraints	gbc_errorMessage;
 | 
			
		||||
	private GridBagConstraints	gbc_errorMessage;
 | 
			
		||||
 | 
			
		||||
	private JPanel buttonPane;
 | 
			
		||||
	private JPanel			buttonPane;
 | 
			
		||||
	private JTextPane		registerText;
 | 
			
		||||
	private JCheckBox		registerCheckBox;
 | 
			
		||||
	private PrimaryButton	okButton;
 | 
			
		||||
@@ -48,6 +48,7 @@ public class LoginDialog extends JDialog {
 | 
			
		||||
	private LoginCredentials credentials;
 | 
			
		||||
 | 
			
		||||
	private static final long serialVersionUID = 352021600833907468L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Displays a dialog enabling the user to enter their user name and password.
 | 
			
		||||
	 *
 | 
			
		||||
@@ -68,7 +69,7 @@ public class LoginDialog extends JDialog {
 | 
			
		||||
		contentPanel.setLayout(gbl_contentPanel);
 | 
			
		||||
		{
 | 
			
		||||
			lblUserName = new JLabel("Username:");
 | 
			
		||||
			GridBagConstraints	gbc_lblUserName	= new GridBagConstraints();
 | 
			
		||||
			GridBagConstraints gbc_lblUserName = new GridBagConstraints();
 | 
			
		||||
			gbc_lblUserName.anchor	= GridBagConstraints.EAST;
 | 
			
		||||
			gbc_lblUserName.insets	= new Insets(0, 0, 5, 5);
 | 
			
		||||
			gbc_lblUserName.gridx	= 0;
 | 
			
		||||
@@ -88,7 +89,7 @@ public class LoginDialog extends JDialog {
 | 
			
		||||
		}
 | 
			
		||||
		{
 | 
			
		||||
			lblPassword = new JLabel("Password:");
 | 
			
		||||
			GridBagConstraints	gbc_lblPassword	= new GridBagConstraints();
 | 
			
		||||
			GridBagConstraints gbc_lblPassword = new GridBagConstraints();
 | 
			
		||||
			gbc_lblPassword.anchor	= GridBagConstraints.EAST;
 | 
			
		||||
			gbc_lblPassword.insets	= new Insets(0, 0, 0, 5);
 | 
			
		||||
			gbc_lblPassword.gridx	= 0;
 | 
			
		||||
@@ -124,8 +125,8 @@ public class LoginDialog extends JDialog {
 | 
			
		||||
				contentPanel.remove(errorMessage);
 | 
			
		||||
				clearPasswordFields();
 | 
			
		||||
				// TODO delete - only for testing purposes
 | 
			
		||||
				System.out.println("Caught HandshakeRejectionEvent with reason" + ((HandshakeRejectionEvent) evt).get());
 | 
			
		||||
				errorMessage			= new JLabel(((HandshakeRejectionEvent) evt).get());
 | 
			
		||||
				System.out.println("Caught HandshakeRejectionEvent with reason" + evt.get());
 | 
			
		||||
				errorMessage			= new JLabel(evt.get());
 | 
			
		||||
				gbc_errorMessage		= new GridBagConstraints();
 | 
			
		||||
				gbc_errorMessage.gridx	= 2;
 | 
			
		||||
				gbc_errorMessage.gridy	= 0;
 | 
			
		||||
@@ -201,11 +202,11 @@ public class LoginDialog extends JDialog {
 | 
			
		||||
 | 
			
		||||
		setModal(true);
 | 
			
		||||
		setVisible(true);
 | 
			
		||||
		EventBus.getInstance().register(HandshakeSuccessfulEvent.class, evt -> this.dispose());
 | 
			
		||||
		EventBus.getInstance().register(HandshakeSuccessfulEvent.class, evt -> dispose());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Resets the text stored by this
 | 
			
		||||
	 * Resets the text stored in the passwort fields.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @since Envoy v0.3-alpha
 | 
			
		||||
	 */
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import java.text.SimpleDateFormat;
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.ui.list.ComponentList;
 | 
			
		||||
import envoy.client.ui.list.ComponentListCellRenderer;
 | 
			
		||||
import envoy.data.Message;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JScrollBar;
 | 
			
		||||
import javax.swing.plaf.basic.BasicScrollBarUI;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Project: <strong>envoy-client</strong><br>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ import java.awt.Graphics;
 | 
			
		||||
 | 
			
		||||
import javax.swing.JButton;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.SettingsItem;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.data.SettingsItem;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This component can be used to toggle between two options. This will change
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@ import javax.swing.JFrame;
 | 
			
		||||
import javax.swing.JOptionPane;
 | 
			
		||||
import javax.swing.SwingUtilities;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.*;
 | 
			
		||||
import envoy.client.net.Client;
 | 
			
		||||
import envoy.client.net.WriteProxy;
 | 
			
		||||
@@ -79,7 +78,7 @@ public class Startup {
 | 
			
		||||
		LoginCredentials credentials = config.hasLoginCredentials() ? config.getLoginCredentials() : new LoginDialog().getCredentials();
 | 
			
		||||
 | 
			
		||||
		if (credentials == null) {
 | 
			
		||||
			logger.info("The login process has been aborted by the user. Exiting...");
 | 
			
		||||
			logger.info("The login process has been cancelled. Exiting...");
 | 
			
		||||
			System.exit(0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import javax.swing.JLabel;
 | 
			
		||||
import javax.swing.JList;
 | 
			
		||||
import javax.swing.ListCellRenderer;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.data.User;
 | 
			
		||||
import envoy.data.User.UserStatus;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,8 +10,8 @@ import java.util.logging.Logger;
 | 
			
		||||
import javax.swing.JComponent;
 | 
			
		||||
import javax.swing.JTextPane;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.SettingsItem;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.data.SettingsItem;
 | 
			
		||||
import envoy.client.ui.Theme;
 | 
			
		||||
import envoy.client.util.EnvoyLog;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import javax.swing.JDialog;
 | 
			
		||||
import javax.swing.JPanel;
 | 
			
		||||
import javax.swing.JTextPane;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.ui.PrimaryButton;
 | 
			
		||||
import envoy.client.ui.PrimaryTextArea;
 | 
			
		||||
import envoy.client.ui.Theme;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import java.util.logging.Logger;
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.event.ThemeChangeEvent;
 | 
			
		||||
import envoy.client.ui.PrimaryButton;
 | 
			
		||||
import envoy.client.ui.Theme;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import java.util.logging.Logger;
 | 
			
		||||
 | 
			
		||||
import javax.swing.*;
 | 
			
		||||
 | 
			
		||||
import envoy.client.Settings;
 | 
			
		||||
import envoy.client.data.Settings;
 | 
			
		||||
import envoy.client.event.ThemeChangeEvent;
 | 
			
		||||
import envoy.client.ui.Color;
 | 
			
		||||
import envoy.client.ui.Theme;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user