diff options
author | Simon Rettberg | 2016-01-22 09:22:27 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-01-22 09:22:27 +0100 |
commit | 2ca5c0fcc2508baa1304e9f047e34e9cf0ac336f (patch) | |
tree | 732e6b181178c14bea39c8ca0c0daf76f927e82e /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard | |
parent | [client] Remember if sat supports locations and stop querying if not (diff) | |
download | tutor-module-2ca5c0fcc2508baa1304e9f047e34e9cf0ac336f.tar.gz tutor-module-2ca5c0fcc2508baa1304e9f047e34e9cf0ac336f.tar.xz tutor-module-2ca5c0fcc2508baa1304e9f047e34e9cf0ac336f.zip |
[client] Cleanup & formatting
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard')
3 files changed, 14 insertions, 37 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java index 31469ff3..6d88cb90 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java @@ -54,8 +54,9 @@ public class LectureWizard extends Wizard implements UiFeedback { addPage(new LectureImageListPage(this, state)); addPage(new LectureOptionsPage(this, state)); addPage(new LectureCustomPermissionPage(this, state)); - if (MetaDataCache.getLocations() != null && !MetaDataCache.getLocations().isEmpty()) + if (MetaDataCache.getLocations() != null && !MetaDataCache.getLocations().isEmpty()) { addPage(new LectureLocationSelectionPage(this, state)); + } } @Override @@ -97,13 +98,15 @@ public class LectureWizard extends Wizard implements UiFeedback { uuid = ThriftActions.createLecture(JOptionPane.getFrameForComponent(this), lectureWriteFromState()); if (uuid == null) return false; - else - state.uuid = uuid; + + state.uuid = uuid; // now push the permissions if we have any - if (state.permissionMap != null && !state.permissionMap.isEmpty()) + if (state.permissionMap != null && !state.permissionMap.isEmpty()) { if (!ThriftActions.writeLecturePermissions(JOptionPane.getFrameForComponent(this), state.uuid, - state.permissionMap)) + state.permissionMap)) { return false; + } + } // all good, refresh cache and change to LectureList Gui.showMessageBox(this, "Veranstaltung erstellt!", MessageType.INFO, null, null); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java index 28c415d0..5ee2a671 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java @@ -11,11 +11,12 @@ public class LectureLocationSelectionPageLayout extends WizardPage { private final static Logger LOGGER = Logger.getLogger(LectureLocationSelectionPageLayout.class); - protected LocationSelector locationSelector = new LocationSelector(); + protected final LocationSelector locationSelector; public LectureLocationSelectionPageLayout(Wizard wizard) { super(wizard, "Raumauswahl"); setDescription("Bitte wählen Sie die Räume für diese Veranstaltung aus"); + locationSelector = new LocationSelector(); GridManager grid = new GridManager(this, 1); grid.add(locationSelector).fill(true, true).expand(true, true); grid.finish(false); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java index 40e1110c..f8f10d27 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java @@ -1,20 +1,9 @@ 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.LectureLocationSelectionPageLayout; 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 LectureLocationSelectionPage extends LectureLocationSelectionPageLayout { @@ -22,7 +11,7 @@ public class LectureLocationSelectionPage extends LectureLocationSelectionPageLa private final static Logger LOGGER = Logger.getLogger(LectureLocationSelectionPage.class); private LectureWizardState state = null; - + public LectureLocationSelectionPage(Wizard wizard, LectureWizardState state) { super(wizard); setPageComplete(true); @@ -33,26 +22,10 @@ public class LectureLocationSelectionPage extends LectureLocationSelectionPageLa protected boolean wantNextOrFinish() { return updateState(); } - + private boolean updateState() { -// DefaultListModel<Location> selectedLocationModel = locationSelector.getSelectedLocationModel(); -// if (selectedLocationModel != null && selectedLocationModel.elements() != null) { -// // prepare the final list -// if (state.locations == null) { -// state.locations = new ArrayList<Integer>(); -// } else { -// state.locations.clear(); -// } -// List<Location> selectedLocationList = Collections.list(selectedLocationModel.elements()); -// for (Location loc : selectedLocationList) { -// state.locations.add(loc.getLocationId()); -// } -// // check the state of the checkbox only if we have a selection -// state.onlyInSelectedLocations = locationSelector.getOnlyInSelection(); -// } else { -// // allow empty location selection? -// return false; -// } + // TODO return true; } + } |