blob: d99b09522cd5d8432114550fc29b3194a414ac71 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package org.openslx.dozmod.gui.wizard.page;
import java.util.Map;
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.LectureCustomPermissionPageLayout;
import org.openslx.dozmod.state.LectureWizardState;
/**
* Wizard page for setting custom permissions for the lecture to be created
*/
@SuppressWarnings("serial")
public class LectureCustomPermissionPage extends LectureCustomPermissionPageLayout {
private final static Logger LOGGER = Logger.getLogger(LectureCustomPermissionPage.class);
private boolean initDone = false;
private LectureWizardState state = null;
/**
* Page for setting custom permissions of a lecture
*/
public LectureCustomPermissionPage(Wizard wizard, LectureWizardState state) {
super(wizard);
this.state = state;
setPageComplete(true);
}
@Override
protected void onPageEnter() {
if(!initDone){
lectureCustomPermissionManager.initPanel(state.permissionMap, state.defaultPermissions);
initDone = true;
}
}
@Override
protected boolean wantNextOrFinish() {
LOGGER.debug("Saving permissions to state ...");
// save the table stuff to our upload wizard state
Map<String, LecturePermissions> newPermissionMap = lectureCustomPermissionManager.getMap();
if (newPermissionMap == null || newPermissionMap.isEmpty()){
return true;
}
state.permissionMap = newPermissionMap;
return true;
}
}
|