diff options
author | Stephan Schwaer | 2015-07-21 17:31:28 +0200 |
---|---|---|
committer | Stephan Schwaer | 2015-07-21 17:31:28 +0200 |
commit | 3857d0928655f7e233842bc64890732c2dab2d75 (patch) | |
tree | 231b76829d6ef40ef741e66f0fd9408925a36d72 /dozentenmodul/src/main/java | |
parent | [client] Improve rendering of BlockProgressBar (diff) | |
download | tutor-module-3857d0928655f7e233842bc64890732c2dab2d75.tar.gz tutor-module-3857d0928655f7e233842bc64890732c2dab2d75.tar.xz tutor-module-3857d0928655f7e233842bc64890732c2dab2d75.zip |
[client] Added layout of LectureCreationPageLayout, added empty table for custom lecture permissions.
Diffstat (limited to 'dozentenmodul/src/main/java')
6 files changed, 187 insertions, 4 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserToLecturePermissionLink.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserToLecturePermissionLink.java new file mode 100644 index 00000000..f776cf81 --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserToLecturePermissionLink.java @@ -0,0 +1,38 @@ +package org.openslx.dozmod.gui.helper; + +import org.eclipse.swt.widgets.Button; +import org.openslx.bwlp.thrift.iface.LecturePermissions; + +/** + * Helper class for linking UserIds to permissions of a lecture. + */ +public class UserToLecturePermissionLink { + + private String userId; + private LecturePermissions permission; + + public Button adminButton; + public Button editButton; + + + public UserToLecturePermissionLink(String userId, LecturePermissions permission){ + this.setUserId(userId); + this.setPermission(permission); + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public LecturePermissions getPermission() { + return permission; + } + + public void setPermission(LecturePermissions permission) { + this.permission = permission; + } +} 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 f77016f7..87348e16 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 @@ -4,12 +4,14 @@ import org.apache.log4j.Logger; import org.eclipse.jface.wizard.Wizard; import org.openslx.dozmod.gui.wizard.layout.LectureCreationPageLayout; import org.openslx.dozmod.gui.wizard.page.LectureCreationPage; +import org.openslx.dozmod.gui.wizard.page.LectureCustomPermissionPage; public class LectureWizard extends Wizard { private final static Logger LOGGER = Logger.getLogger(LectureWizard.class); protected LectureCreationPageLayout lectureCreationPage; + protected LectureCustomPermissionPage lectureCustomPermissionPage; protected boolean editExistingLecture; /** @@ -32,8 +34,11 @@ public class LectureWizard extends Wizard { public void addPages() { // create the shared object for all pages of the wizard lectureCreationPage = new LectureCreationPage(editExistingLecture); + lectureCustomPermissionPage = new LectureCustomPermissionPage() { + }; addPage(lectureCreationPage); + addPage(lectureCustomPermissionPage); } 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 3acb05d1..61d26fe3 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 @@ -2,20 +2,30 @@ package org.openslx.dozmod.gui.wizard.layout; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DateTime; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; public abstract class LectureCreationPageLayout extends WizardPage { protected Text lectureNameTextField; protected Composite container; + protected DateTime startDate; + protected DateTime endDate; + protected DateTime startTime; + protected DateTime endTime; + protected Button networkAccessCheck; + protected Button examCheck; /** * Page for creating lectures * - * @param editExistingLecture wether to edit existing lecture or create new + * @param editExistingLecture whether to edit existing lecture or create new * one */ public LectureCreationPageLayout() { @@ -29,8 +39,53 @@ public abstract class LectureCreationPageLayout extends WizardPage { container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.verticalSpacing = 16; - container.setLayout(layout); layout.numColumns = 4; + container.setLayout(layout); + + // lecture name + Label lectureNameLabel = new Label(container, SWT.NONE); + lectureNameLabel.setText("Veranstaltungsname:"); + lectureNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + lectureNameTextField = new Text(container, SWT.BORDER | SWT.SINGLE); + lectureNameTextField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); + + // start and end date + Label startDateLabel = new Label(container, SWT.NONE); + startDateLabel.setText("Startdatum:"); + startDateLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + startDate = new DateTime (container, SWT.DATE); + startDate.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + + Label endDateLabel = new Label(container, SWT.NONE); + endDateLabel.setText("Enddatum:"); + endDateLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + endDate = new DateTime (container, SWT.DATE); + endDate.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + + // start- and end + Label endTimelabel = new Label(container, SWT.NONE); + endTimelabel.setText("Startzeit:"); + endTimelabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + startTime = new DateTime (container, SWT.TIME | SWT.SHORT); + + Label endTimeLabel = new Label(container, SWT.NONE); + endTimeLabel.setText("Endzeit:"); + endTimeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + endTime = new DateTime (container, SWT.TIME | SWT.SHORT); + + // checkboxes for network access and exam + Label networkAccessLabel = new Label(container, SWT.NONE); + networkAccessLabel.setText("Internet verfügbar:"); + networkAccessLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + networkAccessCheck = new Button (container, SWT.CHECK); + + new Label(container, SWT.NONE); + new Label(container, SWT.NONE); + + Label examLabel = new Label(container, SWT.NONE); + examLabel.setText("Prüfung:"); + examLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + examCheck = new Button (container, SWT.CHECK); setControl(container); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java new file mode 100644 index 00000000..82c3efc2 --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java @@ -0,0 +1,61 @@ +package org.openslx.dozmod.gui.wizard.layout; + +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Table; + +public abstract class LectureCustomPermissionPageLayout extends WizardPage { + + protected Composite container; + protected TableViewer permissionTableViewer; + protected Button addUser; + protected Button removeUser; + + String addUserLabel = "Benutzer hinzufügen"; + String removeUserLabel = "Benutzer entfernen"; + + + /** + * Page for setting custom permissions of a lecture + * + * @param editExistingLecture whether to edit existing lecture or creating a new one + */ + public LectureCustomPermissionPageLayout() { + super("Benutzerdefinierte Berechtigungen"); + setTitle("Benutzerdefinierte Berechtigungen"); + setDescription("Setzen Sie bei Bedarf benutzerdefinierte Berechtigungen"); + } + + @Override + public void createControl(Composite parent) { + container = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 2; + + // table + Table vmTable = new Table(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); + vmTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); + vmTable.setHeaderVisible(true); + vmTable.setLinesVisible(true); + + // TableViewer on the table + permissionTableViewer = new TableViewer(vmTable); + permissionTableViewer.setContentProvider(ArrayContentProvider.getInstance()); + + // Buttons below Table + addUser = new Button(container, SWT.PUSH); + addUser.setText(addUserLabel); + + removeUser = new Button(container, SWT.PUSH); + removeUser.setText(removeUserLabel); + + setControl(container); + } +} 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 7b21d089..048aec6d 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 @@ -1,17 +1,19 @@ package org.openslx.dozmod.gui.wizard.page; +import org.apache.log4j.Logger; import org.eclipse.swt.widgets.Composite; import org.openslx.dozmod.gui.wizard.layout.LectureCreationPageLayout; public class LectureCreationPage extends LectureCreationPageLayout { protected boolean editExistingLecture; + private final static Logger LOGGER = Logger.getLogger(LectureCreationPage.class); /** * Page for creating lectures * - * @param editExistingImage wether to edit existing lecture or create new + * @param editExistingImage whether to edit existing lecture or create new * one */ public LectureCreationPage(boolean editExistingLecture) { @@ -22,6 +24,6 @@ public class LectureCreationPage extends LectureCreationPageLayout { @Override public void createControl(Composite parent) { - super.setControl(parent); + super.createControl(parent); } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCustomPermissionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCustomPermissionPage.java new file mode 100644 index 00000000..695df1ec --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCustomPermissionPage.java @@ -0,0 +1,22 @@ +package org.openslx.dozmod.gui.wizard.page; + +import org.eclipse.swt.widgets.Composite; +import org.openslx.dozmod.gui.wizard.layout.LectureCustomPermissionPageLayout; + +public abstract class LectureCustomPermissionPage extends LectureCustomPermissionPageLayout { + + /** + * Page for creating lectures + * + * @param editExistingLecture whether to edit existing lecture or create new + * one + */ + public LectureCustomPermissionPage() { + super(); + } + + @Override + public void createControl(Composite parent) { + super.createControl(parent); + } +} |