summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java
blob: cfa255643c3d2391743704220e72ba967cf300f9 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.openslx.dozmod.gui.window.layout;

import java.awt.Dimension;
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.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.helper.I18n;

@SuppressWarnings("serial")
public class VirtConfigEditorWindowLayout extends JDialog {

	protected final JScrollPane pnlScrollPane;
	protected final JEditorPane pnlEditor;
	protected final JButton btnSave;
	protected final JButton btnCancel;

	protected VirtConfigEditorWindowLayout(Window modalParent) {
		super(modalParent, I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Dialog.title"),
				modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);

		GridManager grid = new GridManager(this, 1, true, new Insets(2, 2, 2, 2));
		JPanel pnlWarning = new JPanel();
		pnlWarning.setBorder(BorderFactory.createTitledBorder(
				I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.TitledBorder.pnlWarning.title")));
		pnlWarning.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Label.pnlWarning.text")));
		pnlEditor = new JEditorPane("text/plain", null);
		pnlScrollPane = new JScrollPane(pnlEditor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		grid.add(pnlWarning).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(pnlScrollPane).expand(true, true).fill(true, true);
		grid.nextRow();

		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
		buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
		buttonPane.add(Box.createHorizontalGlue());
		btnCancel = new JButton(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Button.cancel.text"));
		buttonPane.add(btnCancel);
		buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
		btnSave = new JButton(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Button.save.text"));
		buttonPane.add(btnSave);
		grid.add(buttonPane).fill(true, false).expand(true, false);
		;
		grid.finish(false);

		setPreferredSize(Gui.getScaledDimension(650, 750));
		setMinimumSize(Gui.getScaledDimension(550, 650));
		if (modalParent != null) {
			Gui.centerShellOverShell(modalParent, this);
		}
	}
}