summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VmxEditorWindowLayout.java
blob: 4b502d169c4dc1166072348a3f63b54c8e8cf363 (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
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.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JPanel;

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

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

	private static String title = "VMX Editor (nur für erfahrene Anwender!)";
	protected final JEditorPane pnlEditor;
	protected final JButton btnSave;
	protected final JButton btnCancel;
	
	protected VmxEditorWindowLayout(Window modalParent, String vmx) {
		super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
				: ModalityType.MODELESS);

		GridManager grid = new GridManager(this, 1);

		pnlEditor = new JEditorPane("text/plain", vmx);
		grid.add(pnlEditor).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("Abbrechen");
		buttonPane.add(btnCancel);
		buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
		btnSave = new JButton("Übernehmen");
		buttonPane.add(btnSave);
		grid.add(buttonPane).fill(true, false).expand(true, false);;
		grid.finish(false);
		
		setPreferredSize(Gui.getScaledDimension(500, 400));
		setMinimumSize(Gui.getScaledDimension(350, 300));
		Gui.centerShellOverShell(modalParent, this);
	}
}