From d99d4a7c5f9cdc38459d7ddc69269d4eebfb5ba9 Mon Sep 17 00:00:00 2001 From: Stephan Schwaer Date: Fri, 21 Aug 2015 15:17:41 +0200 Subject: [client] Added customLecturePermission --- .../dozmod/gui/window/LectureDetailsWindow.java | 53 ++++++++++++++++------ 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java index 90de4aed..6c16debd 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java @@ -8,6 +8,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; +import java.util.Map; import javax.swing.DefaultComboBoxModel; import javax.swing.JOptionPane; @@ -15,7 +16,9 @@ import javax.swing.JOptionPane; import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.ImageDetailsRead; +import org.openslx.bwlp.thrift.iface.ImagePermissions; import org.openslx.bwlp.thrift.iface.ImageVersionDetails; +import org.openslx.bwlp.thrift.iface.LecturePermissions; import org.openslx.bwlp.thrift.iface.LectureRead; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.gui.Gui; @@ -39,48 +42,72 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements private static final Logger LOGGER = Logger.getLogger(LectureDetailsWindow.class); + /** + * Self-reference + */ private final LectureDetailsWindow me = this; + /** + * Lecture that this window shows the details of + */ private LectureRead lecture = null; + + /** + * The custom permissions of the lecture + */ + private Map permissionMap; + + /** + * Image, that the lecture is linked to. + */ private ImageDetailsRead image = null; + /** + * Constructor + * + * @param modalParent parent of this popup window + */ public LectureDetailsWindow(Frame modalParent) { super(modalParent); - // Close button closes window + /** + * Button listeners + */ btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); - btnDownloadImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { performImageDownload(); } }); - btnAutoUpdate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cboVersions.setEnabled(!btnAutoUpdate.isSelected()); } }); - btnChangeOwner.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UserListWindow.open(JOptionPane.getFrameForComponent(btnChangeOwner), new UserAddedCallback() { - @Override - public void userAdded(UserInfo user, UserListWindow window) { - window.dispose(); - setLectureOwner(user); - } - - }, "Besitzer festlegen"); + @Override + public void userAdded(UserInfo user, UserListWindow window) { + window.dispose(); + setLectureOwner(user); + } + }, "Besitzer festlegen"); + } + }); + btnCustomPermissions.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + LectureCustomPermissionWindow.open(JOptionPane.getFrameForComponent(me), permissionMap, lecture.defaultPermissions, lecture.lectureId); } }); makeEditable(false); @@ -212,7 +239,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements */ private void makeEditable(boolean editable) { editable = editable && LecturePerms.canEdit(lecture); - //txtTitle.setEnabled(editable); + txtTitle.setEditable(editable); txtDescription.setEditable(editable); btnLinkImage.setEnabled(editable); btnIsExam.setEnabled(editable); @@ -237,7 +264,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements LectureDetailsWindow win = new LectureDetailsWindow(modalParent); win.setLecture(lectureId); } - + /** * Triggers the download of the currently used image version of the lecture */ -- cgit v1.2.3-55-g7522