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
|
package org.openslx.dozmod.gui.window.layout;
import java.awt.BorderLayout;
import java.awt.Frame;
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.QLabel;
import org.openslx.dozmod.gui.helper.GridManager;
@SuppressWarnings("serial")
public abstract class GenericNoticeWindowLayout extends JDialog {
protected String info = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise:";
protected JTextArea notice;
protected JScrollPane disclaimerPanel;
protected String checkboxText = "Ja, ich akzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen.";
private static String title = "bwLehrpool-Suite";
private static String noticeLabel = "Hinweis";
private static String continueButtonLabel = "Weiter";
// Buttons
protected final JCheckBox chkAgreeBox;
protected final JButton btnContinue;
public GenericNoticeWindowLayout(Frame modalParent) {
super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
: ModalityType.MODELESS);
this.setLayout(new BorderLayout());
// Panel used for creating border. We'll add everything into this.
JPanel borderPanel = new JPanel();
borderPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(borderPanel);
// information before the notice
QLabel noticePanel = new QLabel();
noticePanel.setBorder(BorderFactory.createTitledBorder(noticeLabel));
noticePanel.setText(info);
// the disclaimer text box with scrolling functionality
notice = new JTextArea(30, 20);
notice.setEditable(false);
notice.setLineWrap(true);
notice.setWrapStyleWord(true);
disclaimerPanel = new JScrollPane(notice, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
// checkbox for acknowledging the notice
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
chkAgreeBox = new JCheckBox(checkboxText);
chkAgreeBox.setEnabled(false);
buttonPanel.add(chkAgreeBox);
// spacer
buttonPanel.add(Box.createHorizontalGlue());
// the continue button
btnContinue = new JButton(continueButtonLabel);
btnContinue.setEnabled(false);
buttonPanel.add(btnContinue);
// put everything together
GridManager grid = new GridManager(borderPanel, 1);
grid.add(noticePanel).fill(true, false).expand(true, false);
grid.nextRow();
grid.add(disclaimerPanel).fill(true, true).expand(true, true);
grid.nextRow();
grid.add(buttonPanel).fill(true, false).expand(true, false);
grid.finish(false);
pack();
Gui.centerShellOverShell(modalParent, this);
}
public void setNoticeText(String text) {
if (notice != null) {
notice.setText(text);
notice.setCaretPosition(0);
}
}
}
|