diff options
author | Jonathan Bauer | 2016-03-03 18:01:37 +0100 |
---|---|---|
committer | Jonathan Bauer | 2016-03-03 18:01:37 +0100 |
commit | f6a0867f2d8235a9c38c06dc0702c6e948928bcf (patch) | |
tree | bcd38a61059097cf559d6f4b8898628285871fce /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard | |
parent | [client] add 10px border to wizard's footer (diff) | |
download | tutor-module-f6a0867f2d8235a9c38c06dc0702c6e948928bcf.tar.gz tutor-module-f6a0867f2d8235a9c38c06dc0702c6e948928bcf.tar.xz tutor-module-f6a0867f2d8235a9c38c06dc0702c6e948928bcf.zip |
[client/server] add support for advanced configuration for usb/netrules stuff
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard')
3 files changed, 69 insertions, 17 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 6d88cb90..577cd16e 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 @@ -15,8 +15,8 @@ import org.openslx.dozmod.gui.window.LectureListWindow; import org.openslx.dozmod.gui.wizard.page.LectureCreationPage; import org.openslx.dozmod.gui.wizard.page.LectureCustomPermissionPage; import org.openslx.dozmod.gui.wizard.page.LectureImageListPage; -import org.openslx.dozmod.gui.wizard.page.LectureOptionsPage; import org.openslx.dozmod.gui.wizard.page.LectureLocationSelectionPage; +import org.openslx.dozmod.gui.wizard.page.LectureOptionsPage; import org.openslx.dozmod.state.LectureWizardState; import org.openslx.dozmod.thrift.Session; import org.openslx.dozmod.thrift.ThriftActions; @@ -137,8 +137,10 @@ public class LectureWizard extends Wizard implements UiFeedback { } private LectureWrite lectureWriteFromState() { - return new LectureWrite(state.name, state.description, state.imageVersionId, state.autoUpdate, - state.isEnabled, state.start.getTime() / 1000L, state.end.getTime() / 1000L, null, null, - state.isExam, state.internetAccess, state.defaultPermissions, state.locations, state.onlyInSelectedLocations, false); + LectureWrite lw = new LectureWrite(state.name, state.description, state.imageVersionId, state.autoUpdate, + state.isEnabled, state.start.getTime() / 1000L, state.end.getTime() / 1000L, state.runScriptText, null, + state.isExam, state.internetAccess, state.defaultPermissions, state.locations, state.onlyInSelectedLocations, false, state.usbAllowed); + lw.networkExceptions = state.netRules; + return lw; } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java index ac29393c..6dc9e85c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java @@ -1,6 +1,10 @@ package org.openslx.dozmod.gui.wizard.layout; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JLabel; import org.openslx.dozmod.gui.helper.GridManager; import org.openslx.dozmod.gui.wizard.Wizard; @@ -11,10 +15,12 @@ public abstract class LectureOptionsPageLayout extends WizardPage { protected static String title = "Zusätzliche Optionen"; + protected final JCheckBox chkUsbEnabled; protected final JCheckBox chkInternetEnabled; protected final JCheckBox chkIsExam; protected final JCheckBox chkAutoUpdate; protected final JCheckBox chkIsActive; + protected final JButton btnAdvanced; /** * Page for additional options of lecture @@ -22,26 +28,48 @@ public abstract class LectureOptionsPageLayout extends WizardPage { public LectureOptionsPageLayout(Wizard wizard) { super(wizard, title); setDescription("Bitte wählen Sie aus folgenden Optionen aus:"); - GridManager grid = new GridManager(this, 1); + GridManager grid = new GridManager(this, 2); - // Options related to exams - chkIsExam = new JCheckBox("Veranstaltung ist eine Prüfung"); + // first column for labels hopefully clearing up some of the mess... + // first category for general options + JLabel lblGeneral = new JLabel("Allgemeines"); + grid.add(lblGeneral); + chkAutoUpdate = new JCheckBox("Immer auf aktuellste VM-Version updaten", true); + grid.add(chkAutoUpdate); + grid.nextRow(); + + chkIsActive = new JCheckBox("Veranstaltung ist aktiv", true); + grid.skip(); + grid.add(chkIsActive); + grid.nextRow(); + + chkIsExam = new JCheckBox("Veranstaltung ist eine Prüfung", false); + grid.skip(); grid.add(chkIsExam); grid.nextRow(); + grid.add(Box.createVerticalStrut(10), 2); + grid.nextRow(); + // second category for restrictions options + JLabel lblRestriction = new JLabel("Beschränkungen"); + grid.add(lblRestriction); + chkInternetEnabled = new JCheckBox("Internet verfügbar", true); grid.add(chkInternetEnabled); grid.nextRow(); - chkAutoUpdate = new JCheckBox("Immer auf aktuellste VM-Version updaten", true); - grid.add(chkAutoUpdate); + chkUsbEnabled = new JCheckBox("USB-Geräte zulassen", true); + grid.skip(); + grid.add(chkUsbEnabled); grid.nextRow(); - chkIsActive = new JCheckBox("Vorlesung ist aktiv", true); - grid.add(chkIsActive); + btnAdvanced = new JButton("Erweiterte Einstellung"); + grid.add(Box.createVerticalStrut(10), 2); + grid.nextRow(); + grid.skip(); + grid.add(btnAdvanced); grid.nextRow(); grid.finish(true); - } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java index 7a3f1f6e..38522954 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java @@ -1,6 +1,13 @@ package org.openslx.dozmod.gui.wizard.page; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.SwingUtilities; + import org.apache.log4j.Logger; +import org.openslx.dozmod.gui.control.AdvancedConfigurator.AdvancedConfiguration; +import org.openslx.dozmod.gui.window.LectureAdvancedSettingsWindow; import org.openslx.dozmod.gui.wizard.Wizard; import org.openslx.dozmod.gui.wizard.layout.LectureOptionsPageLayout; import org.openslx.dozmod.state.LectureWizardState; @@ -8,19 +15,31 @@ import org.openslx.dozmod.state.LectureWizardState; @SuppressWarnings("serial") public class LectureOptionsPage extends LectureOptionsPageLayout { - private final static Logger LOGGER = Logger.getLogger(LectureOptionsPage.class); - + private LectureOptionsPage me = this; private LectureWizardState state = null; + private AdvancedConfiguration currentConf = new AdvancedConfiguration(null, null); /** * Page for lecture options */ - public LectureOptionsPage(Wizard wizard, LectureWizardState state) { + public LectureOptionsPage(final Wizard wizard, LectureWizardState state) { super(wizard); this.state = state; - setPageComplete(true); + this.currentConf = new AdvancedConfiguration(state.netRules, state.runScriptText); - //TODO Temporarily disabled until implemented + setPageComplete(true); + btnAdvanced.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + AdvancedConfiguration newConf = LectureAdvancedSettingsWindow.open( + SwingUtilities.getWindowAncestor(me), currentConf); + if (newConf != null) { + currentConf = newConf; + updateState(); + } + } + }); + // TODO Temporarily disabled until implemented chkIsExam.setEnabled(false); chkInternetEnabled.setEnabled(false); } @@ -38,6 +57,9 @@ public class LectureOptionsPage extends LectureOptionsPageLayout { state.autoUpdate = chkAutoUpdate.isSelected(); state.internetAccess = chkInternetEnabled.isSelected(); state.isEnabled = chkIsActive.isSelected(); + state.usbAllowed = chkUsbEnabled.isSelected(); + state.netRules = currentConf.netRulesList; + state.runScriptText = currentConf.runScriptText; setDescription("Klicken Sie auf 'Weiter' für Berechtigungen oder 'Fertigstellen'."); return true; |