summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/gui/intro/Login_GUI.java
diff options
context:
space:
mode:
authorTobias Spitzer2014-08-11 10:05:49 +0200
committerTobias Spitzer2014-08-11 10:05:49 +0200
commit5bfd52efe2222439e0b1a6674c680437eeaa83a7 (patch)
tree090e9df6e7d4a0dc8de97a28b34175678f7bfb55 /Dozentenmodul/src/gui/intro/Login_GUI.java
parentWindowÜberschrift geändert (diff)
downloadtutor-module-5bfd52efe2222439e0b1a6674c680437eeaa83a7.tar.gz
tutor-module-5bfd52efe2222439e0b1a6674c680437eeaa83a7.tar.xz
tutor-module-5bfd52efe2222439e0b1a6674c680437eeaa83a7.zip
Benutzername speichern nun möglich
Diffstat (limited to 'Dozentenmodul/src/gui/intro/Login_GUI.java')
-rw-r--r--Dozentenmodul/src/gui/intro/Login_GUI.java48
1 files changed, 45 insertions, 3 deletions
diff --git a/Dozentenmodul/src/gui/intro/Login_GUI.java b/Dozentenmodul/src/gui/intro/Login_GUI.java
index a3c070b3..3e47fc1b 100644
--- a/Dozentenmodul/src/gui/intro/Login_GUI.java
+++ b/Dozentenmodul/src/gui/intro/Login_GUI.java
@@ -28,6 +28,7 @@ import models.SessionData;
import models.person;
import org.apache.thrift.TException;
+import org.ini4j.InvalidFileFormatException;
import org.ini4j.Wini;
import thrift.ImageServer.Client;
@@ -36,6 +37,7 @@ import thrift.ThriftConnection;
import thrift.UserInfo;
import util.GuiOrganizer;
import config.config_file;
+import javax.swing.JCheckBox;
@SuppressWarnings("serial")
public class Login_GUI extends JFrame {
@@ -50,7 +52,8 @@ public class Login_GUI extends JFrame {
MasterThriftConnection thrift;
Client client;
String token;
-
+ JCheckBox chckbxBenutzernameSpeichern;
+
/**
* Launch the application.
*/
@@ -136,6 +139,10 @@ public class Login_GUI extends JFrame {
imgLabel.setIcon(new ImageIcon(scaled));
// Hinzufuegen des Logos in das Fenster
contentPane.add(imgLabel);
+
+ chckbxBenutzernameSpeichern = new JCheckBox("Benutzername speichern");
+ chckbxBenutzernameSpeichern.setBounds(292, 222, 237, 23);
+ contentPane.add(chckbxBenutzernameSpeichern);
// Erzeugen und Hinzufuegen des Labels
JLabel LabelUser = new JLabel("bwIDM-Benutzername:");
@@ -146,6 +153,28 @@ public class Login_GUI extends JFrame {
lblusername = new JTextField();
lblusername
.setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein.");
+ try {
+ Wini ini = new Wini(
+ new File(
+ "C:\\Users\\"
+ + System.getProperty("user.name")
+ + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini"));
+ if(ini.get("main", "Benutzername").isEmpty()){
+
+ }else{
+ lblusername.setText(ini.get("main", "Benutzername").toString());
+ }
+
+ if(ini.get("main", "Benutzername speichern", Boolean.class)==true){
+ chckbxBenutzernameSpeichern.setSelected(true);
+ }
+ } catch (InvalidFileFormatException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
lblusername.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
performLogin();
@@ -164,11 +193,12 @@ public class Login_GUI extends JFrame {
JButton BtnLogin = new JButton("Login");
BtnLogin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
+
performLogin();
}// end actionPerformed
});
- BtnLogin.setBounds(292, 244, 237, 23);
+ BtnLogin.setBounds(292, 252, 237, 23);
contentPane.add(BtnLogin);
// Erzeugen und Hinzufuegen des Passwortfeldes
@@ -185,6 +215,8 @@ public class Login_GUI extends JFrame {
lblConnectionInfo.setHorizontalAlignment(SwingConstants.LEFT);
lblConnectionInfo.setBounds(292, 290, 237, 20);
contentPane.add(lblConnectionInfo);
+
+
//GuiOrganizer.centerGUI(this);
}// end LoginGUI()
@@ -198,6 +230,7 @@ public class Login_GUI extends JFrame {
thrift.SessionData result = null;
try {
+
login = true;
String passText = new String(lblpass.getPassword());
// check if client has received a connection with information or a
@@ -249,6 +282,16 @@ public class Login_GUI extends JFrame {
"C:\\Users\\"
+ System.getProperty("user.name")
+ "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini"));
+ if(chckbxBenutzernameSpeichern.isSelected()){
+ ini.put("main", "Benutzername", lblusername.getText());
+ ini.put("main", "Benutzername speichern", true);
+ ini.store();
+ }
+ else{
+ ini.put("main", "Benutzername", "");
+ ini.put("main", "Benutzername speichern", false);
+ ini.store();
+ }
// Pruefe ob Bills Of Rights schon akzeptiert wurden,
// wenn
// nicht zeige diese an
@@ -334,5 +377,4 @@ public class Login_GUI extends JFrame {
return isClientReturnedCorrectly;
}// end checkServerConnection()
-
}// end class