annotate gui/edu/unc/genomics/JobConfigPanel.java @ 2:e16016635b2a

Uploaded
author timpalpant
date Mon, 13 Feb 2012 22:12:06 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
1 package edu.unc.genomics;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
2
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
3 import java.awt.Color;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
4 import java.awt.Component;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
5 import java.awt.Dimension;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
6 import java.awt.FileDialog;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
7 import java.awt.event.ActionEvent;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
8 import java.awt.event.ActionListener;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
9 import java.lang.reflect.Field;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
10 import java.nio.file.Path;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
11 import java.util.HashMap;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
12 import java.util.List;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
13 import java.util.Map;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
14
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
15 import javax.swing.BorderFactory;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
16 import javax.swing.BoxLayout;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
17 import javax.swing.ImageIcon;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
18 import javax.swing.JButton;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
19 import javax.swing.JComboBox;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
20 import javax.swing.JComponent;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
21 import javax.swing.JFileChooser;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
22 import javax.swing.JFrame;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
23 import javax.swing.JLabel;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
24 import javax.swing.JPanel;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
25 import javax.swing.JTextField;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
26 import javax.swing.SpringLayout;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
27 import javax.swing.SwingUtilities;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
28 import javax.swing.event.DocumentEvent;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
29 import javax.swing.event.DocumentListener;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
30 import javax.swing.layout.SpringUtilities;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
31 import javax.swing.text.BadLocationException;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
32 import javax.swing.text.Document;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
33
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
34 import org.apache.commons.lang3.StringUtils;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
35 import org.apache.log4j.Logger;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
36
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
37 import com.beust.jcommander.ParameterDescription;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
38
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
39 import edu.unc.genomics.io.IntervalFile;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
40 import edu.unc.genomics.io.WigFile;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
41
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
42 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
43 * View for configuring the parameters of a Job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
44 * Implements databinding between a Job object and the various Swing components
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
45 * for configuring each parameter
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
46 *
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
47 * @author timpalpant
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
48 *
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
49 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
50 public class JobConfigPanel extends JPanel {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
51
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
52 private static final long serialVersionUID = 3336295203155728629L;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
53 private static final Logger log = Logger.getLogger(JobConfigPanel.class);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
54
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
55 private static final ImageIcon fileIcon = new ImageIcon(ResourceManager.getImagesDirectory().resolve("folder_page.png").toString());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
56
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
57 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
58 * Maps parameters in the Job to GUI components (forward data-binding)
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
59 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
60 private Map<ParameterDescription, JComponent> guiMap = new HashMap<>();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
61
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
62 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
63 * Maps GUI components to parameters in the Job (reverse data-binding)
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
64 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
65 private Map<Component, ParameterDescription> jobMap = new HashMap<>();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
66
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
67 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
68 * The model for the Job that this panel allows you to configure
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
69 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
70 private Job job;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
71
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
72 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
73 * Initialize a new ConfigurationPanel with no Job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
74 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
75 public JobConfigPanel() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
76 this(null);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
77 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
78
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
79 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
80 * Initialize a new ConfigurationPanel for the given Job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
81 * @param job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
82 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
83 public JobConfigPanel(final Job job) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
84 setJob(job);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
85 setLayout(new SpringLayout());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
86 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
87
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
88 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
89 * Return the Job that this ConfigurationPanel is editing
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
90 * @return
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
91 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
92 public Job getJob() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
93 return job;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
94 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
95
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
96 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
97 * Set the job for this Configuration panel and re-render
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
98 * @param job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
99 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
100 public void setJob(final Job job) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
101 this.job = job;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
102 renderJob();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
103 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
104
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
105 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
106 * Highlights fields on the Panel that are not set correctly
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
107 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
108 public void highlightInvalidArguments() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
109 for (ParameterDescription param : job) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
110 JComponent guiComponent = guiMap.get(param);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
111 if (param.getParameter().required() && !job.isSet(param)) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
112 guiComponent.setBorder(BorderFactory.createLineBorder(Color.RED));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
113 } else {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
114 guiComponent.setBorder(BorderFactory.createEmptyBorder());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
115 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
116 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
117 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
118
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
119 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
120 * Render the parameters from the Job into GUI components
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
121 * and set up one-way data binding to map changes to the GUI fields
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
122 * back into the Job object's parameters
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
123 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
124 private void renderJob() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
125 removeAll();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
126 guiMap.clear();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
127 jobMap.clear();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
128 if (job == null) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
129 validate();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
130 repaint();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
131 return;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
132 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
133
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
134 // Iterate through the parameters in the Job
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
135 // and render them appropriately based on their type
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
136 for (ParameterDescription paramDescription : job) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
137 // Add the parameter name to the configuration panel
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
138 String name = paramDescription.getLongestName();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
139 while (name.startsWith("-")) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
140 name = name.substring(1);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
141 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
142 name = StringUtils.capitalize(name);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
143 JLabel label = new JLabel(name);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
144 label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
145 add(label);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
146
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
147 // Add a panel for configuring the parameter
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
148 JPanel fieldPanel = new JPanel();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
149 fieldPanel.setLayout(new BoxLayout(fieldPanel, BoxLayout.LINE_AXIS));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
150 add(fieldPanel);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
151 Field field = paramDescription.getField();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
152 Class<?> type = field.getType();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
153 if (type.equals(Assembly.class)) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
154 List<Assembly> availableAssemblies = AssemblyManager.getAvailableAssemblies();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
155 Assembly[] assemblies = new Assembly[availableAssemblies.size()];
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
156 assemblies = availableAssemblies.toArray(assemblies);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
157 final JComboBox<Assembly> cbAssemblyChooser = new JComboBox<Assembly>(assemblies);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
158 cbAssemblyChooser.setPreferredSize(new Dimension(0, 25));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
159 cbAssemblyChooser.setMaximumSize(new Dimension(Integer.MAX_VALUE, cbAssemblyChooser.getPreferredSize().height));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
160 cbAssemblyChooser.setSelectedItem(AssemblyManager.getLastUsed());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
161 cbAssemblyChooser.addActionListener(new ActionListener() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
162 public void actionPerformed(ActionEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
163 log.debug("Auto-databinding changed assembly into Job argument");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
164 Assembly selectedAssembly = (Assembly) cbAssemblyChooser.getSelectedItem();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
165 AssemblyManager.setLastUsed(selectedAssembly);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
166 ParameterDescription param = jobMap.get(cbAssemblyChooser);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
167 job.setArgument(param, selectedAssembly.toString());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
168 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
169 });
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
170 fieldPanel.add(cbAssemblyChooser);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
171 guiMap.put(paramDescription, cbAssemblyChooser);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
172 jobMap.put(cbAssemblyChooser, paramDescription);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
173 } else {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
174 final JTextField textField = new JTextField();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
175 // Set to default parameter, if it exists
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
176 if (job.isSet(paramDescription)) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
177 textField.setText(job.getArgument(paramDescription));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
178 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
179 textField.setPreferredSize(new Dimension(0, 20));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
180 textField.setMaximumSize(new Dimension(Integer.MAX_VALUE, textField.getPreferredSize().height));
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
181 textField.getDocument().addDocumentListener(new DocumentListener() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
182 public void changedUpdate(DocumentEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
183 pushTextToModel(e);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
184 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
185
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
186 public void removeUpdate(DocumentEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
187 pushTextToModel(e);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
188 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
189
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
190 public void insertUpdate(DocumentEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
191 pushTextToModel(e);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
192 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
193
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
194 private void pushTextToModel(DocumentEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
195 log.debug("Auto-databinding changed text into Job argument");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
196 Document doc = (Document) e.getDocument();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
197 ParameterDescription param = jobMap.get(textField);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
198 try {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
199 String text = doc.getText(0, doc.getLength());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
200 job.setArgument(param, text);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
201 } catch (BadLocationException e1) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
202 log.error("Error pushing changed text into Job model");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
203 e1.printStackTrace();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
204 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
205 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
206 });
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
207 fieldPanel.add(textField);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
208 guiMap.put(paramDescription, textField);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
209 jobMap.put(textField, paramDescription);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
210
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
211 // For input/output files, add a file chooser button
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
212 if (type.equals(Path.class) || type.equals(WigFile.class) || type.equals(IntervalFile.class)) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
213 // TODO Replace with file icon
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
214 JButton btnChooseFile = new JButton(fileIcon);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
215 btnChooseFile.addActionListener(new ActionListener() {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
216 public void actionPerformed(ActionEvent e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
217 // AWT FileDialog uses native components, but seems to hang
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
218 //Component c = (Component) e.getSource();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
219 //JFrame frame = (JFrame) SwingUtilities.getRoot(c);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
220 //FileDialog fd = new FileDialog(frame, "Choose File");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
221 //fd.setVisible(true);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
222 //if (fd.getFile() != null) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
223 // textField.setText(fd.getDirectory()+fd.getFile());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
224 //}
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
225
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
226 // Swing JFileChooser
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
227 JFileChooser fc = new JFileChooser();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
228 int retValue = fc.showDialog(getParent(), "OK");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
229 if (retValue == JFileChooser.APPROVE_OPTION) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
230 textField.setText(fc.getSelectedFile().toString());
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
231 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
232 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
233 });
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
234 fieldPanel.add(btnChooseFile);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
235 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
236 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
237 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
238
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
239 // Lay out the panel
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
240 SpringUtilities.makeCompactGrid(this, job.numParameters(), 2, 5, 5, 5, 5);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
241
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
242 validate();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
243 repaint();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
244 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
245
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
246 }