summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
diff options
context:
space:
mode:
authorJonathan Bauer2016-03-15 14:08:22 +0100
committerJonathan Bauer2016-03-15 14:08:22 +0100
commit400fc72fc9d606e56a1d20efba37514b556aed30 (patch)
tree6fc23ba996283b952c5170d5647396506c37a777 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
parent[client] fix '.part' not beeing removed from TransferPanel when the transfer ... (diff)
downloadtutor-module-400fc72fc9d606e56a1d20efba37514b556aed30.tar.gz
tutor-module-400fc72fc9d606e56a1d20efba37514b556aed30.tar.xz
tutor-module-400fc72fc9d606e56a1d20efba37514b556aed30.zip
[client] reworked lecture details window
now uses tabs for subsets of options - clearing up the gui a bit
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java350
1 files changed, 235 insertions, 115 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
index 0d10d919..7b47ae69 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
@@ -21,6 +21,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
+import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
@@ -31,12 +32,17 @@ import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;
import org.openslx.bwlp.thrift.iface.ImageVersionDetails;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.control.AdvancedConfigurator;
import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
+import org.openslx.dozmod.gui.control.LectureCustomPermissionManager;
+import org.openslx.dozmod.gui.control.LocationSelector;
import org.openslx.dozmod.gui.control.PersonLabel;
import org.openslx.dozmod.gui.control.QDatePickerImpl;
import org.openslx.dozmod.gui.control.QLabel;
+import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.util.DateLabelFormatter;
import org.openslx.dozmod.util.FormatHelper;
import org.openslx.thrifthelper.Comparators;
@@ -44,10 +50,14 @@ import org.openslx.thrifthelper.Comparators;
@SuppressWarnings("serial")
public abstract class LectureDetailsWindowLayout extends JDialog {
+ // stuff ending in '...Info' are supposed to be the read-only labels for the information tab
+ protected final QLabel lblTitleInfo;
protected final JTextArea txtTitle;
protected final JTextArea txtDescription;
+ protected final QLabel lblImageNameInfo;
protected final QLabel txtImageName;
protected final JButton btnLinkImage;
+ protected final PersonLabel lblOwnerInfo;
protected final PersonLabel lblOwner;
protected final JButton btnChangeOwner;
protected final QLabel lblCreateTime;
@@ -56,18 +66,17 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
protected final QLabel lblStartTime;
protected final QLabel lblEndTime;
protected final JCheckBox chkAutoUpdate;
+ protected final QLabel lblVersionInfo;
protected final ComboBox<ImageVersionDetails> cboVersions;
protected final JCheckBox chkIsExam;
protected final JCheckBox chkHasInternetAccess;
protected final JCheckBox chkHasUsbAccess;
protected final JCheckBox chkIsActive;
- protected final JButton btnAdvancedOptions;
protected final JTextField txtId;
protected final QLabel lblUseCount;
protected final JButton btnPermissions;
- protected final JButton btnLocations;
protected final QLabel lblError;
protected final JButton btnSaveChanges;
@@ -80,9 +89,23 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
protected final JSpinner spnEndTime;
protected Color dateTimeTextColor;
+
+ protected JTabbedPane pnlTabs;
+ protected final LectureCustomPermissionManager ctlPermissionManager;
+ protected final LocationSelector ctlLocationSelector;
+ protected final AdvancedConfigurator ctlAdvancedConfigurator;
private static final Properties pickerStrings = new Properties();
+ protected JCheckBox chkCustomPermEdit;
+ protected JCheckBox chkCustomPermAdmin;
+ protected JPanel pnlTabGeneral;
+ protected JPanel pnlTabInfo;
+ protected JPanel pnlTabRestrictions;
+ protected JPanel pnlTabPermissions;
+ protected JPanel pnlTabLocations;
+ protected JPanel pnlTabAdvanced;
+
static {
pickerStrings.put("text.today", "Heute");
pickerStrings.put("text.month", "Monat");
@@ -90,69 +113,118 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
}
public LectureDetailsWindowLayout(Frame modalParent) {
- super(modalParent, "Veranstaltungsdetails", ModalityType.APPLICATION_MODAL);
+ super(modalParent, "Veranstaltungsdetails",
+ ModalityType.APPLICATION_MODAL);
setResizable(true);
+ setPreferredSize(Gui.getScaledDimension(525, 550));
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setLayout(new BorderLayout());
- ((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- // use panel to put every info related widget in it
- // then we will set the panel in BorderLayout.CENTER
- JPanel infoPanel = new JPanel();
- infoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- GridManager grid = new GridManager(infoPanel, 3, true, new Insets(2, 2, 2, 2));
-
- // -- name --
+ ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(
+ 10, 10, 10, 10));
+
+ pnlTabInfo = new JPanel();
+ pnlTabInfo.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));
+ GridManager grdInfo = new GridManager(pnlTabInfo, 3, true, new Insets(7,
+ 7, 7, 7));
+
+ // title
+ lblTitleInfo = new QLabel();
+ lblTitleInfo.setFont(lblTitleInfo.getFont().deriveFont(Font.BOLD,
+ lblTitleInfo.getFont().getSize2D() * 1.5f));
+ grdInfo.add(lblTitleInfo, 3);
+ grdInfo.nextRow();
+ // lblOwner
+ lblOwnerInfo = new PersonLabel();
+ grdInfo.add(new QLabel("Besitzer"));
+ grdInfo.add(lblOwnerInfo, 2).expand(true, false);
+ grdInfo.nextRow();
+ // creation time
+ lblCreateTime = new QLabel();
+ grdInfo.add(new QLabel("Erstellt am"));
+ grdInfo.add(lblCreateTime, 2);
+ grdInfo.nextRow();
+
+ // last updater
+ lblUpdater = new PersonLabel();
+ grdInfo.add(new QLabel("Geändert durch"));
+ grdInfo.add(lblUpdater, 2);
+ grdInfo.nextRow();
+
+ // last updated
+ lblUpdateTime = new QLabel();
+ grdInfo.add(new QLabel("Geändert am"));
+ grdInfo.add(lblUpdateTime, 2);
+ grdInfo.nextRow();
+ lblVersionInfo = new QLabel(); // UNUSED
+ lblImageNameInfo = new QLabel();
+ grdInfo.add(new QLabel("Verknüpfte VM"), 2);
+ grdInfo.add(lblImageNameInfo);
+ grdInfo.nextRow();
+ lblStartTime = new QLabel();
+ grdInfo.add(new QLabel("Startdatum"), 2);
+ grdInfo.add(lblStartTime);
+ grdInfo.nextRow();
+ lblEndTime = new QLabel();
+ grdInfo.add(new QLabel("Enddatum"), 2);
+ grdInfo.add(lblEndTime);
+ grdInfo.nextRow();
+ lblUseCount = new QLabel();
+ grdInfo.add(new QLabel("Aufrufe"));
+ grdInfo.add(lblUseCount, 2);
+ grdInfo.finish(true);
+
+ pnlTabGeneral = new JPanel();
+ pnlTabGeneral.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ GridManager grdGeneral = new GridManager(pnlTabGeneral, 5, true,
+ new Insets(3, 3, 3, 3));
+ // lecture title
txtTitle = new JTextArea();
- txtTitle.setFont(txtTitle.getFont().deriveFont(Font.BOLD, txtTitle.getFont().getSize2D() * 2));
- grid.add(txtTitle, 3).expand(true, false).fill(true, false);
- grid.nextRow();
+ grdGeneral.add(new QLabel("Name"));
+ grdGeneral.add(txtTitle, 4).expand(true, false).fill(true, false);
+ grdGeneral.nextRow();
// description
txtDescription = new JTextArea();
txtDescription.setLineWrap(true);
txtDescription.setWrapStyleWord(true);
- grid.add(new QLabel("Beschreibung")).anchor(GridBagConstraints.FIRST_LINE_START);
- JScrollPane jsp = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ grdGeneral.add(new QLabel("Beschreibung")).anchor(
+ GridBagConstraints.FIRST_LINE_START);
+ JScrollPane jsp = new JScrollPane(txtDescription,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jsp.setMinimumSize(Gui.getScaledDimension(450, 120));
jsp.setPreferredSize(Gui.getScaledDimension(450, 120));
- grid.add(jsp, 2).expand(true, true).fill(true, true);
- grid.nextRow();
+ grdGeneral.add(jsp, 4).expand(true, true).fill(true, true);
+ grdGeneral.nextRow();
+
+ // ID. NOTE: currently disabled
+ txtId = new JTextField();
+ txtId.setEditable(false);
+ txtId.setFont(txtId.getFont().deriveFont(Font.BOLD,
+ txtId.getFont().getSize2D() * 0.66f));
+ grdGeneral.add(new QLabel("ID"));
+ grdGeneral.add(txtId, 4).expand(true, false).fill(true, false);
+ grdGeneral.nextRow();
// owner
lblOwner = new PersonLabel();
btnChangeOwner = new JButton("Ändern");
- grid.add(new QLabel("Besitzer"));
- grid.add(lblOwner).expand(true, false);
- grid.add(btnChangeOwner).fill(true, false);
- grid.nextRow();
+ grdGeneral.add(new QLabel("Besitzer"));
+ grdGeneral.add(lblOwner, 3).expand(true, false);
+ grdGeneral.add(btnChangeOwner).fill(true, false);
+ grdGeneral.nextRow();
- // creation time
- lblCreateTime = new QLabel();
- grid.add(new QLabel("Erstellt am"));
- grid.add(lblCreateTime, 2);
- grid.nextRow();
-
- // last updater
- lblUpdater = new PersonLabel();
- grid.add(new QLabel("Geändert durch"));
- grid.add(lblUpdater, 2);
- grid.nextRow();
- // last updated
- lblUpdateTime = new QLabel();
- grid.add(new QLabel("Geändert am"));
- grid.add(lblUpdateTime, 2);
- grid.nextRow();
// linked image
// name
txtImageName = new QLabel();
- grid.add(new QLabel("Verknüpfte VM"));
- grid.add(txtImageName).expand(true, false);
+ grdGeneral.add(new QLabel("Verknüpfte VM"));
+ grdGeneral.add(txtImageName, 3).expand(true, false);
+
// link button for image
btnLinkImage = new JButton("Ändern");
- grid.add(btnLinkImage).fill(true, false);
- grid.nextRow();
+ grdGeneral.add(btnLinkImage).fill(true, false);
+ grdGeneral.nextRow();
// image version handling
// auto update
@@ -167,102 +239,148 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
if (item.isValid) {
return FormatHelper.longDate(item.getCreateTime());
} else {
- return FormatHelper.longDate(item.getCreateTime()) + " [ungültig]";
+ return FormatHelper.longDate(item.getCreateTime())
+ + " [ungültig]";
}
}
});
btnDownloadImage = new JButton("Download");
- btnDownloadImage.setToolTipText("Momentan verwendete Version herunterladen");
+ btnDownloadImage
+ .setToolTipText("Momentan verwendete Version herunterladen");
JPanel versionPanel = new JPanel(new BorderLayout());
versionPanel.add(cboVersions, BorderLayout.CENTER);
versionPanel.add(chkAutoUpdate, BorderLayout.SOUTH);
- grid.add(new QLabel("VM-Version"));
- grid.add(versionPanel);
- grid.add(btnDownloadImage).fill(true, false);
- grid.nextRow();
+ grdGeneral.add(new QLabel("VM-Version"));
+ grdGeneral.add(versionPanel, 3);
+ grdGeneral.add(btnDownloadImage).fill(true, false);
+ grdGeneral.nextRow();
// start time of the lecture
JPanel startTimePanel = new JPanel();
- startTimePanel.setLayout(new BoxLayout(startTimePanel, BoxLayout.LINE_AXIS));
- dtpStartDate = new QDatePickerImpl(new JDatePanelImpl(new UtilDateModel(new Date()), pickerStrings),
+ startTimePanel.setLayout(new BoxLayout(startTimePanel,
+ BoxLayout.LINE_AXIS));
+ dtpStartDate = new QDatePickerImpl(new JDatePanelImpl(
+ new UtilDateModel(new Date()), pickerStrings),
new DateLabelFormatter());
spnStartTime = makeTimeSpinner(23, 59);
startTimePanel.add(dtpStartDate);
startTimePanel.add(spnStartTime);
startTimePanel.setMinimumSize(startTimePanel.getPreferredSize());
startTimePanel.setMaximumSize(startTimePanel.getPreferredSize());
- lblStartTime = new QLabel();
- grid.add(new QLabel("Startdatum"));
- grid.add(startTimePanel, 2);
- grid.nextRow();
+ grdGeneral.add(new QLabel("Startdatum"));
+ grdGeneral.add(startTimePanel, 4);
+ grdGeneral.nextRow();
// end time of the lecture
JPanel endTimePanel = new JPanel();
- endTimePanel.setLayout(new BoxLayout(endTimePanel, BoxLayout.LINE_AXIS));
- dtpEndDate = new QDatePickerImpl(new JDatePanelImpl(new UtilDateModel(new Date()), pickerStrings),
- new DateLabelFormatter());
+ endTimePanel
+ .setLayout(new BoxLayout(endTimePanel, BoxLayout.LINE_AXIS));
+ dtpEndDate = new QDatePickerImpl(new JDatePanelImpl(new UtilDateModel(
+ new Date()), pickerStrings), new DateLabelFormatter());
spnEndTime = makeTimeSpinner(00, 59);
endTimePanel.add(dtpEndDate);
endTimePanel.add(spnEndTime);
endTimePanel.setMinimumSize(endTimePanel.getPreferredSize());
endTimePanel.setMaximumSize(endTimePanel.getPreferredSize());
-
- lblEndTime = new QLabel();
- grid.add(new QLabel("Enddatum"));
- grid.add(endTimePanel, 2);
- grid.nextRow();
-
- // is exam
- chkIsExam = new JCheckBox("Klausurmodus aktiv");
- grid.add(new JLabel("Beschränkungen"));
- grid.add(chkIsExam);
- btnAdvancedOptions = new JButton("Einstellungen");
- grid.add(btnAdvancedOptions);
- grid.nextRow();
-
- chkHasInternetAccess = new JCheckBox("Internetzugriff");
- grid.skip();
- grid.add(chkHasInternetAccess, 2);
- grid.nextRow();
-
- chkHasUsbAccess = new JCheckBox("USB-Zugriff");
- grid.skip();
- grid.add(chkHasUsbAccess, 2);
- grid.nextRow();
-
- chkIsActive = new JCheckBox("Aktiv");
- grid.skip();
- grid.add(chkIsActive, 2);
- grid.nextRow();
-
- // id
- txtId = new JTextField();
- txtId.setEditable(false);
- grid.add(new QLabel("ID"));
- grid.add(txtId, 2).expand(true, false).fill(true, false);
- grid.nextRow();
-
- // use count
- lblUseCount = new QLabel();
- grid.add(new QLabel("Aufrufe"));
- grid.add(lblUseCount, 2);
- grid.nextRow();
-
- // button for the custom permissions
- JPanel bottomButtonPanel = new JPanel();
- btnPermissions = new JButton("Berechtigungen");
- btnLocations = new JButton("Raumauswahl");
- grid.skip();
- bottomButtonPanel.add(btnPermissions);
- bottomButtonPanel.add(btnLocations);
- grid.add(bottomButtonPanel);
- grid.skip();
- grid.nextRow();
- grid.finish(true);
-
- // finally add the infoPanel itself to the main view
- add(infoPanel, BorderLayout.CENTER);
- // button panel on the bottom
+ grdGeneral.add(new QLabel("Enddatum"));
+ grdGeneral.add(endTimePanel, 4);
+ grdGeneral.nextRow();
+
+ // lecture active
+ chkIsActive = new JCheckBox("Veranstaltung aktiv");
+ grdGeneral.skip();
+ grdGeneral.add(chkIsActive, 4);
+ grdGeneral.nextRow();
+ grdGeneral.finish(true);
+
+ pnlTabRestrictions = new JPanel();
+ GridManager grdRestrictions = new GridManager(pnlTabRestrictions, 2, true,
+ new Insets(3, 3, 3, 3));
+
+ // "restrictions": internet access / usb access / exam
+ grdRestrictions.add(new JLabel("Internetzugriff"));
+ chkHasInternetAccess = new JCheckBox("zulassen");
+ grdRestrictions.add(new WordWrapLabel("Legen Sie hier fest, ob die Veranstaltung Zugriff zum Internet haben soll", false, true)).fill(true, false).expand(true, false);
+ grdRestrictions.nextRow();
+ grdRestrictions.skip();
+ grdRestrictions.add(chkHasInternetAccess).fill(true, false).expand(true, false);
+ grdRestrictions.nextRow();
+
+ grdRestrictions.add(new JLabel("Speichermedium-Zugriff"));
+ chkHasUsbAccess = new JCheckBox("zulassen");
+ grdRestrictions.add(new WordWrapLabel("Legen Sie hier fest, ob die Veranstaltung Zugriff Speichermedien (CD, USB, ...) haben soll", false, true)).fill(true, false).expand(true, false);
+ grdRestrictions.nextRow();
+ grdRestrictions.skip();
+ grdRestrictions.add(chkHasUsbAccess);
+ grdRestrictions.nextRow();
+
+ grdRestrictions.add(new JLabel("E-Prüfung"));
+ chkIsExam = new JCheckBox("aktiv");
+ grdRestrictions.add(new WordWrapLabel("Gekennzeichnen Sie diese Veranstaltung als E-Prüfung", false, true)).fill(true, false).expand(true, false);
+ grdRestrictions.nextRow();
+ grdRestrictions.skip();
+ grdRestrictions.add(chkIsExam);
+ btnPermissions = new JButton("Ändern");
+ grdRestrictions.finish(true);
+
+ /* *******************************************************************************
+ *
+ * Tab "Permissions"
+ *
+ ********************************************************************************/
+ ctlPermissionManager = new LectureCustomPermissionManager();
+ pnlTabPermissions = new JPanel();
+ GridManager grdPermissions = new GridManager(pnlTabPermissions, 1, false);
+ JPanel defaultPermissionPane = new JPanel();
+ defaultPermissionPane.setBorder(BorderFactory.createTitledBorder("Andere Nutzer"));
+ chkCustomPermEdit = new JCheckBox("Bearbeiten");
+ chkCustomPermAdmin = new JCheckBox("Admin");
+ defaultPermissionPane.add(chkCustomPermEdit);
+ defaultPermissionPane.add(chkCustomPermAdmin);
+ grdPermissions.add(ctlPermissionManager).fill(true, true).expand(true, true);
+ grdPermissions.nextRow();
+ grdPermissions.add(defaultPermissionPane).fill(true, false).expand(true, false);
+ grdPermissions.finish(false);
+
+ /* *******************************************************************************
+ *
+ * Tab "Locations"
+ *
+ ********************************************************************************/
+ ctlLocationSelector = new LocationSelector();
+ pnlTabLocations = new JPanel();
+ GridManager grdLocations = new GridManager(pnlTabLocations, 1, false);
+ grdLocations.add(ctlLocationSelector).fill(true, true).expand(true, true);
+ grdLocations.finish(false);
+
+ /* *******************************************************************************
+ *
+ * Tab "Advanced"
+ *
+ ********************************************************************************/
+ ctlAdvancedConfigurator = new AdvancedConfigurator();
+ pnlTabAdvanced = new JPanel();
+ GridManager grdAdvanced = new GridManager(pnlTabAdvanced, 1, false);
+ grdAdvanced.add(ctlAdvancedConfigurator).fill(true, true).expand(true, true);
+ grdAdvanced.finish(false);
+
+ /* *******************************************************************************
+ *
+ * Main panel containing the tabs
+ *
+ ********************************************************************************/
+ // finally build the tabbedPane and add it to the main view
+ pnlTabs = new JTabbedPane();
+ pnlTabs.addTab("Übersicht", pnlTabInfo);
+ pnlTabs.addTab("Allgemein", pnlTabGeneral);
+ pnlTabs.addTab("Beschränkungen", pnlTabRestrictions);
+ if (MetaDataCache.getLocations() != null) {
+ pnlTabs.addTab("Raumauswahl", pnlTabLocations);
+ }
+ pnlTabs.addTab("Erweitert", pnlTabAdvanced);
+ pnlTabs.addTab("Berechtigungen", pnlTabPermissions);
+ add(pnlTabs, BorderLayout.CENTER);
+ // usage counter + button panel on the bottom
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
btnClose = new JButton("Schließen");
@@ -274,6 +392,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
buttonPanel.add(Box.createGlue());
buttonPanel.add(btnClose);
buttonPanel.add(btnSaveChanges);
+ // buttons at the end of the page
add(buttonPanel, BorderLayout.SOUTH);
}
@@ -286,7 +405,8 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
model.setValue(calendar.getTime());
JSpinner spinner = new JSpinner(model);
JSpinner.DateEditor editor = new JSpinner.DateEditor(spinner, "HH:mm");
- DateFormatter formatter = (DateFormatter) editor.getTextField().getFormatter();
+ DateFormatter formatter = (DateFormatter) editor.getTextField()
+ .getFormatter();
formatter.setAllowsInvalid(false);
formatter.setOverwriteMode(true);
spinner.setEditor(editor);