summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/GuiManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/gui/GuiManager.java')
-rw-r--r--dozentenmodul/src/main/java/gui/GuiManager.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/gui/GuiManager.java b/dozentenmodul/src/main/java/gui/GuiManager.java
index ae97d90b..8e28409c 100644
--- a/dozentenmodul/src/main/java/gui/GuiManager.java
+++ b/dozentenmodul/src/main/java/gui/GuiManager.java
@@ -1,5 +1,6 @@
package gui;
+import org.apache.log4j.Logger;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -10,10 +11,14 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
public abstract class GuiManager {
+
+ private final static Logger LOGGER = Logger.getLogger(GuiManager.class);
+
static Shell mainShell;
static Composite contentComposite;
static Display display;
@@ -48,6 +53,29 @@ public abstract class GuiManager {
}
}
+ // TODO use showMessageBox
+ public static void showMessage(final String message) {
+ MessageBox msgBox = new MessageBox(mainShell, SWT.ICON_INFORMATION);
+ msgBox.setText("Information");
+ msgBox.setMessage(message);
+ int ret = msgBox.open();
+ }
+// /**
+// * Generic helper to show a message box to the user, and optionally log the message to the log file.
+// *
+// * @param message Message to display. Can be multi line.
+// * @param messageType Type of message (warning, information)
+// * @param logger Logger instance to log to. Can be null.
+// * @param exception Exception related to this message. Can be null.
+// */
+// public static void showMessageBox(String message, MessageType messageType, Logger logger,
+// Throwable exception) {
+// if (logger != null)
+// logger.log(messageType.logPriority, message, exception);
+// if (exception != null)
+// message += "\n\n" + exception.getClass().getSimpleName();
+// JOptionPane.showMessageDialog(mainWindow, message, messageType.title, messageType.optionPaneId);
+// }
public static Display getDisplay(){
return display;
@@ -80,7 +108,7 @@ public abstract class GuiManager {
// Set layout for the mainshell, items added to the shell should get a gridData
mainShell.setLayout(new GridLayout(1, true));
- addContent(new gui.core.LoginComposite(mainShell));
+ addContent(new gui.core.LoginGUI(mainShell));
// center the window on the primary monitor
@@ -96,6 +124,7 @@ public abstract class GuiManager {
mainShell.pack();
mainShell.open();
+ LOGGER.info("GUI initialised.");
while (!mainShell.isDisposed()) {
if (!display.readAndDispatch())