summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
diff options
context:
space:
mode:
authorSteffen Ritter2018-06-15 11:59:45 +0200
committerSteffen Ritter2018-06-15 11:59:45 +0200
commit34a919c138ef29fa3a4f515d466a984e85e1ad1d (patch)
treeac645a5eb042c47fe21eb196c42dc14240c3e2d7 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
parentAdd support for LDAP lecture filters (diff)
downloadtutor-module-34a919c138ef29fa3a4f515d466a984e85e1ad1d.tar.gz
tutor-module-34a919c138ef29fa3a4f515d466a984e85e1ad1d.tar.xz
tutor-module-34a919c138ef29fa3a4f515d466a984e85e1ad1d.zip
[client] Add privacy notice window
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
new file mode 100755
index 00000000..4660c8b6
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
@@ -0,0 +1,82 @@
+package org.openslx.dozmod.gui.window;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JFrame;
+
+import org.apache.log4j.Logger;
+import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.MessageType;
+import org.openslx.dozmod.gui.helper.UiFeedback;
+import org.openslx.dozmod.gui.window.layout.GenericNoticeWindowLayout;
+
+/**
+ * Window for showing the notice.
+ */
+@SuppressWarnings("serial")
+public abstract class GenericNoticeWindow extends GenericNoticeWindowLayout implements UiFeedback {
+
+ final GenericNoticeWindow me = this;
+
+ private final static Logger LOGGER = Logger.getLogger(GenericNoticeWindow.class);
+ private boolean shouldBeShown = true;
+
+ public GenericNoticeWindow(Frame modalParent, boolean shouldBeShown) {
+ super(modalParent);
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+
+ this.shouldBeShown = shouldBeShown;
+
+ // agree box toggles the "Continue" button
+ chkAgreeBox.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ btnContinue.setEnabled(chkAgreeBox.isSelected());
+ }
+ });
+
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ closeWindow();
+ }
+ });
+ if (!shouldBeShown) {
+ chkAgreeBox.setVisible(false);
+ btnContinue.setText("Schließen");
+ btnContinue.setEnabled(true);
+ }
+ }
+
+ @Override
+ public boolean wantConfirmQuit() {
+ return true;
+ }
+
+ @Override
+ public void escapePressed() {
+ closeWindow();
+ }
+
+ /**
+ * Check, whether to ask for confirmation, when notice hasn't been
+ * accepted or just close.
+ */
+ private void closeWindow() {
+ if (shouldBeShown) {
+ if (Gui.showMessageBox(me,
+ "Wenn diesen rechtlichen Hinweis nicht akzeptieren, können Sie die Software nicht verwenden! "
+ + "Sind Sie sicher, dass sie abbrechen wollen?", MessageType.QUESTION_YESNO,
+ LOGGER, null)) {
+ System.exit(ABORT);
+ }
+ } else {
+ me.dispose();
+ }
+ }
+
+}