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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
package org.openslx.dozmod.gui.window.layout;
import java.awt.Insets;
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 javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
public class LectureSettingsWindowLayout extends JDialog {
private static final long serialVersionUID = 5565439063675405598L;
private final static String txtTitle = "Erweiterte Einstellungen";
private final static String txtGeneralOptionsTitle = "Allgemeine Optionen";
private final static String txtGeneralOptionsDesc = "Mit dieser Option schalten Sie USB-Geräte für diese Veranstaltung ab.";
private final static String txtNetworkOptionsTitle = "Netzwerk Einstellungen";
private final static String txtNetworkOptionsDesc = "Hier können Sie Firewall-Regeln festlegen mit folgendem Format (TODO)";
private final static String txtEnableUsb = "Zugriff auf das USB-Geräte erlauben";
private final static String txtEnableInternet = "Zugriff auf das Internet beschränken";
private final static String txtNetworkRulesTitle = "Netzwerk-Regeln";
private final static String txtRunScriptTitle = "Run-Skript";
private final static String txtRunScriptDesc = "Ein hier abgelegtes Skript wird beim Start automatisch ausgeführt.";
private final static String txtButtonClose = "Schließen";
private final static String txtButtonSave = "Speichern";
private final JPanel pnlGeneralOptions;
private final JPanel pnlNetworkOptions;
private final JPanel pnlRunScript;
private final JPanel pnlBottomButtons;
protected final JCheckBox chkEnableInternet;
protected final JCheckBox chkEnableUsb;
protected final JTextArea taNetworkRules;
protected final JTextArea taRunScript;
protected final JButton btnSave;
protected final JButton btnClose;
public LectureSettingsWindowLayout(Window modalParent) {
super(modalParent, txtTitle, modalParent != null ? ModalityType.APPLICATION_MODAL
: ModalityType.MODELESS);
GridManager grid = new GridManager(this, 1, true, new Insets(5, 5, 5, 5));
// top panel for general options
pnlGeneralOptions = new JPanel();
pnlGeneralOptions.setBorder(BorderFactory.createTitledBorder(txtGeneralOptionsTitle));
GridManager gridGeneralOptions = new GridManager(pnlGeneralOptions, 1);
chkEnableUsb = new JCheckBox(txtEnableUsb);
// TODO moar
gridGeneralOptions.add(chkEnableUsb).fill(true, false).expand(true, false);
gridGeneralOptions.nextRow();
gridGeneralOptions.add(new WordWrapLabel(txtGeneralOptionsDesc, false, true)).fill(true, false).expand(true, false);
gridGeneralOptions.finish(false);
// middle panel for network rules
pnlNetworkOptions = new JPanel();
GridManager gridNetworkOptions = new GridManager(pnlNetworkOptions, 1, true, new Insets(2, 2, 2, 2));
pnlNetworkOptions.setBorder(BorderFactory.createTitledBorder(txtNetworkOptionsTitle));
chkEnableInternet = new JCheckBox(txtEnableInternet);
gridNetworkOptions.add(chkEnableInternet).fill(true, false).expand(true, false);
gridNetworkOptions.nextRow();
taNetworkRules = new JTextArea("", 5, 20);
taNetworkRules.setLineWrap(true);
taNetworkRules.setWrapStyleWord(true);
JScrollPane scpNetworkRules = new JScrollPane(taNetworkRules, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
pnlNetworkOptions.setBorder(BorderFactory.createTitledBorder(txtNetworkRulesTitle));
gridNetworkOptions.add(new WordWrapLabel(txtNetworkOptionsDesc, false, true)).fill(true, false).expand(true, false);
gridNetworkOptions.nextRow();
gridNetworkOptions.add(scpNetworkRules).fill(true, true).expand(true, true);
gridNetworkOptions.finish(false);
// TODO middle panel for run script
pnlRunScript = new JPanel();
GridManager gridRunScript = new GridManager(pnlRunScript, 1, true, new Insets(2, 2, 2, 2));
taRunScript = new JTextArea("", 5, 20);
taRunScript.setLineWrap(true);
taRunScript.setWrapStyleWord(true);
JScrollPane scpRunScript = new JScrollPane(taRunScript,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
pnlRunScript.setBorder(BorderFactory.createTitledBorder(txtRunScriptTitle));
gridRunScript.add(new WordWrapLabel(txtRunScriptDesc, false, true)).fill(true, false).expand(true, false);
gridRunScript.nextRow();
gridRunScript.add(scpRunScript).fill(true, true).expand(true, true);
gridRunScript.finish(false);
// bottom panel for controls
pnlBottomButtons = new JPanel();
pnlBottomButtons.setLayout(new BoxLayout(pnlBottomButtons, BoxLayout.LINE_AXIS));
pnlBottomButtons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
btnClose = new JButton(txtButtonClose);
btnSave = new JButton(txtButtonSave);
pnlBottomButtons.add(Box.createHorizontalGlue());
pnlBottomButtons.add(btnClose);
pnlBottomButtons.add(btnSave);
// build the final grid
grid.add(pnlGeneralOptions).fill(true, false).expand(true, false);
grid.nextRow();
grid.add(pnlNetworkOptions).fill(true, true).expand(true, true);
grid.nextRow();
grid.add(pnlRunScript).fill(true, true).expand(true, true);
grid.nextRow();
grid.add(pnlBottomButtons).fill(true, false).expand(true, false);
grid.finish(false);
setPreferredSize(Gui.getScaledDimension(700, 600));
pack();
Gui.centerShellOverShell(modalParent, this);
}
}
|