summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureNetrulesWindowLayout.java
blob: 31a1a9299e6274638603efae368f34d2e264d5de (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
package org.openslx.dozmod.gui.window.layout;

import java.awt.BorderLayout;
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.JPanel;

import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.NetrulesConfigurator;

public class LectureNetrulesWindowLayout extends JDialog {

	private static final long serialVersionUID = 5565439063675405598L;

	private final static String txtTitle = "Erweiterte Einstellungen";
	private final static String txtButtonClose = "Abbrechen";
	private final static String txtButtonSave = "Übernehmen";

	protected final NetrulesConfigurator ctlNetrulesConfigurator;
	
	private final JPanel pnlBottomButtons;
	protected final JButton btnSave;
	protected final JButton btnClose;

	public LectureNetrulesWindowLayout(Window modalParent) {
		super(modalParent, txtTitle, modalParent != null ? ModalityType.APPLICATION_MODAL
				: ModalityType.MODELESS);

		// the main content widget
		ctlNetrulesConfigurator = new NetrulesConfigurator();

		// init the layout
		getContentPane().setLayout(new BorderLayout());	
		getContentPane().add(ctlNetrulesConfigurator, BorderLayout.CENTER);

		// 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);
		getContentPane().add(pnlBottomButtons, BorderLayout.PAGE_END);

		setPreferredSize(Gui.getScaledDimension(500, 400));
		pack();
		Gui.centerShellOverShell(modalParent, this);
	}
}