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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
package org.openslx.dozmod.gui.wizard.layout;
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;
import org.openslx.dozmod.model.ContainerBuildContextMethod;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
public class ContainerUploadPageLayout extends WizardPage {
protected final JTextField txtImageName;
protected final JButton btnBrowseForImage;
protected final JTextField txtImageFile;
protected final JCheckBox chkLicenseRestricted;
protected final QLabel lblImageName;
protected final JTextArea txtInfoText;
protected final JTabbedPane tpInput;
protected final JTextField txtGitRepo;
/**
* Constructor to define the Layout
*/
public ContainerUploadPageLayout(Wizard wizard) {
super(wizard, I18n.PAGE_LAYOUT.getString("ContainerUploadPage.title"));
setDescription(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.description"));
GridManager grid = new GridManager(this, 3, false);
JPanel p1 = new JPanel();
p1.setVisible(true);
GridManager g1 = new GridManager(p1, 3, true, new Insets(5, 0, 5, 0));
QLabel imageFileCaption = new QLabel(
I18n.PAGE_LAYOUT.getString("ContainerUploadPage.DockerFile.label"));
txtImageFile = new JTextField();
txtImageFile.setEditable(false);
btnBrowseForImage = new JButton(I18n.PAGE_LAYOUT.getString("ImageUpload.Button.browseForImage.text"));
btnBrowseForImage.setMnemonic(KeyEvent.VK_B);
g1.add(imageFileCaption);
g1.add(txtImageFile).fill(true, false).expand(true, false);
g1.add(btnBrowseForImage);
g1.finish(false);
JPanel p2 = new JPanel();
p2.setVisible(false);
GridManager g2 = new GridManager(p2, 2, true, new Insets(5, 0, 5, 0));
QLabel lblGitRepo = new QLabel(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.GitRepository.label"));
lblGitRepo.setToolTipText(
I18n.PAGE_LAYOUT.getString("ContainerUploadPage.GitRepository.toolTipText"));
txtGitRepo = new JTextField();
txtGitRepo.setToolTipText(
I18n.PAGE_LAYOUT.getString("ContainerUploadPage.GitRepository.toolTipText"));
g2.add(lblGitRepo);
g2.add(txtGitRepo).fill(true, false).expand(true, false);
g2.finish(false);
tpInput = new JTabbedPane();
tpInput.addTab("Dockerfile", p1);
tpInput.addTab("Git Repository", p2);
tpInput.setSelectedIndex(ContainerBuildContextMethod.FILE.ordinal());
grid.add(tpInput, 3).fill(true, false);
// Start as with Dockerfile as input!
tpInput.setSelectedIndex(0);
lblImageName = new QLabel(I18n.PANEL.getString("ContainerPanel.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("ContainerUploadPage.CheckBox.ContainsLicenseRestricted.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("ContainerUploadPage.Infobox.label")));
txtInfoText.setLineWrap(true);
txtInfoText.setWrapStyleWord(true);
txtInfoText.setEditable(false);
txtInfoText.setFocusable(false);
txtInfoText.setOpaque(false);
txtInfoText.setText(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.Infobox.text"));
grid.add(txtInfoText, 3).fill(true, false).expand(true, false);
grid.nextRow();
grid.finish(true);
}
protected ContainerBuildContextMethod getBuildContextMethod() {
return ContainerBuildContextMethod.fromInt(tpInput.getSelectedIndex());
}
}
|