blob: ec5b071f91bba20c84007d77397d0ada07b721a0 (
plain)
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
|
package bjc.imgchain.pipeline;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import bjc.imgchain.ImgChain;
/**
* GUI to pick a pipeline to apply.
* @author Ben Culkin
*
*/
public class PipelinePicker extends JDialog {
private static final long serialVersionUID = 1L;
/**
* The name of the pipe to apply.
*/
public String pipeName;
/**
* Create a new pipeline picker GUI.
*/
public PipelinePicker() {
super();
setModalityType(ModalityType.APPLICATION_MODAL);
setTitle("Apply a Pipeline");
setupGUI();
}
private void setupGUI() {
setLayout(new BorderLayout());
DefaultListModel<String> pipeModel = new DefaultListModel<>();
for (String pipelneName : ImgChain.chan.pipelineRepo.keySet()) {
pipeModel.addElement(pipelneName);
}
JList<String> pipeList = new JList<>(pipeModel);
JScrollPane listScroll = new JScrollPane(pipeList);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2, 1));
JButton addStage = new JButton("Apply Pipe");
addStage.addActionListener((ev) -> {
pipeName = pipeList.getSelectedValue();
setVisible(false);
dispose();
});
JButton cancel = new JButton("Cancel");
cancel.addActionListener((ev) -> {
setVisible(false);
dispose();
});
buttonPanel.add(addStage);
buttonPanel.add(cancel);
add(listScroll, BorderLayout.CENTER);
add(buttonPanel, BorderLayout.PAGE_END);
}
}
|