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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
package org.openslx.dozmod.gui.window.layout;
import java.awt.Dimension;
import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.control.ImageCustomPermissionManager;
import org.openslx.dozmod.gui.helper.GridManager;
/**
* Window for editing permissions of an Image
*/
@SuppressWarnings("serial")
public class ImageCustomPermissionWindowLayout extends JDialog {
private static final Logger LOGGER = Logger.getLogger(ImageCustomPermissionWindowLayout.class);
protected final JCheckBox chkCustomPermAdmin;
protected final JCheckBox chkCustomPermEdit;
protected final JCheckBox chkCustomPermDownload;
protected final JCheckBox chkCustomPermLink;
protected final JButton btnOk;
protected final JButton btnClose;
protected final ImageCustomPermissionManager imagePermissionManager;
private static String title = "Benutzerdefinierte Berechtigungen";
protected ImageCustomPermissionWindowLayout(Window modalParent) {
super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
: ModalityType.MODELESS);
this.setTitle(title);
// Panel to add everything into, needed for the border.
JPanel contentPanel = new JPanel();
contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(contentPanel);
imagePermissionManager = new ImageCustomPermissionManager();
// Panel for the buttons at the bottom
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
btnOk = new JButton("Übernehmen");
buttonPane.add(Box.createGlue());
buttonPane.add(btnOk);
btnClose = new JButton("Abbrechen");
buttonPane.add(btnClose);
// Panel with the permissions for other users
JPanel defaultPermissionPane = new JPanel();
defaultPermissionPane.setBorder(BorderFactory.createTitledBorder( "Andere Nutzer"));
chkCustomPermAdmin = new JCheckBox("Admin");
chkCustomPermDownload = new JCheckBox("Download");
chkCustomPermEdit = new JCheckBox("Bearbeiten");
chkCustomPermLink = new JCheckBox("Link");
defaultPermissionPane.add(chkCustomPermLink);
defaultPermissionPane.add(chkCustomPermDownload);
defaultPermissionPane.add(chkCustomPermEdit);
defaultPermissionPane.add(chkCustomPermAdmin);
// Put everything into the grid
GridManager grid = new GridManager(contentPanel, 1);
grid.add(imagePermissionManager).fill(true, true).expand(true, true);
grid.nextRow();
grid.add(defaultPermissionPane).fill(true, false).expand(true, false);
grid.nextRow();
grid.add(buttonPane).fill(true, false).expand(false, false);
grid.nextRow();
grid.finish(false);
contentPanel.setPreferredSize(new Dimension(480, 350));
pack();
setLocationRelativeTo( modalParent );
}
}
|