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
|
package org.openslx.dozmod.gui.window.layout;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.helper.StatusHeader;
import javax.swing.*;
import java.awt.*;
public class ContainerBindMountWindowLayout extends JDialog {
/**
* Version for serialization.
*/
private static final long serialVersionUID = -4410299500877608736L;
private static final String title = "Add Bind Mount";
protected final StatusHeader header;
protected final QLabel lblBmSource;
protected final JTextField txtBmSource;
protected final QLabel lblBmTarget;
protected final JTextField txtBmTarget;
protected final QLabel lblBmOptions;
protected final JTextField txtBmOptions;
protected final JButton btnSave;
protected final JButton btnCancel;
protected static final String EMPTY_MARKER = "-";
protected static final String[] TAGS = { "USER_HOME", "USER_TMP" };
protected static String[] SOURCE_MOUNT_POINTS = { EMPTY_MARKER, TAGS[0], TAGS[1], "D", "E", "F", "G", "H",
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
protected final ComboBox<String> cboSourceMountPoint = new ComboBox<String>(
new ComboBox.ComboBoxRenderer<String>() {
@Override public String renderItem(String letter) {
if (letter == null)
return null;
return letter;
}
}, String.class);
public ContainerBindMountWindowLayout(Window modalParent) {
super(modalParent, title, ModalityType.APPLICATION_MODAL);
setLayout(new BorderLayout());
header = new StatusHeader(getContentPane(), "Source and Target Path Required");
JPanel contentPanel = new JPanel();
add(contentPanel, BorderLayout.CENTER);
GridManager grid = new GridManager(contentPanel, 2, true, new Insets(2, 2, 2, 2));
lblBmSource = new QLabel("Source");
txtBmSource = new JTextField();
cboSourceMountPoint.setModel(new DefaultComboBoxModel<>(SOURCE_MOUNT_POINTS));
cboSourceMountPoint.setSelectedItem(SOURCE_MOUNT_POINTS[0]);
grid.add(lblBmSource);
grid.add(cboSourceMountPoint).fill(true, false).expand(true, false);
grid.nextRow();
lblBmTarget = new QLabel("Target");
txtBmTarget = new JTextField();
grid.add(lblBmTarget);
grid.add(txtBmTarget).fill(true, false).expand(true, false);
grid.nextRow();
lblBmOptions = new QLabel("Options");
txtBmOptions = new JTextField();
grid.add(lblBmOptions);
grid.add(txtBmOptions).fill(true, false).expand(true, false);
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("Cancel");
buttonPane.add(btnCancel);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
btnSave = new JButton("Save");
buttonPane.add(btnSave);
grid.add(buttonPane, 2).fill(true, false).expand(true, false);
grid.finish(false);
setSize(350, 200);
setResizable(false);
if (modalParent != null) {
Gui.centerShellOverShell(modalParent, this);
}
}
}
|