diff options
| author | Stephan Schwaer | 2015-08-12 17:17:19 +0200 |
|---|---|---|
| committer | Stephan Schwaer | 2015-08-12 17:17:19 +0200 |
| commit | a15c4659d8dc004c52590f0179f11012f3938e52 (patch) | |
| tree | 4c94142576815e7a8cd84594ecd2562abccbc490 /dozentenmodul/src/main/java | |
| parent | [client] Don't log noncritical msgbox (diff) | |
| download | tutor-module-a15c4659d8dc004c52590f0179f11012f3938e52.tar.gz tutor-module-a15c4659d8dc004c52590f0179f11012f3938e52.tar.xz tutor-module-a15c4659d8dc004c52590f0179f11012f3938e52.zip | |
[client] splitted lecture creation page into 2 creation- and options page
Diffstat (limited to 'dozentenmodul/src/main/java')
5 files changed, 117 insertions, 49 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 2b25c97c..c008dbfe 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 @@ -12,6 +12,7 @@ import org.openslx.dozmod.gui.helper.UiFeedback; 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.LectureOptionsPage; import org.openslx.dozmod.state.LectureWizardState; import org.openslx.dozmod.thrift.LectureCache; import org.openslx.dozmod.thrift.Session; @@ -41,6 +42,7 @@ public class LectureWizard extends Wizard implements UiFeedback { // create the shared object for all pages of the wizard addPage(new LectureCreationPage(this, state)); + addPage(new LectureOptionsPage(this, state)); addPage(new LectureCustomPermissionPage(this, state)); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java index 818c1b22..f282cf7f 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java @@ -34,13 +34,7 @@ public abstract class LectureCreationPageLayout extends WizardPage { protected JDatePickerImpl endDate; protected JSpinner startTime; protected JSpinner endTime; - protected JCheckBox networkAccessCheck; - protected JCheckBox examCheck; - protected JCheckBox autoUpdate; - // permissions checks - protected JCheckBox editPermissionsCheck; - protected JCheckBox adminPermissionsCheck; - protected JCheckBox enabledCheck; + private static final Properties pickerStrings = new Properties(); @@ -80,7 +74,7 @@ public abstract class LectureCreationPageLayout extends WizardPage { grid.add(descPane, 2, 1).fill(true, false); grid.nextRow(); - + // Start date/time JLabel startDateLabel = new JLabel("Startdatum"); startDate = new JDatePickerImpl(new JDatePanelImpl(new UtilDateModel(new Date()), pickerStrings), @@ -99,37 +93,8 @@ public abstract class LectureCreationPageLayout extends WizardPage { grid.add(endDate).fill(true, false).expand(true, false); grid.add(endTime); grid.nextRow(); - - grid.add(Box.createVerticalStrut(10), 3, 1); - - // Options related to exams - examCheck = new JCheckBox("Veranstaltung ist eine Prüfung"); - grid.add(examCheck, 3, 1); - grid.nextRow(); - - networkAccessCheck = new JCheckBox("Internet verfügbar"); - grid.add(networkAccessCheck, 3, 1); - grid.nextRow(); - - autoUpdate = new JCheckBox("Aktuellste Imageversion verwenden"); - grid.add(autoUpdate, 3, 1); - grid.nextRow(); - grid.add(Box.createVerticalStrut(10), 3, 1); - // -- default permissions group -- - JPanel permissionsGroup = new JPanel(); - permissionsGroup.setBorder(new TitledBorder("Standardberechtigungen")); - editPermissionsCheck = new JCheckBox("Bearbeiten"); - adminPermissionsCheck = new JCheckBox("Administrieren"); - permissionsGroup.add(editPermissionsCheck); - permissionsGroup.add(adminPermissionsCheck); - grid.add(permissionsGroup, 3, 1).fill(true, true); - grid.nextRow(); - enabledCheck = new JCheckBox("Vorlesung ist aktiv", true); - grid.add(enabledCheck, 3, 1); - grid.add(Box.createVerticalGlue(), 3, 1).fill(true, true); - grid.finish(true); } 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 new file mode 100644 index 00000000..5ee56faa --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java @@ -0,0 +1,69 @@ +package org.openslx.dozmod.gui.wizard.layout; + +import javax.swing.Box; +import javax.swing.JCheckBox; +import javax.swing.JPanel; +import javax.swing.border.TitledBorder; + +import org.openslx.dozmod.gui.helper.GridManager; +import org.openslx.dozmod.gui.wizard.Wizard; +import org.openslx.dozmod.gui.wizard.WizardPage; + +@SuppressWarnings("serial") +public abstract class LectureOptionsPageLayout extends WizardPage { + + protected static String title = "Zusätzliche Optionen"; + + + protected JCheckBox networkAccessCheck; + protected JCheckBox examCheck; + protected JCheckBox autoUpdate; + protected JCheckBox enabledCheck; + // permissions checks + protected JCheckBox editPermissionsCheck; + protected JCheckBox adminPermissionsCheck; + + + /** + * Page for additional options of lecture + */ + public LectureOptionsPageLayout(Wizard wizard) { + super(wizard, title); + setDescription("Bitte legen Sie die folgenden Optionen fest"); + GridManager grid = new GridManager(this, 3, false); + + // Options related to exams + examCheck = new JCheckBox("Veranstaltung ist eine Prüfung"); + grid.add(examCheck, 3, 1); + grid.nextRow(); + + networkAccessCheck = new JCheckBox("Internet verfügbar", true); + grid.add(networkAccessCheck, 3, 1); + grid.nextRow(); + + autoUpdate = new JCheckBox("Aktuellste Imageversion verwenden", true); + grid.add(autoUpdate, 3, 1); + grid.nextRow(); + + enabledCheck = new JCheckBox("Vorlesung ist aktiv", true); + grid.add(enabledCheck, 3, 1); + grid.nextRow(); + + grid.add(Box.createVerticalStrut(10), 3, 1); + + // -- default permissions group -- + JPanel permissionsGroup = new JPanel(); + permissionsGroup.setBorder(new TitledBorder("Standardberechtigungen")); + editPermissionsCheck = new JCheckBox("Bearbeiten"); + adminPermissionsCheck = new JCheckBox("Administrieren"); + permissionsGroup.add(editPermissionsCheck); + permissionsGroup.add(adminPermissionsCheck); + grid.add(permissionsGroup, 3, 1).fill(true, true); + grid.nextRow(); + + grid.add(Box.createVerticalGlue(), 3, 1).fill(true, true); + + grid.finish(true); + + } +} diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java index 2bd9c98f..31e1b837 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java @@ -27,9 +27,6 @@ public class LectureCreationPage extends LectureCreationPageLayout { /** * Page for creating lectures - * - * @param editExistingLecture whether to edit existing lecture or create new - * one */ public LectureCreationPage(Wizard wizard, LectureWizardState state) { super(wizard, state.image.imageName); @@ -74,8 +71,6 @@ public class LectureCreationPage extends LectureCreationPageLayout { endTime.addChangeListener(changeListener); startDate.addActionListener(actionListener); endDate.addActionListener(actionListener); - editPermissionsCheck.addActionListener(actionListener); - adminPermissionsCheck.addActionListener(actionListener); } @Override @@ -123,13 +118,6 @@ public class LectureCreationPage extends LectureCreationPageLayout { state.start = start; state.end = end; } - // always save checkboxes if we get this far - state.autoUpdate = autoUpdate.isSelected(); - state.isEnabled = enabledCheck.isSelected(); - state.isExam = examCheck.isSelected(); - state.internetAccess = networkAccessCheck.isSelected(); - state.defaultPermissions = new LecturePermissions(editPermissionsCheck.isSelected(), - adminPermissionsCheck.isSelected()); setDescription("Klicken Sie auf 'Weiter' für Berechtigungen oder 'Fertigstellen'"); return 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 new file mode 100644 index 00000000..a32ff0c7 --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java @@ -0,0 +1,44 @@ +package org.openslx.dozmod.gui.wizard.page; + +import org.apache.log4j.Logger; +import org.openslx.bwlp.thrift.iface.LecturePermissions; +import org.openslx.dozmod.gui.wizard.Wizard; +import org.openslx.dozmod.gui.wizard.layout.LectureOptionsPageLayout; +import org.openslx.dozmod.state.LectureWizardState; + +@SuppressWarnings("serial") +public class LectureOptionsPage extends LectureOptionsPageLayout { + + private final static Logger LOGGER = Logger.getLogger(LectureOptionsPage.class); + + private LectureWizardState state = null; + + /** + * Page for lecture options + */ + public LectureOptionsPage(Wizard wizard, LectureWizardState state) { + super(wizard); + this.state = state; + setPageComplete(true); + } + + @Override + protected boolean wantNextOrFinish() { + return updateState(); + } + + /** + * Set the selected options in state + */ + private boolean updateState() { + state.isExam = examCheck.isSelected(); + state.autoUpdate = autoUpdate.isSelected(); + state.internetAccess = networkAccessCheck.isSelected(); + state.isEnabled = enabledCheck.isSelected(); + + state.defaultPermissions = new LecturePermissions(editPermissionsCheck.isSelected(), + adminPermissionsCheck.isSelected()); + setDescription("Klicken Sie auf 'Weiter' für Berechtigungen oder 'Fertigstellen'"); + return true; + } +} |
