summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
blob: 33f12519e4cd13c21f337c3bbb1d80a972022184 (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
package org.openslx.dozmod.gui.wizard.layout;

import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.WizardPage;

public abstract class ImageUploadPageLayout extends WizardPage {

	/**
	 * Version for serialization.
	 */
	private static final long serialVersionUID = 4242983732316327827L;

	protected final JTextField txtImageName;
	protected final JButton btnBrowseForImage;
	protected final JTextField txtImageFile;
	protected final JCheckBox chkLicenseRestricted;
	protected final QLabel lblImageName;
	protected final JTextArea txtInfoText;

	/**
	 * Page for uploading an imagefile
	 */
	public ImageUploadPageLayout(Wizard wizard) {
		super(wizard, I18n.PAGE_LAYOUT.getString("ImageUpload.WizardPage.title"));
		setDescription(I18n.PAGE_LAYOUT.getString("ImageUpload.WizardPage.description"));
		GridManager grid = new GridManager(this, 3, false);

		// -- Browse for VM --
		QLabel imageFileCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageUpload.Label.imageFile.text"));
		txtImageFile = new JTextField();
		txtImageFile.setEditable(false);
		btnBrowseForImage = new JButton(I18n.PAGE_LAYOUT.getString("ImageUpload.Button.browseForImage.text"));
		btnBrowseForImage.setMnemonic(KeyEvent.VK_B);
		grid.add(imageFileCaption);
		grid.add(txtImageFile).fill(true, false).expand(true, false);
		grid.add(btnBrowseForImage);
		grid.nextRow();

		lblImageName = new QLabel(I18n.PAGE_LAYOUT.getString("ImageUpload.Label.imageName.text"));
		txtImageName = new JTextField();
		grid.add(lblImageName);
		grid.add(txtImageName, 2, 1).fill(true, false).expand(true, false);
		grid.nextRow();

		// -- Software license changed - shown only in UploadWizard --
		chkLicenseRestricted = new JCheckBox(
				I18n.PAGE_LAYOUT.getString("ImageUpload.CheckBox.licenseRestricted.text"));
		chkLicenseRestricted.setVisible(false);
		grid.skip();
		grid.add(chkLicenseRestricted, 2, 1).fill(false, false).expand(true, false);
		grid.nextRow();

		grid.add(Box.createVerticalGlue(), 3).expand(true, true);

		txtInfoText = new JTextArea();
		txtInfoText.setBorder(BorderFactory.createTitledBorder(
				I18n.PAGE_LAYOUT.getString("ImageUpload.TextArea.info.title")));
		txtInfoText.setLineWrap(true);
		txtInfoText.setWrapStyleWord(true);
		txtInfoText.setEditable(false);
		txtInfoText.setFocusable(false);
		txtInfoText.setOpaque(false);
		txtInfoText.setText(I18n.PAGE_LAYOUT.getString("ImageUpload.TextArea.info.text"));
		grid.add(txtInfoText, 3).fill(true, false).expand(true, false);
		grid.nextRow();

		grid.finish(false);
	}
}