summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java
blob: 5d1785967867c5256c6551539f61b978bc4f0f02 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package org.openslx.dozmod.gui.wizard.layout;

import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.TitledBorder;

import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.WizardPage;
import org.openslx.thrifthelper.Comparators;

@SuppressWarnings("serial")
public abstract class ImageMetaDataPageLayout extends WizardPage {

	protected JComboBox<OperatingSystem> osCombo;
	protected JTextArea descriptionText;
	protected JCheckBox licencedSoftwareCheck;
	protected JCheckBox setActiveCheck;
	protected JCheckBox isTemplateCheck;

	/**
	 * wizard page for entering image data at creating or editing an image
	 * 
	 * @param wizard
	 */
	public ImageMetaDataPageLayout(Wizard wizard) {
		super(wizard, "Metadaten");
		setDescription("Geben Sie bitte einen aussagekräftigen Namen für das neue Image ein.");

		GridManager grid = new GridManager(this, 2, false);

		QLabel osCaption = new QLabel("Betriebssystem");
		osCombo = new ComboBox<>(Comparators.operatingSystem, new ComboBoxRenderer<OperatingSystem>() {
			@Override
			public String renderItem(OperatingSystem item) {
				if (item == null)
					return null;
				return item.getOsName();
			}
		});
		osCombo.setEditable(false);
		grid.add(osCaption);
		grid.add(osCombo);

		QLabel descriptionCation = new QLabel("Beschreibung");
		descriptionText = new JTextArea(5, 50);
		descriptionText.setMinimumSize(Gui.getScaledDimension(0, 70));
		descriptionText.setLineWrap(true);
		descriptionText.setWrapStyleWord(true);
		JScrollPane descPane = new JScrollPane(descriptionText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		descPane.setMinimumSize(descriptionText.getMinimumSize());
		grid.add(descriptionCation);
		grid.add(descPane).fill(true, false).expand(true, false);
		grid.nextRow();

		setActiveCheck = new JCheckBox("Image aktivieren");
		grid.add(setActiveCheck);

		licencedSoftwareCheck = new JCheckBox("Image enthält lizenzpflichtige Software");
		licencedSoftwareCheck.setSelected(true);
		grid.add(licencedSoftwareCheck);
		grid.nextRow();

		// -- end permissions group --
		isTemplateCheck = new JCheckBox("Vorlage erstellen");
		grid.add(isTemplateCheck, 2);
		grid.nextRow();

		grid.finish(true);
	}

	public String getImageDescription() {
		return descriptionText.getText();
	}

}