diff options
author | Jonathan Bauer | 2015-07-28 14:42:24 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-07-28 14:42:24 +0200 |
commit | 6c2db27a3c89c47198df214a1c198f12489ff0b2 (patch) | |
tree | 8012ed82fa67f37a661f5cf07af70f353bd8ca91 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java | |
parent | [client] Swing (diff) | |
download | tutor-module-6c2db27a3c89c47198df214a1c198f12489ff0b2.tar.gz tutor-module-6c2db27a3c89c47198df214a1c198f12489ff0b2.tar.xz tutor-module-6c2db27a3c89c47198df214a1c198f12489ff0b2.zip |
[client] login: save username, idp combo
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java index c31f4f82..84e8030c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java @@ -1,14 +1,17 @@ package org.openslx.dozmod.gui.window.layout; import java.awt.Color; +import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Image; +import java.awt.Insets; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; @@ -20,6 +23,7 @@ import javax.swing.UIManager; import javax.swing.border.TitledBorder; import org.apache.log4j.Logger; +import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.util.ResourceLoader; @@ -44,8 +48,18 @@ public abstract class LoginWindowLayout extends JDialog { protected LOGIN_TYPE loginType = null; - private static final String title = "bwSuite - Login"; - private static final String authenticationGroupLabel = "Authentifizierungsart"; + private static final String TITLE = "bwSuite - Login"; + private static final String AUTH_TYPE_LABEL = "Authentifizierungsart"; + private static final String LOGIN_FORM_LABEL = "Zugangsdaten"; + + protected JRadioButton radioButtonSat; + protected JRadioButton radioButtonECP; + protected JRadioButton radioButtonTest; + protected JComboBox<Organization> idpCombo; + protected JTextField loginUsernameField; + protected JPasswordField loginPasswordField; + protected JCheckBox saveUsernameCheckbox; + protected JButton loginButton; /** * Create a new login composite @@ -53,9 +67,10 @@ public abstract class LoginWindowLayout extends JDialog { * @param mainShell * The shell it should be added to */ + @SuppressWarnings("serial") public LoginWindowLayout() { super(); - setTitle("Simple example"); + setTitle(TITLE); setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); @@ -66,7 +81,7 @@ public abstract class LoginWindowLayout extends JDialog { con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1; con.weighty = 1; - JLabel pic = new JLabel(loadImage()); + JLabel pic = new JLabel(getScaledLogo()); bag.setConstraints(pic, con); add(pic); @@ -74,18 +89,18 @@ public abstract class LoginWindowLayout extends JDialog { JPanel loginTypePanel = new JPanel(); loginTypePanel.setLayout(new BoxLayout(loginTypePanel, BoxLayout.PAGE_AXIS)); loginTypePanel.setBorder(new TitledBorder(UIManager - .getBorder("TitledBorder.border"), "Authentifizierungsart", - TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255))); + .getBorder("TitledBorder.border"), AUTH_TYPE_LABEL, + TitledBorder.LEADING, TitledBorder.TOP, null, Color.WHITE)); // radio button group for login type ButtonGroup bg = new ButtonGroup(); - JRadioButton radioButtonTest = new JRadioButton("Test-Zugang mit festem Benutzer"); - JRadioButton radioButtonECP = new JRadioButton("Authentifizierung über bwIDM"); - JRadioButton radioButtonSat = new JRadioButton("Direkter Zugang zum Satelliten"); - bg.add(radioButtonTest); + radioButtonECP = new JRadioButton("Authentifizierung über bwIDM"); + radioButtonTest = new JRadioButton("Test-Zugang mit festem Benutzer"); + radioButtonSat = new JRadioButton("Direkter Zugang zum Satelliten"); bg.add(radioButtonECP); + bg.add(radioButtonTest); bg.add(radioButtonSat); + loginTypePanel.add(radioButtonECP); loginTypePanel.add(radioButtonTest); - loginTypePanel.add(radioButtonECP); loginTypePanel.add(radioButtonSat); con.gridwidth = 1; bag.setConstraints(loginTypePanel, con); @@ -99,14 +114,22 @@ public abstract class LoginWindowLayout extends JDialog { formCon.gridwidth = 1; loginFormPanel.setLayout(new BoxLayout(loginFormPanel, BoxLayout.PAGE_AXIS)); loginFormPanel.setBorder(new TitledBorder(UIManager - .getBorder("TitledBorder.border"), "Authentifizierungsart", + .getBorder("TitledBorder.border"), LOGIN_FORM_LABEL, TitledBorder.LEADING, TitledBorder.TOP, null, new Color(255, 255, 255))); + // idp stuff + JLabel labelIdp = new JLabel("Identity Provider"); + formBag.setConstraints(labelIdp, formCon); + loginFormPanel.add(labelIdp); + idpCombo = new JComboBox<Organization>(); + formCon.gridwidth = GridBagConstraints.REMAINDER; + formBag.setConstraints(idpCombo, formCon); + loginFormPanel.add(idpCombo); // label + field for username JLabel labelUsername = new JLabel("Benutzername:"); - JTextField loginUsernameField = new JTextField(); - loginUsernameField - .setToolTipText("Bitte geben Sie Ihren Benutzernamen ein."); + loginUsernameField = new JTextField(); + loginUsernameField.setToolTipText("Bitte geben Sie Ihren Benutzernamen ein."); loginUsernameField.setColumns(10); + formCon.gridwidth = 1; formBag.setConstraints(labelUsername, formCon); formCon.gridwidth = GridBagConstraints.REMAINDER; formBag.setConstraints(loginUsernameField, formCon); @@ -116,9 +139,8 @@ public abstract class LoginWindowLayout extends JDialog { loginFormPanel.setLayout(formBag); // label + field for password JLabel labelPassword = new JLabel("Passwort:"); - JPasswordField loginPasswordField = new JPasswordField(); - loginPasswordField - .setToolTipText("Bitte geben Sie Ihren Passwort ein."); + loginPasswordField = new JPasswordField(); + loginPasswordField.setToolTipText("Bitte geben Sie Ihren Passwort ein."); loginPasswordField.setColumns(10); formCon.gridwidth = 1; formBag.setConstraints(labelPassword, formCon); @@ -126,7 +148,9 @@ public abstract class LoginWindowLayout extends JDialog { formCon.gridwidth = GridBagConstraints.REMAINDER; formBag.setConstraints(loginPasswordField, formCon); loginFormPanel.add(loginPasswordField); - JButton loginButton = new JButton("Login"); + saveUsernameCheckbox = new JCheckBox("Benutzername speichern"); + loginFormPanel.add(saveUsernameCheckbox); + loginButton = new JButton("Login"); formCon.gridwidth = 1; formCon.gridx = 1; formBag.setConstraints(loginButton, formCon); @@ -138,7 +162,10 @@ public abstract class LoginWindowLayout extends JDialog { pack(); } - private ImageIcon loadImage() { + /** + * @return ImageIcon of the standard bwLehrpool logo scaled to the login window size + */ + private ImageIcon getScaledLogo() { try { ImageIcon image = ResourceLoader.getIcon("/img/Logo_bwLehrpool.png"); java.awt.Rectangle screenSize = Gui.getMonitorFromRectangle(getBounds(), true).getDefaultConfiguration().getBounds(); |