Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session management #20

Merged
merged 18 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/main/java/EntropyMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class EntropyMain implements Registry
public static void main(String[] args)
{
//Initialise interfaces etc
Debug.initialise(new DebugOutputSystemOut());
Thread.setDefaultUncaughtExceptionHandler(new LoggerUncaughtExceptionHandler());
MainUtilKt.setLoggingContextFields();
AbstractClient.setInstance(new DesktopEntropyClient());
Expand Down
44 changes: 8 additions & 36 deletions client/src/main/java/online/screen/AccountSettingsDialog.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
package online.screen;

import java.awt.Component;
import util.Debug;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

import online.util.AccountUtil;
import online.util.XmlBuilderClient;

import org.w3c.dom.Document;

import screen.ScreenCache;
import util.Debug;
import util.DialogUtil;
import util.MessageUtil;

public class AccountSettingsDialog extends JDialog
implements ActionListener
{
private String username = "";
private String email = "";
private String username;

public AccountSettingsDialog(String username, String email)
public AccountSettingsDialog(String username)
{
this.username = username;
this.email = email;

getRootPane().setDefaultButton(btnOk);
setTitle("Account Settings");
Expand All @@ -54,12 +37,10 @@ public AccountSettingsDialog(String username, String email)
okCancelPanel.setSize(294, 33);
getContentPane().add(okCancelPanel);
okCancelPanel.add(btnOk);
okCancelPanel.add(btnChangePassword);
okCancelPanel.add(btnCancel);
textFieldUsername.setEditable(false);
textFieldEmail.setEditable(false);

btnChangePassword.addActionListener(this);
btnOk.addActionListener(this);
btnCancel.addActionListener(this);

Expand All @@ -70,28 +51,19 @@ public AccountSettingsDialog(String username, String email)
private final JTextField textFieldEmail = new JTextField();
private final JPanel okCancelPanel = new JPanel();
private final JButton btnOk = new JButton("Ok");
private final JButton btnChangePassword = new JButton("Change Password");
private final JButton btnCancel = new JButton("Cancel");

private void init()
{
textFieldUsername.setText(username);
textFieldEmail.setText(email);
textFieldEmail.setText("");
}

@Override
public void actionPerformed(ActionEvent arg0)
{
Component source = (Component)arg0.getSource();
if (source == btnChangePassword)
{
ChangePasswordDialog dialog = new ChangePasswordDialog(username, true);
ScreenCache.setChangePasswordDialog(dialog);
dialog.setModal(true);
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
}
else if (source == btnOk)
if (source == btnOk)
{
dispose();
}
Expand Down
183 changes: 0 additions & 183 deletions client/src/main/java/online/screen/ChangePasswordDialog.java

This file was deleted.

14 changes: 3 additions & 11 deletions client/src/main/java/online/screen/EntropyLobby.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public class EntropyLobby extends JFrame
private UsernameRenderer usernameRenderer = new UsernameRenderer();

private String username = "";
private String email = "";

public EntropyLobby()
{
Expand Down Expand Up @@ -182,6 +181,8 @@ public void run()
onlineUserList.setModel(usernamesModel);
onlineUserList.setCellRenderer(usernameRenderer);
statsPanel.init();

initChatPanelIfNecessary();
}
});

Expand Down Expand Up @@ -367,14 +368,6 @@ public String getUsername()
{
return username;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}

public boolean confirmExit()
{
Expand Down Expand Up @@ -474,8 +467,7 @@ public void actionPerformed(ActionEvent arg0)
Component source = (Component)arg0.getSource();
if (source == btnSettings)
{
AccountSettingsDialog dialog = new AccountSettingsDialog(username, email);
ScreenCache.setAccountSettingsDialog(dialog);
AccountSettingsDialog dialog = new AccountSettingsDialog(username);
dialog.setModal(true);
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
Expand Down
Loading
Loading