From cc93d6c71f1b51a122fae70fcde869c71bb07f1e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 28 Jul 2015 18:46:59 +0200 Subject: [client] Fix bwLehrstuhl --- .../java/org/openslx/dozmod/gui/MainWindow.java | 11 ++-- .../org/openslx/dozmod/gui/window/LoginWindow.java | 13 ++-- .../openslx/dozmod/gui/window/MainMenuWindow.java | 2 + .../gui/window/layout/LectureListWindowLayout.java | 76 ++++++++++------------ .../gui/window/layout/LoginWindowLayout.java | 8 +-- 5 files changed, 57 insertions(+), 53 deletions(-) diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java index b8ea83d2..496c1e25 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java @@ -152,26 +152,29 @@ public abstract class MainWindow { registerPage(new MainMenuWindow()); //registerPage(new ImageListWindow()); //registerPage(new LectureListWindow()); - // Show main menu by default - showPage(MainMenuWindow.class); // center the window on the primary monitor mainWindow.getContentPane().add(mainContainer, BorderLayout.CENTER); mainWindow.setVisible(true); + Gui.centerShell(mainWindow); Gui.limitShellSize(mainWindow); - + // here we can check for Session information if (Session.getSatelliteToken() != null) { // Wait for proxy server init App.waitForInit(); // TODO: Try to resume session } + // Session resume probably failed, show login window if (Session.getSatelliteToken() == null) { // User did not login, show the login mask - LoginWindow.open(); + LoginWindow.open(mainWindow); } + + // Show main menu by default + showPage(MainMenuWindow.class); } /** 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 d38e5409..0df9cb04 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,6 +1,7 @@ package org.openslx.dozmod.gui.window; import java.awt.Component; +import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -27,6 +28,7 @@ import org.openslx.dozmod.authentication.ShibbolethEcp; import org.openslx.dozmod.authentication.ShibbolethEcp.ReturnCode; import org.openslx.dozmod.authentication.TestAccountAuthenticator; import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.window.layout.LoginWindowLayout; import org.openslx.dozmod.thrift.OrganizationCache; @@ -65,9 +67,9 @@ public class LoginWindow extends LoginWindowLayout { private final String NO_USERNAME = "Kein Benutzername angegeben!"; private final String NO_PASSWORD = "Kein Passwort angegeben!"; - public LoginWindow() { + public LoginWindow(Frame modalParent) { // call the constructor of the superclass - super(); + super(modalParent); // first do all listeners stuff for (final LOGIN_TYPE type : LOGIN_TYPE.values()) { @@ -350,7 +352,10 @@ public class LoginWindow extends LoginWindowLayout { /** * Opens the login window */ - public static void open() { - new LoginWindow().setVisible(true); + public static void open(Frame modalParent) { + + LoginWindow win = new LoginWindow(modalParent); + MainWindow.centerShell(win); + win.setVisible(true); } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java index 328f6570..a4a73510 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java @@ -10,6 +10,7 @@ import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JButton; +import org.openslx.dozmod.App; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.window.layout.MainMenuWindowLayout; @@ -90,6 +91,7 @@ public class MainMenuWindow extends MainMenuWindowLayout { if (once) return; once = true; + App.waitForInit(); QuickTimer.scheduleOnce(new Task() { String[] terms = new String[] { "lehrpool", "dnbd3", "lehrstuhl", "dozmod", "lehrpool-suite", "java", "hund", "katze", "maus" }; diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java index eea13ceb..14708376 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java @@ -1,24 +1,21 @@ package org.openslx.dozmod.gui.window.layout; +import java.awt.Button; +import java.awt.Composite; +import java.awt.Font; import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Label; +import java.security.acl.Group; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.control.table.LectureTable; import org.openslx.dozmod.gui.helper.CompositePage; import org.openslx.dozmod.gui.helper.LectureListFilter; @@ -34,25 +31,24 @@ public abstract class LectureListWindowLayout extends CompositePage { protected String filterGroupLabel = "Filter"; // buttons - protected Button newButton; - protected Button deleteButton; - protected Button editButton; - protected Button backButton; - + protected JButton newButton; + protected JButton deleteButton; + protected JButton editButton; + protected JButton backButton; // imageDetail texts - protected Text lectureName; - protected Text idInfo; - protected Text imageBaseId; - protected Text lastusedInfo; - protected Text permissionInfo; - protected Text ownerInfo; - protected Text startTime; - protected Text endTime; - - protected final Text searchTextField; - - protected final TableViewer tableViewer; + protected JTextField lectureName; + protected JTextField idInfo; + protected JTextField imageBaseId; + protected JTextField lastusedInfo; + protected JTextField permissionInfo; + protected JTextField ownerInfo; + protected JTextField startTime; + protected JTextField endTime; + + protected final JTextField searchTextField; + + protected final LectureTable lectureTable; protected LectureListFilter filter; protected String infoTextString = "Hier können Sie Veranstaltungen anlegen, bearbeiten und löschen."; @@ -60,12 +56,11 @@ public abstract class LectureListWindowLayout extends CompositePage { public LectureListWindowLayout() { super(new GridBagLayout()); - // the layout and layoutData of the LectureListWindow - this.setLayout(new GridLayout(2, false)); - this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - // -- info group with title and text -- - Composite infoComposite = new Composite(this, SWT.BORDER); + JPanel infoComposite = new JPanel(); + infoComposite.setLayout(new BoxLayout(infoComposite, BoxLayout.PAGE_AXIS)); + infoComposite.setBorder(new TitledBorder(infoTitleString)); + infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); // layout for the items of the group infoComposite.setLayout(new GridLayout(1, false)); @@ -75,14 +70,14 @@ public abstract class LectureListWindowLayout extends CompositePage { infoTitle.setText(infoTitleString); // set the fond FontData fontData = infoTitle.getFont().getFontData()[0]; - final Font titleFont = new Font(Gui.display, new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD)); + final Font titleFont = new Font(Gui.display, new FontData(fontData.getName(), fontData.getHeight(), + SWT.BOLD)); infoTitle.setFont(titleFont); // the infotext Label infoText = new Label(infoComposite, SWT.NONE); infoText.setText(infoTextString); // -- end group of title -- - // -- group for the table -- Group tableGroup = new Group(this, SWT.BORDER); tableGroup.setText(tableGroupLabel); @@ -117,7 +112,6 @@ public abstract class LectureListWindowLayout extends CompositePage { tableViewer = new TableViewer(vmTable); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); - // create, modify and delete buttons Composite buttonComposite = new Composite(tableGroup, SWT.NONE); GridData buttonCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true, false); 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 1494967f..0654e448 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 @@ -2,6 +2,7 @@ package org.openslx.dozmod.gui.window.layout; import java.awt.Color; import java.awt.Component; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -77,10 +78,8 @@ public abstract class LoginWindowLayout extends JDialog { * The shell it should be added to */ @SuppressWarnings("serial") - public LoginWindowLayout() { - super(); - setTitle(TITLE); - setLocationRelativeTo(null); + public LoginWindowLayout(Frame modalParent) { + super(modalParent, TITLE, ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); GridBagLayout bag = new GridBagLayout(); @@ -184,6 +183,7 @@ public abstract class LoginWindowLayout extends JDialog { bag.setConstraints(loginFormPanel, con); add(loginFormPanel); pack(); + validate(); } /** -- cgit v1.2.3-55-g7522