diff options
| author | Jonathan Bauer | 2015-07-09 11:37:25 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-07-09 11:37:25 +0200 |
| commit | dfdbaebc0deb0f04a9db706f92bf57a4f7d7bada (patch) | |
| tree | 65e828334ca4a6ae6938f1c214dfe708475d702f /dozentenmodul/src | |
| parent | [client] MainWindow class, only to show it :) (diff) | |
| download | tutor-module-dfdbaebc0deb0f04a9db706f92bf57a4f7d7bada.tar.gz tutor-module-dfdbaebc0deb0f04a9db706f92bf57a4f7d7bada.tar.xz tutor-module-dfdbaebc0deb0f04a9db706f92bf57a4f7d7bada.zip | |
[client] GuiManager.openPopup first steps
Diffstat (limited to 'dozentenmodul/src')
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java | 35 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java | 7 |
2 files changed, 40 insertions, 2 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java index 6fe7b35e..f7a58f67 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GuiManager.java @@ -1,5 +1,8 @@ package org.openslx.dozmod.gui.helper; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + import org.apache.log4j.Logger; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -14,6 +17,7 @@ import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Monitor; import org.eclipse.swt.widgets.Shell; +import org.openslx.dozmod.gui.window.DisclaimerWindow; import org.openslx.thrifthelper.ThriftManager; import org.openslx.thrifthelper.ThriftManager.ErrorCallback; @@ -78,6 +82,36 @@ public abstract class GuiManager { // ignoring return code of open() for now msgBox.open(); } + + public static void openPopup(Class<?> clazz) { + Shell dialogShell = new Shell(display); + // populate dialogShell + dialogShell.setLayout(new GridLayout(1, false)); + LOGGER.debug(clazz.getDeclaredClasses()); + Constructor<?> con = null; + try { + con = clazz.getConstructor(Shell.class); + } catch (NoSuchMethodException | SecurityException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + try { + con.newInstance(dialogShell); + } catch (InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + dialogShell.layout(); + dialogShell.pack(); + dialogShell.open(); + while (!dialogShell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + } /** * @return The instance of SWT display currently in use @@ -114,6 +148,7 @@ public abstract class GuiManager { // System.exit(1); ? } else { showMessageBox(THRIFT_CONNECTION_ERROR, MessageType.ERROR, LOGGER, t); + // TODO how to actualy reconnect? return true; } } 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 75275700..105e21a2 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 @@ -23,6 +23,7 @@ import org.openslx.dozmod.authentication.ShibbolethECP.ReturnCode; import org.openslx.dozmod.gui.helper.GuiManager; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.window.layout.LoginWindowLayout; +import org.openslx.dozmod.gui.window.layout.MainWindowLayout; import org.openslx.dozmod.thrift.OrganizationCache; import org.openslx.thrifthelper.ThriftManager; @@ -326,8 +327,10 @@ public class LoginWindow extends LoginWindowLayout { ThriftManager.setSatelliteAddress( "132.230.8.113" ); // now read the config to see if the user already agreed to the disclaimer - if (!Config.getDisclaimerAgreement()) - GuiManager.addContent(new DisclaimerWindow(getShell())); + if (!Config.getDisclaimerAgreement()) { + GuiManager.addContent(new MainWindow(getShell())); + GuiManager.openPopup(DisclaimerWindow.class); + } else if (!Config.getVmwareLicenseAgreement()) GuiManager.addContent(new VirtualizerNoticeWindow(getShell())); // TODO: See MainWindowLayout comments |
