diff options
author | Jonathan Bauer | 2015-07-28 15:54:28 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-07-28 15:54:28 +0200 |
commit | 56ab9ec30dcdab7e33257b90971bedc1efbd4bb2 (patch) | |
tree | ed77c14f3fd0f8d946f671353e5227cbebe8ea1a /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java | |
parent | [client] Fix menu actions (diff) | |
download | tutor-module-56ab9ec30dcdab7e33257b90971bedc1efbd4bb2.tar.gz tutor-module-56ab9ec30dcdab7e33257b90971bedc1efbd4bb2.tar.xz tutor-module-56ab9ec30dcdab7e33257b90971bedc1efbd4bb2.zip |
[client] login type toggling and added the static open() for LoginWindow
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java index c150da66..f3fc079c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java @@ -1,5 +1,8 @@ package org.openslx.dozmod.gui.window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import org.apache.log4j.Logger; import org.openslx.dozmod.gui.window.layout.LoginWindowLayout; @@ -11,26 +14,50 @@ public class LoginWindow extends LoginWindowLayout { private final static Logger LOGGER = Logger.getLogger(LoginWindow.class); + // TODO This has nothing to to with the layout + public static enum LOGIN_TYPE { + ECP(0), + TEST_ACCOUNT(1), + DIRECT_CONNECT(2); + + public final int id; + + private LOGIN_TYPE(final int id) { + this.id = id; + } + } + + // authentication method to use for login attempts + protected LOGIN_TYPE loginType = null; // text constants private final String NO_USERNAME = "Kein Benutzername angegeben!"; private final String NO_PASSWORD = "Kein Passwort angegeben!"; - /** - * Constructor doing the setup of the logical GUI functions - * Fetches the organization list for BWIDM logins and - * adds mouse/keyboard event listeners to various widgets. - * - * @param mainShell - */ - public static void open() { - new LoginWindow().setVisible(true); - } public LoginWindow() { // call the constructor of the superclass super(); + // first do all listeners stuff + radioButtonECP.setActionCommand(LOGIN_TYPE.ECP.toString()); + radioButtonTest.setActionCommand(LOGIN_TYPE.TEST_ACCOUNT.toString()); + radioButtonSat.setActionCommand(LOGIN_TYPE.DIRECT_CONNECT.toString()); + // ugly but no way around it according to stackoverflow + final ActionListener loginTypeToggler = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + loginType = LOGIN_TYPE.valueOf(e.getActionCommand()); + labelIdp.setVisible(loginType == LOGIN_TYPE.ECP); + idpCombo.setVisible(loginType == LOGIN_TYPE.ECP); + } + }; + radioButtonECP.addActionListener(loginTypeToggler); + radioButtonTest.addActionListener(loginTypeToggler); + radioButtonSat.addActionListener(loginTypeToggler); + + // // fetch the list of the identity providers as an async Thread // // else the GUI is blocked until this is done. +// idpCombo. // idpCombo.add("Initialisiere..."); // idpCombo.select(0); // idpCombo.setEnabled(false); @@ -348,4 +375,7 @@ public class LoginWindow extends LoginWindowLayout { // } // return (Organization) idpCombo.getData(idpCombo.getItem(selectionIndex)); // } + public static void open() { + new LoginWindow().setVisible(true); + } } |