summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dozentenmodul/pom.xml5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java44
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserImagePermissions.java19
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java27
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java162
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java66
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageCustomPermissionPage.java15
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCustomPermissionPage.java14
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/DateLabelFormatter.java32
11 files changed, 235 insertions, 185 deletions
diff --git a/dozentenmodul/pom.xml b/dozentenmodul/pom.xml
index e82bce9b..8f278d4b 100644
--- a/dozentenmodul/pom.xml
+++ b/dozentenmodul/pom.xml
@@ -154,6 +154,11 @@
<artifactId>joda-time</artifactId>
<version>2.8</version>
</dependency>
+ <dependency>
+ <groupId>org.jdatepicker</groupId>
+ <artifactId>jdatepicker</artifactId>
+ <version>1.3.4</version>
+ </dependency>
</dependencies>
</project>
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
index a5fb2e3b..bfab9ede 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
@@ -1,6 +1,7 @@
package org.openslx.dozmod.gui.control.table;
-import org.openslx.dozmod.gui.helper.UserImagePermissions;
+import org.openslx.bwlp.thrift.iface.ImagePermissions;
+import org.openslx.dozmod.gui.control.table.ImagePermissionTable.UserImagePermissions;
import org.openslx.dozmod.thrift.UserCache;
import org.openslx.dozmod.util.FormatHelper;
@@ -29,4 +30,19 @@ public class ImagePermissionTable extends ListTable<UserImagePermissions> {
throw new IndexOutOfBoundsException();
}
+ /**
+ * Helper class for linking UserIds to permissions of an image.
+ */
+ public static class UserImagePermissions {
+
+ public final String userId;
+ public final ImagePermissions permissions;
+
+ public UserImagePermissions(String userId, ImagePermissions permission) {
+ this.userId = userId;
+ this.permissions = permission;
+ }
+
+ }
+
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java
new file mode 100644
index 00000000..67a7e53d
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java
@@ -0,0 +1,44 @@
+package org.openslx.dozmod.gui.control.table;
+
+import org.openslx.bwlp.thrift.iface.LecturePermissions;
+import org.openslx.dozmod.gui.control.table.LecturePermissionTable.UserLecturePermissions;
+import org.openslx.dozmod.thrift.UserCache;
+import org.openslx.dozmod.util.FormatHelper;
+
+@SuppressWarnings("serial")
+public class LecturePermissionTable extends ListTable<UserLecturePermissions> {
+
+ private static String[] columnNames = { "Benutzer", "Bearbeiten", "Admin" };
+
+ public LecturePermissionTable() {
+ super(columnNames);
+ }
+
+ @Override
+ protected Object getValueAtInternal(int rowIndex, int columnIndex) {
+ UserLecturePermissions row = get(rowIndex);
+ if (columnIndex == 0)
+ return FormatHelper.userName(UserCache.find(row.userId));
+ if (columnIndex == 1)
+ return row.permissions.edit;
+ if (columnIndex == 2)
+ return row.permissions.admin;
+ throw new IndexOutOfBoundsException();
+ }
+
+ /**
+ * Helper class for linking UserIds to permissions of an image.
+ */
+ public static class UserLecturePermissions {
+
+ public final String userId;
+ public final LecturePermissions permissions;
+
+ public UserLecturePermissions(String userId, LecturePermissions permission) {
+ this.userId = userId;
+ this.permissions = permission;
+ }
+
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserImagePermissions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserImagePermissions.java
deleted file mode 100644
index 30ad7459..00000000
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UserImagePermissions.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.openslx.dozmod.gui.helper;
-
-import org.openslx.bwlp.thrift.iface.ImagePermissions;
-
-/**
- * Helper class for linking UserIds to permissions of an image.
- */
-public class UserImagePermissions {
-
- public final String userId;
- public final ImagePermissions permissions;
-
-
- public UserImagePermissions(String userId, ImagePermissions permission){
- this.userId = userId;
- this.permissions = 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 1cf5dcb6..1ca2ccff 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
@@ -3,48 +3,33 @@ package org.openslx.dozmod.gui.wizard;
import java.awt.Window;
import org.apache.log4j.Logger;
-import org.openslx.dozmod.gui.wizard.layout.LectureCreationPageLayout;
import org.openslx.dozmod.gui.wizard.page.LectureCreationPage;
import org.openslx.dozmod.gui.wizard.page.LectureCustomPermissionPage;
+@SuppressWarnings("serial")
public class LectureWizard extends Wizard {
private final static Logger LOGGER = Logger.getLogger(LectureWizard.class);
- protected LectureCreationPageLayout lectureCreationPage;
- protected LectureCustomPermissionPage lectureCustomPermissionPage;
protected boolean editExistingLecture;
/**
* Wizard for creating or editing a lecture
+ *
* @param editExistingLecture whether to create new or edit existing lecture
*/
public LectureWizard(Window parent, boolean editExistingLecture) {
super(parent);
this.editExistingLecture = editExistingLecture;
- }
+ // create the shared object for all pages of the wizard
+ addPage(new LectureCreationPage(this));
+ addPage(new LectureCustomPermissionPage(this));
+ }
@Override
public String getWindowTitle() {
return "Neue Veranstaltung erzeugen";
}
- @Override
- public void addPages() {
- // create the shared object for all pages of the wizard
- lectureCreationPage = new LectureCreationPage(editExistingLecture);
- lectureCustomPermissionPage = new LectureCustomPermissionPage() {
- };
-
- addPage(lectureCreationPage);
- addPage(lectureCustomPermissionPage);
- }
-
-
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
}
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 1522cd72..2531d392 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
@@ -1,26 +1,44 @@
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;
+import java.awt.GridBagLayout;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Properties;
+import javax.swing.Box;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerDateModel;
+import javax.swing.text.DateFormatter;
+
+import org.jdatepicker.impl.JDatePanelImpl;
+import org.jdatepicker.impl.JDatePickerImpl;
+import org.jdatepicker.impl.UtilDateModel;
+import org.openslx.dozmod.gui.helper.GridPos;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.WizardPage;
+import org.openslx.dozmod.util.DateLabelFormatter;
+
+@SuppressWarnings("serial")
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;
+ protected JTextField lectureNameTextField;
+ protected JDatePickerImpl startDate;
+ protected JDatePickerImpl endDate;
+ protected JSpinner startTime;
+ protected JSpinner endTime;
+ protected JCheckBox networkAccessCheck;
+ protected JCheckBox examCheck;
+ private static final Properties pickerStrings = new Properties();
+
+ static {
+ pickerStrings.put("text.today", "Heute");
+ pickerStrings.put("text.month", "Monat");
+ pickerStrings.put("text.year", "Jahr");
+ }
/**
* Page for creating lectures
@@ -28,66 +46,60 @@ public abstract class LectureCreationPageLayout extends WizardPage {
* @param editExistingLecture whether to edit existing lecture or create new
* one
*/
- public LectureCreationPageLayout() {
- super("Eingabe Ihrer Daten");
- setTitle("Eingabe Ihrer Daten");
- setDescription("Geben Sie bitte einen aussagekräftigen Namen für die neue Veranstaltung ein.");
- }
+ public LectureCreationPageLayout(Wizard wizard) {
+ super(wizard, "Eingabe Ihrer Daten");
+ setDescription("Geben Sie bitte einen aussagekräftigen Namen für die neue Veranstaltung ein");
- @Override
- public void createControl(Composite parent) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.verticalSpacing = 16;
- layout.numColumns = 4;
- container.setLayout(layout);
+ setLayout(new GridBagLayout());
// 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 | SWT.DROP_DOWN);
- 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 | SWT.DROP_DOWN);
- 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);
+ JLabel lectureNameLabel = new JLabel("Veranstaltungsname");
+ lectureNameTextField = new JTextField();
+ add(lectureNameLabel, GridPos.get(0, 0));
+ add(lectureNameTextField, GridPos.get(1, 0, 2, 1, true, false));
+
+ // Start date/time
+ JLabel startDateLabel = new JLabel("Startdatum");
+ startDate = new JDatePickerImpl(new JDatePanelImpl(new UtilDateModel(new Date()), pickerStrings),
+ new DateLabelFormatter());
+ startTime = makeTimeSpinner(0, 0);
+ add(startDateLabel, GridPos.get(0, 1));
+ add(startDate, GridPos.get(1, 1));
+ add(startTime, GridPos.get(2, 1));
+
+ JLabel endDateLabel = new JLabel("Enddatum");
+ endDate = new JDatePickerImpl(new JDatePanelImpl(new UtilDateModel(new Date()), pickerStrings),
+ new DateLabelFormatter());
+ endTime = makeTimeSpinner(23, 59);
+ add(endDateLabel, GridPos.get(0, 2));
+ add(endDate, GridPos.get(1, 2));
+ add(endTime, GridPos.get(2, 2));
+
+ add(Box.createVerticalStrut(10), GridPos.get(0, 3));
+
+ // Options related to exams
+ examCheck = new JCheckBox("Veranstaltung ist eine Prüfung");
+ networkAccessCheck = new JCheckBox("Internet verfügbar");
+ add(examCheck, GridPos.get(1, 4, 2, 1));
+ add(examCheck, GridPos.get(1, 5, 2, 1));
+
+ add(Box.createVerticalGlue(), GridPos.get(0, 6, true, true));
}
+
+ private JSpinner makeTimeSpinner(int h, int m) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.HOUR_OF_DAY, h); // 24 == 12 PM == 00:00:00
+ calendar.set(Calendar.MINUTE, m);
+ calendar.set(Calendar.SECOND, 0);
+ SpinnerDateModel model = new SpinnerDateModel();
+ model.setValue(calendar.getTime());
+ JSpinner spinner = new JSpinner(model);
+ JSpinner.DateEditor editor = new JSpinner.DateEditor(spinner, "HH:mm");
+ DateFormatter formatter = (DateFormatter) editor.getTextField().getFormatter();
+ formatter.setAllowsInvalid(false); // this makes what you want
+ formatter.setOverwriteMode(true);
+ spinner.setEditor(editor);
+ return spinner;
+ }
+
}
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
index 44e07982..6a007e69 100644
--- 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
@@ -1,59 +1,43 @@
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;
+import java.awt.GridBagLayout;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.openslx.dozmod.gui.control.table.LecturePermissionTable;
+import org.openslx.dozmod.gui.helper.GridPos;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.WizardPage;
+
+@SuppressWarnings("serial")
public abstract class LectureCustomPermissionPageLayout extends WizardPage {
- protected Composite container;
- protected TableViewer permissionTableViewer;
- protected Button addUser;
- protected Button removeUser;
-
+ protected LecturePermissionTable permissionTableViewer;
+ protected JButton addUser;
+ protected JButton removeUser;
+
String addUserLabel = "Benutzer hinzufügen";
String removeUserLabel = "Benutzer entfernen";
-
/**
* Page for setting custom permissions of a lecture
*/
- public LectureCustomPermissionPageLayout() {
- super("Benutzerdefinierte Berechtigungen");
- setTitle("Benutzerdefinierte Berechtigungen");
+ public LectureCustomPermissionPageLayout(Wizard wizard) {
+ super(wizard, "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);
+ setLayout(new GridBagLayout());
// TableViewer on the table
- permissionTableViewer = new TableViewer(vmTable);
- permissionTableViewer.setContentProvider(ArrayContentProvider.getInstance());
+ permissionTableViewer = new LecturePermissionTable();
+ add(permissionTableViewer, GridPos.get(0, 0, true, true));
+ JPanel panel = new JPanel();
// Buttons below Table
- addUser = new Button(container, SWT.PUSH);
- addUser.setText(addUserLabel);
-
- removeUser = new Button(container, SWT.PUSH);
- removeUser.setText(removeUserLabel);
-
- setControl(container);
+ addUser = new JButton(addUserLabel);
+ removeUser = new JButton(removeUserLabel);
+ panel.add(addUser);
+ panel.add(removeUser);
+ add(panel, GridPos.get(0, 1));
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageCustomPermissionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageCustomPermissionPage.java
index ea8ae831..97a1a0b9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageCustomPermissionPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageCustomPermissionPage.java
@@ -7,7 +7,7 @@ import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.UserInfo;
-import org.openslx.dozmod.gui.helper.UserImagePermissions;
+import org.openslx.dozmod.gui.control.table.ImagePermissionTable.UserImagePermissions;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.ImageCustomPermissionPageLayout;
import org.openslx.dozmod.state.UploadWizardState;
@@ -16,24 +16,25 @@ import org.openslx.dozmod.thrift.UserCache;
@SuppressWarnings("serial")
public class ImageCustomPermissionPage extends ImageCustomPermissionPageLayout {
- private final static Logger LOGGER = Logger
- .getLogger(ImageCustomPermissionPage.class);
+ private final static Logger LOGGER = Logger.getLogger(ImageCustomPermissionPage.class);
private UploadWizardState uploadWizardState = null;
private ArrayList<UserImagePermissions> permissionList = null;
/**
* wizard page for setting custom permissions
- * @param wizard
+ *
+ * @param wizard
*/
public ImageCustomPermissionPage(Wizard wizard, UploadWizardState uploadWizardState) {
super(wizard);
setPageComplete(true);
this.uploadWizardState = uploadWizardState;
-
- permissionList = new ArrayList<UserImagePermissions>();
+
+ permissionList = new ArrayList<>();
for (UserInfo user : UserCache.getAll()) {
- permissionList.add(new UserImagePermissions(user.getUserId(), new ImagePermissions(true, true, true, false)));
+ permissionList.add(new UserImagePermissions(user.getUserId(), new ImagePermissions(true, true,
+ true, false)));
}
permissionTable.setData(permissionList);
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 23abdab9..078e2ba7 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,14 +1,13 @@
package org.openslx.dozmod.gui.wizard.page;
import org.apache.log4j.Logger;
-import org.eclipse.swt.widgets.Composite;
+import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureCreationPageLayout;
+@SuppressWarnings("serial")
public class LectureCreationPage extends LectureCreationPageLayout {
-
- protected boolean editExistingLecture;
- private final static Logger LOGGER = Logger.getLogger(LectureCreationPage.class);
+ private final static Logger LOGGER = Logger.getLogger(LectureCreationPage.class);
/**
* Page for creating lectures
@@ -16,14 +15,9 @@ public class LectureCreationPage extends LectureCreationPageLayout {
* @param editExistingLecture whether to edit existing lecture or create new
* one
*/
- public LectureCreationPage(boolean editExistingLecture) {
- super();
- this.editExistingLecture = editExistingLecture;
-
+ public LectureCreationPage(Wizard wizard) {
+ super(wizard);
+ setPageComplete(true);
}
- @Override
- public void createControl(Composite 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
index eebcabeb..1fb82f21 100644
--- 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
@@ -1,19 +1,15 @@
package org.openslx.dozmod.gui.wizard.page;
-import org.eclipse.swt.widgets.Composite;
+import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureCustomPermissionPageLayout;
-public abstract class LectureCustomPermissionPage extends LectureCustomPermissionPageLayout {
+@SuppressWarnings("serial")
+public class LectureCustomPermissionPage extends LectureCustomPermissionPageLayout {
/**
* Page for setting custom permissions of a lecture
*/
- public LectureCustomPermissionPage() {
- super();
- }
-
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
+ public LectureCustomPermissionPage(Wizard wizard) {
+ super(wizard);
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/DateLabelFormatter.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/DateLabelFormatter.java
new file mode 100644
index 00000000..3e6b7043
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/DateLabelFormatter.java
@@ -0,0 +1,32 @@
+package org.openslx.dozmod.util;
+
+import java.text.ParseException;
+import java.util.Calendar;
+
+import javax.swing.JFormattedTextField.AbstractFormatter;
+
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
+@SuppressWarnings("serial")
+public class DateLabelFormatter extends AbstractFormatter {
+
+ private static final DateTimeFormatter formatter = DateTimeFormat.forPattern("dd.MM.yyyy");
+
+ @Override
+ public Object stringToValue(String text) throws ParseException {
+ try {
+ return formatter.parseDateTime(text);
+ } catch (Exception e) {
+ throw new ParseException(e.getMessage(), -1);
+ }
+ }
+
+ @Override
+ public String valueToString(Object value) throws ParseException {
+ if (value == null)
+ return "";
+ return formatter.print(((Calendar) value).getTimeInMillis());
+ }
+
+}