summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page
diff options
context:
space:
mode:
authorJonathan Bauer2015-12-18 16:57:26 +0100
committerJonathan Bauer2015-12-18 16:57:26 +0100
commitca397e4a2ca4b4983d6546ce6dfafcf8a4c55b56 (patch)
treeea03c8adc4cffb5e5a50932f209de03f62c73b94 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page
parent[client] don't scroll the pane for the changelog to the bottom, always force ... (diff)
downloadtutor-module-ca397e4a2ca4b4983d6546ce6dfafcf8a4c55b56.tar.gz
tutor-module-ca397e4a2ca4b4983d6546ce6dfafcf8a4c55b56.tar.xz
tutor-module-ca397e4a2ca4b4983d6546ce6dfafcf8a4c55b56.zip
[client] room selection widget [wip]
new wizard page in the lecture wizard new button "Raumauswahl" LectureDetailsWindow
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureRoomSelectionPage.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureRoomSelectionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureRoomSelectionPage.java
new file mode 100644
index 00000000..7ea2e46b
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureRoomSelectionPage.java
@@ -0,0 +1,57 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+
+import org.apache.log4j.Logger;
+import org.openslx.bwlp.thrift.iface.Location;
+import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.layout.LectureRoomSelectionPageLayout;
+import org.openslx.dozmod.state.LectureWizardState;
+import org.openslx.dozmod.thrift.cache.MetaDataCache;
+import org.openslx.util.QuickTimer;
+import org.openslx.util.QuickTimer.Task;
+
+@SuppressWarnings("serial")
+public class LectureRoomSelectionPage extends LectureRoomSelectionPageLayout {
+
+ private final static Logger LOGGER = Logger.getLogger(LectureRoomSelectionPage.class);
+
+ private LectureWizardState state = null;
+
+ public LectureRoomSelectionPage(Wizard wizard, LectureWizardState state) {
+ super(wizard);
+ setPageComplete(true);
+ this.state = state;
+
+ }
+
+ @Override
+ protected boolean wantNextOrFinish() {
+ return updateState();
+ }
+
+ private boolean updateState() {
+ DefaultListModel<Location> selectedRoomModel = roomSelector.getSelectedRoomModel();
+ if (selectedRoomModel != null && selectedRoomModel.elements() != null) {
+ // prepare the final list
+ if (state.locations == null) {
+ state.locations = new ArrayList<Integer>();
+ } else {
+ state.locations.clear();
+ }
+ List<Location> selectedRoomList = Collections.list(selectedRoomModel.elements());
+ for (Location loc : selectedRoomList) {
+ state.locations.add(loc.getLocationId());
+ }
+ } else {
+ // allow empty room selection?
+ return false;
+ }
+ return true;
+ }
+}