summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java
diff options
context:
space:
mode:
authorJonathan Bauer2016-01-15 15:11:17 +0100
committerJonathan Bauer2016-01-15 15:11:17 +0100
commit3116013b4f3881ea8c4f3373ce189b948b653375 (patch)
treee1e2f21ce7030242d900236dabf51e689a8876be /dozentenmodul/src/main/java
parent[server] Add location support/filtering (diff)
downloadtutor-module-3116013b4f3881ea8c4f3373ce189b948b653375.tar.gz
tutor-module-3116013b4f3881ea8c4f3373ce189b948b653375.tar.xz
tutor-module-3116013b4f3881ea8c4f3373ce189b948b653375.zip
[client] added "Schliessen"/"Speichern" buttons to LocationSelectionWindow
Diffstat (limited to 'dozentenmodul/src/main/java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java22
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java17
2 files changed, 38 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
index e178a9c3..b7807cd5 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
@@ -1,6 +1,8 @@
package org.openslx.dozmod.gui.window;
import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
@@ -23,6 +25,16 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple
*/
public LocationSelectionWindow(Window modalParent, List<Integer> locations) {
super(modalParent, locations);
+
+ // listeners for the buttons
+ btnClose.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ safeClose();
+ }
+ });
+ // disable "Save" button at first since nothing changed
+ btnSaveChanges.setEnabled(false);
Gui.centerShellOverShell(modalParent, this);
}
@@ -50,6 +62,16 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple
});
}
+ /**
+ * Helper called during the closing of this window to check.
+ * Checks for unsaved changes and ask for confirmation to quit if any are
+ * detected.
+ */
+ private void safeClose() {
+ // TODO check for changes and ask for confirmation if there are any
+ dispose();
+ }
+
@Override
public boolean wantConfirmQuit() {
return false;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
index 7eaf300e..ee06692d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
@@ -4,7 +4,11 @@ import java.awt.Window;
import java.util.List;
import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
import javax.swing.JDialog;
+import javax.swing.JPanel;
import javax.swing.JSeparator;
import org.openslx.dozmod.gui.Gui;
@@ -15,7 +19,8 @@ import org.openslx.dozmod.gui.helper.GridManager;
public class LocationSelectionWindowLayout extends JDialog {
protected LocationSelector locationSelector;
-
+ protected JButton btnSaveChanges;
+ protected JButton btnClose;
public LocationSelectionWindowLayout(Window modalParent, List<Integer> locationList) {
super(modalParent);
@@ -29,6 +34,16 @@ public class LocationSelectionWindowLayout extends JDialog {
grid.add(new JSeparator());
grid.nextRow();
grid.add(locationSelector).fill(true, true).expand(true, true);
+ grid.nextRow();
+ // button panel on the bottom
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
+ btnClose = new JButton("Schließen");
+ btnSaveChanges = new JButton("Speichern");
+ buttonPanel.add(Box.createHorizontalGlue());
+ buttonPanel.add(btnClose);
+ buttonPanel.add(btnSaveChanges);
+ grid.add(buttonPanel).fill(true, false).expand(true, false);
grid.finish(false);
setPreferredSize(Gui.getScaledDimension(600, 350));
pack();