1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import java.awt.BorderLayout; |
24 |
|
import java.awt.Component; |
25 |
|
import java.awt.Dimension; |
26 |
|
import java.awt.FlowLayout; |
27 |
|
import java.awt.Font; |
28 |
|
import java.awt.GridBagConstraints; |
29 |
|
import java.awt.GridBagLayout; |
30 |
|
import java.awt.GridLayout; |
31 |
|
import java.awt.Rectangle; |
32 |
|
import java.awt.event.ActionEvent; |
33 |
|
import java.awt.event.ActionListener; |
34 |
|
import java.awt.event.HierarchyBoundsListener; |
35 |
|
import java.awt.event.HierarchyEvent; |
36 |
|
import java.awt.event.ItemEvent; |
37 |
|
import java.awt.event.ItemListener; |
38 |
|
import java.awt.event.WindowEvent; |
39 |
|
import java.awt.event.WindowListener; |
40 |
|
import java.net.URL; |
41 |
|
import java.util.Hashtable; |
42 |
|
import java.util.Iterator; |
43 |
|
import java.util.List; |
44 |
|
import java.util.Vector; |
45 |
|
|
46 |
|
import javax.swing.JButton; |
47 |
|
import javax.swing.JComboBox; |
48 |
|
import javax.swing.JDialog; |
49 |
|
import javax.swing.JFrame; |
50 |
|
import javax.swing.JLabel; |
51 |
|
import javax.swing.JPanel; |
52 |
|
import javax.swing.JScrollPane; |
53 |
|
import javax.swing.JSplitPane; |
54 |
|
import javax.swing.JTextArea; |
55 |
|
import javax.swing.border.TitledBorder; |
56 |
|
import javax.swing.event.DocumentEvent; |
57 |
|
import javax.swing.event.DocumentListener; |
58 |
|
|
59 |
|
import compbio.metadata.Argument; |
60 |
|
import compbio.metadata.Option; |
61 |
|
import compbio.metadata.Parameter; |
62 |
|
import compbio.metadata.Preset; |
63 |
|
import compbio.metadata.PresetManager; |
64 |
|
import compbio.metadata.RunnerConfig; |
65 |
|
import jalview.bin.Console; |
66 |
|
import jalview.gui.OptsAndParamsPage.OptionBox; |
67 |
|
import jalview.gui.OptsAndParamsPage.ParamBox; |
68 |
|
import jalview.util.MessageManager; |
69 |
|
import jalview.ws.jws2.JabaParamStore; |
70 |
|
import jalview.ws.jws2.JabaPreset; |
71 |
|
import jalview.ws.jws2.Jws2Discoverer; |
72 |
|
import jalview.ws.jws2.jabaws2.Jws2Instance; |
73 |
|
import jalview.ws.params.ArgumentI; |
74 |
|
import jalview.ws.params.OptionI; |
75 |
|
import jalview.ws.params.ParamDatastoreI; |
76 |
|
import jalview.ws.params.ParameterI; |
77 |
|
import jalview.ws.params.WsParamSetI; |
78 |
|
import net.miginfocom.swing.MigLayout; |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
@author |
93 |
|
|
94 |
|
|
|
|
| 0% |
Uncovered Elements: 735 (735) |
Complexity: 167 |
Complexity Density: 0.33 |
|
95 |
|
public class WsJobParameters extends JPanel implements ItemListener, |
96 |
|
ActionListener, DocumentListener, OptsParametersContainerI |
97 |
|
{ |
98 |
|
URL linkImageURL = getClass().getResource("/images/link.gif"); |
99 |
|
|
100 |
|
private static final String SVC_DEF = "Defaults"; |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
OptsAndParamsPage opanp = new OptsAndParamsPage(this); |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
JPanel jobOptions = new JPanel(); |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
JPanel paramList = new JPanel(); |
118 |
|
|
119 |
|
JPanel SetNamePanel = new JPanel(); |
120 |
|
|
121 |
|
JPanel setDetails = new JPanel(); |
122 |
|
|
123 |
|
JSplitPane settingsPanel = new JSplitPane(); |
124 |
|
|
125 |
|
JPanel jobPanel = new JPanel(); |
126 |
|
|
127 |
|
JScrollPane jobOptionsPane = new JScrollPane(); |
128 |
|
|
129 |
|
JButton createpref = new JButton(); |
130 |
|
|
131 |
|
JButton deletepref = new JButton(); |
132 |
|
|
133 |
|
JButton revertpref = new JButton(); |
134 |
|
|
135 |
|
JButton updatepref = new JButton(); |
136 |
|
|
137 |
|
JButton startjob = new JButton(); |
138 |
|
|
139 |
|
JButton canceljob = new JButton(); |
140 |
|
|
141 |
|
JComboBox setName = new JComboBox(); |
142 |
|
|
143 |
|
JTextArea setDescr = new JTextArea(); |
144 |
|
|
145 |
|
JScrollPane paramPane = new JScrollPane(); |
146 |
|
|
147 |
|
|
148 |
|
JPanel optsAndparams = new JPanel(); |
149 |
|
|
150 |
|
RunnerConfig serviceOptions; |
151 |
|
|
152 |
|
ParamDatastoreI paramStore; |
153 |
|
|
154 |
|
private int MAX_OPTWIDTH = 200; |
155 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
0 |
WsJobParameters(Jws2Instance service)... |
157 |
|
{ |
158 |
0 |
this(service, null); |
159 |
|
} |
160 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
161 |
0 |
public WsJobParameters(Jws2Instance service, WsParamSetI preset)... |
162 |
|
{ |
163 |
0 |
this(null, service, preset, null); |
164 |
|
} |
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
@param |
169 |
|
|
170 |
|
@param |
171 |
|
@param |
172 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
0 |
public WsJobParameters(JFrame parent, Jws2Instance service,... |
174 |
|
WsParamSetI preset, List<Argument> jobArgset) |
175 |
|
{ |
176 |
0 |
this(parent, null, service, preset, jobArgset); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
@param |
182 |
|
@param |
183 |
|
@param |
184 |
|
@param |
185 |
|
@param |
186 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
187 |
0 |
public WsJobParameters(JFrame parent, ParamDatastoreI paramStorei,... |
188 |
|
Jws2Instance service, WsParamSetI preset, |
189 |
|
List<Argument> jobArgset) |
190 |
|
{ |
191 |
0 |
super(); |
192 |
0 |
jbInit(); |
193 |
0 |
this.paramStore = paramStorei; |
194 |
0 |
if (paramStore == null) |
195 |
|
{ |
196 |
0 |
paramStore = service.getParamStore(); |
197 |
|
} |
198 |
0 |
this.service = service; |
199 |
|
|
200 |
|
|
201 |
0 |
initForService(service, preset, jobArgset); |
202 |
|
|
203 |
0 |
validate(); |
204 |
|
} |
205 |
|
|
206 |
|
int response = -1; |
207 |
|
|
208 |
|
JDialog frame = null; |
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
@return |
214 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
215 |
0 |
public boolean showRunDialog()... |
216 |
|
{ |
217 |
|
|
218 |
0 |
frame = new JDialog(Desktop.instance, true); |
219 |
|
|
220 |
0 |
frame.setTitle(MessageManager.formatMessage("label.edit_params_for", |
221 |
|
new String[] |
222 |
|
{ service.getActionText() })); |
223 |
0 |
Rectangle deskr = Desktop.instance.getBounds(); |
224 |
0 |
Dimension pref = this.getPreferredSize(); |
225 |
0 |
frame.setBounds( |
226 |
|
new Rectangle((int) (deskr.getCenterX() - pref.width / 2), |
227 |
|
(int) (deskr.getCenterY() - pref.height / 2), |
228 |
|
pref.width, pref.height)); |
229 |
0 |
frame.setContentPane(this); |
230 |
|
|
231 |
|
|
232 |
|
|
233 |
0 |
frame.validate(); |
234 |
0 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
235 |
|
{ |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
236 |
0 |
@Override... |
237 |
|
public void run() |
238 |
|
{ |
239 |
|
|
240 |
|
|
241 |
|
} |
242 |
|
}); |
243 |
0 |
frame.setVisible(true); |
244 |
|
|
245 |
0 |
if (response > 0) |
246 |
|
{ |
247 |
0 |
return true; |
248 |
|
} |
249 |
0 |
return false; |
250 |
|
} |
251 |
|
|
|
|
| 0% |
Uncovered Elements: 88 (88) |
Complexity: 2 |
Complexity Density: 0.02 |
|
252 |
0 |
private void jbInit()... |
253 |
|
{ |
254 |
0 |
this.addHierarchyBoundsListener(new HierarchyBoundsListener() |
255 |
|
{ |
256 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
257 |
0 |
@Override... |
258 |
|
public void ancestorResized(HierarchyEvent arg0) |
259 |
|
{ |
260 |
0 |
refreshParamLayout(); |
261 |
|
} |
262 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
263 |
0 |
@Override... |
264 |
|
public void ancestorMoved(HierarchyEvent arg0) |
265 |
|
{ |
266 |
|
|
267 |
|
|
268 |
|
} |
269 |
|
}); |
270 |
0 |
updatepref = JvSwingUtils.makeButton( |
271 |
|
MessageManager.getString("action.update"), |
272 |
|
MessageManager.getString("label.update_user_parameter_set"), |
273 |
|
new ActionListener() |
274 |
|
{ |
275 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
276 |
0 |
@Override... |
277 |
|
public void actionPerformed(ActionEvent e) |
278 |
|
{ |
279 |
0 |
update_actionPerformed(e); |
280 |
|
} |
281 |
|
}); |
282 |
0 |
deletepref = JvSwingUtils.makeButton( |
283 |
|
MessageManager.getString("action.delete"), |
284 |
|
MessageManager.getString("label.delete_user_parameter_set"), |
285 |
|
new ActionListener() |
286 |
|
{ |
287 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
288 |
0 |
@Override... |
289 |
|
public void actionPerformed(ActionEvent e) |
290 |
|
{ |
291 |
0 |
delete_actionPerformed(e); |
292 |
|
} |
293 |
|
}); |
294 |
0 |
createpref = JvSwingUtils.makeButton( |
295 |
|
MessageManager.getString("action.create"), |
296 |
|
MessageManager.getString("label.create_user_parameter_set"), |
297 |
|
new ActionListener() |
298 |
|
{ |
299 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
0 |
@Override... |
301 |
|
public void actionPerformed(ActionEvent e) |
302 |
|
{ |
303 |
0 |
create_actionPerformed(e); |
304 |
|
} |
305 |
|
}); |
306 |
0 |
revertpref = JvSwingUtils.makeButton( |
307 |
|
MessageManager.getString("action.revert"), |
308 |
|
MessageManager |
309 |
|
.getString("label.revert_changes_user_parameter_set"), |
310 |
|
new ActionListener() |
311 |
|
{ |
312 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
313 |
0 |
@Override... |
314 |
|
public void actionPerformed(ActionEvent e) |
315 |
|
{ |
316 |
0 |
revert_actionPerformed(e); |
317 |
|
} |
318 |
|
}); |
319 |
0 |
startjob = JvSwingUtils.makeButton( |
320 |
|
MessageManager.getString("action.start_job"), |
321 |
|
MessageManager.getString("label.start_job_current_settings"), |
322 |
|
new ActionListener() |
323 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
324 |
0 |
@Override... |
325 |
|
public void actionPerformed(ActionEvent e) |
326 |
|
{ |
327 |
0 |
startjob_actionPerformed(e); |
328 |
|
} |
329 |
|
}); |
330 |
0 |
canceljob = JvSwingUtils.makeButton( |
331 |
|
MessageManager.getString("action.cancel_job"), |
332 |
|
MessageManager.getString("label.cancel_job_close_dialog"), |
333 |
|
new ActionListener() |
334 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
335 |
0 |
@Override... |
336 |
|
public void actionPerformed(ActionEvent e) |
337 |
|
{ |
338 |
0 |
canceljob_actionPerformed(e); |
339 |
|
} |
340 |
|
}); |
341 |
|
|
342 |
0 |
setDetails.setBorder( |
343 |
|
new TitledBorder(MessageManager.getString("label.details"))); |
344 |
0 |
setDetails.setLayout(new BorderLayout()); |
345 |
0 |
setDescr.setColumns(40); |
346 |
0 |
setDescr.setWrapStyleWord(true); |
347 |
0 |
setDescr.setLineWrap(true); |
348 |
0 |
setDescr.setBackground(getBackground()); |
349 |
0 |
setDescr.setEditable(true); |
350 |
0 |
setDescr.getDocument().addDocumentListener(this); |
351 |
0 |
setDescr.setToolTipText( |
352 |
|
MessageManager.getString("label.edit_notes_parameter_set")); |
353 |
0 |
JScrollPane setDescrView = new JScrollPane(); |
354 |
0 |
setDescrView.getViewport().setView(setDescr); |
355 |
0 |
setName.setEditable(true); |
356 |
0 |
setName.addItemListener(this); |
357 |
0 |
setName.getEditor().addActionListener(this); |
358 |
0 |
JPanel setNameInfo = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
359 |
0 |
GridBagLayout gbl = new GridBagLayout(); |
360 |
0 |
SetNamePanel.setLayout(gbl); |
361 |
|
|
362 |
0 |
JLabel setNameLabel = new JLabel( |
363 |
|
MessageManager.getString("label.current_parameter_set_name")); |
364 |
0 |
setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
365 |
|
|
366 |
0 |
setNameInfo.add(setNameLabel); |
367 |
0 |
setNameInfo.add(setName); |
368 |
|
|
369 |
|
|
370 |
0 |
updatepref.setVisible(false); |
371 |
0 |
deletepref.setVisible(false); |
372 |
0 |
revertpref.setVisible(false); |
373 |
0 |
createpref.setVisible(false); |
374 |
0 |
JPanel setsavebuts = new JPanel(); |
375 |
0 |
setsavebuts.setLayout(new FlowLayout(FlowLayout.LEFT)); |
376 |
0 |
((FlowLayout) setsavebuts.getLayout()).setHgap(10); |
377 |
0 |
((FlowLayout) setsavebuts.getLayout()).setVgap(0); |
378 |
0 |
JPanel spacer = new JPanel(); |
379 |
0 |
spacer.setPreferredSize(new Dimension(2, 30)); |
380 |
0 |
setsavebuts.add(spacer); |
381 |
0 |
setsavebuts.add(deletepref); |
382 |
0 |
setsavebuts.add(revertpref); |
383 |
0 |
setsavebuts.add(createpref); |
384 |
0 |
setsavebuts.add(updatepref); |
385 |
|
|
386 |
0 |
JPanel buttonArea = new JPanel(new GridLayout(1, 1)); |
387 |
0 |
buttonArea.add(setsavebuts); |
388 |
0 |
SetNamePanel.add(setNameInfo); |
389 |
0 |
GridBagConstraints gbc = new GridBagConstraints(); |
390 |
0 |
gbc.gridheight = 2; |
391 |
0 |
gbl.setConstraints(setNameInfo, gbc); |
392 |
0 |
SetNamePanel.add(buttonArea); |
393 |
0 |
gbc = new GridBagConstraints(); |
394 |
0 |
gbc.gridx = 0; |
395 |
0 |
gbc.gridy = 2; |
396 |
0 |
gbc.gridheight = 1; |
397 |
0 |
gbl.setConstraints(buttonArea, gbc); |
398 |
0 |
setDetails.add(setDescrView, BorderLayout.CENTER); |
399 |
|
|
400 |
|
|
401 |
|
|
402 |
0 |
jobOptions.setBorder( |
403 |
|
new TitledBorder(MessageManager.getString("label.options"))); |
404 |
0 |
jobOptions.setOpaque(true); |
405 |
0 |
paramList.setBorder( |
406 |
|
new TitledBorder(MessageManager.getString("label.parameters"))); |
407 |
0 |
paramList.setOpaque(true); |
408 |
0 |
JPanel bjo = new JPanel(new BorderLayout()), |
409 |
|
bjp = new JPanel(new BorderLayout()); |
410 |
0 |
bjo.add(jobOptions, BorderLayout.CENTER); |
411 |
0 |
bjp.add(paramList, BorderLayout.CENTER); |
412 |
0 |
bjp.setOpaque(true); |
413 |
0 |
bjo.setOpaque(true); |
414 |
|
|
415 |
|
|
416 |
|
|
417 |
0 |
optsAndparams.setLayout(new BorderLayout()); |
418 |
0 |
optsAndparams.add(jobOptions, BorderLayout.NORTH); |
419 |
0 |
optsAndparams.add(paramList, BorderLayout.CENTER); |
420 |
0 |
JPanel jp = new JPanel(new BorderLayout()); |
421 |
0 |
jp.add(optsAndparams, BorderLayout.CENTER); |
422 |
0 |
paramPane.getViewport().setView(jp); |
423 |
0 |
paramPane.setBorder(null); |
424 |
0 |
setLayout(new BorderLayout()); |
425 |
0 |
jobPanel.setPreferredSize(null); |
426 |
0 |
jobPanel.setLayout(new BorderLayout()); |
427 |
0 |
jobPanel.add(setDetails, BorderLayout.NORTH); |
428 |
0 |
jobPanel.add(paramPane, BorderLayout.CENTER); |
429 |
|
|
430 |
|
|
431 |
0 |
add(SetNamePanel, BorderLayout.NORTH); |
432 |
0 |
add(jobPanel, BorderLayout.CENTER); |
433 |
|
|
434 |
0 |
JPanel dialogpanel = new JPanel(); |
435 |
0 |
dialogpanel.add(startjob); |
436 |
0 |
dialogpanel.add(canceljob); |
437 |
|
|
438 |
|
|
439 |
0 |
final int windowHeight = Desktop.instance == null ? 540 |
440 |
|
: Desktop.instance.getHeight(); |
441 |
0 |
setPreferredSize(new Dimension(540, windowHeight)); |
442 |
0 |
add(dialogpanel, BorderLayout.SOUTH); |
443 |
0 |
validate(); |
444 |
|
} |
445 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
446 |
0 |
protected void revert_actionPerformed(ActionEvent e)... |
447 |
|
{ |
448 |
0 |
reInitDialog(lastParmSet); |
449 |
0 |
updateWebServiceMenus(); |
450 |
|
} |
451 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
452 |
0 |
protected void update_actionPerformed(ActionEvent e)... |
453 |
|
{ |
454 |
0 |
if (isUserPreset) |
455 |
|
{ |
456 |
0 |
String curname = ((String) setName.getSelectedItem()).trim(); |
457 |
0 |
_updatePreset(lastParmSet, curname); |
458 |
0 |
lastParmSet = curname; |
459 |
0 |
isUserPreset = true; |
460 |
0 |
initArgSetModified(); |
461 |
0 |
syncSetNamesWithStore(); |
462 |
|
} |
463 |
|
} |
464 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
465 |
0 |
private void _deleteUserPreset(String lastParmSet2)... |
466 |
|
{ |
467 |
0 |
paramStore.deletePreset(lastParmSet2); |
468 |
|
} |
469 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
470 |
0 |
protected void delete_actionPerformed(ActionEvent e)... |
471 |
|
{ |
472 |
0 |
if (isUserPreset) |
473 |
|
{ |
474 |
|
|
475 |
0 |
_deleteUserPreset(lastParmSet); |
476 |
|
} |
477 |
0 |
reInitDialog(null); |
478 |
0 |
updateWebServiceMenus(); |
479 |
|
} |
480 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
481 |
0 |
protected void create_actionPerformed(ActionEvent e)... |
482 |
|
{ |
483 |
0 |
String curname = ((String) setName.getSelectedItem()).trim(); |
484 |
0 |
if (curname.length() > 0) |
485 |
|
{ |
486 |
0 |
_storeCurrentPreset(curname); |
487 |
0 |
lastParmSet = curname; |
488 |
0 |
isUserPreset = true; |
489 |
0 |
reInitDialog(curname); |
490 |
0 |
initArgSetModified(); |
491 |
0 |
updateWebServiceMenus(); |
492 |
|
} |
493 |
|
else |
494 |
|
{ |
495 |
|
|
496 |
0 |
jalview.bin.Console.errPrintln("Invalid name. Not saved."); |
497 |
|
} |
498 |
|
} |
499 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
500 |
0 |
protected void canceljob_actionPerformed(ActionEvent e)... |
501 |
|
{ |
502 |
0 |
response = 0; |
503 |
0 |
if (frame != null) |
504 |
|
{ |
505 |
0 |
frame.setVisible(false); |
506 |
|
} |
507 |
|
} |
508 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
509 |
0 |
protected void startjob_actionPerformed(ActionEvent e)... |
510 |
|
{ |
511 |
0 |
response = 1; |
512 |
0 |
if (frame != null) |
513 |
|
{ |
514 |
0 |
frame.setVisible(false); |
515 |
|
} |
516 |
|
} |
517 |
|
|
518 |
|
Jws2Instance service; |
519 |
|
|
520 |
|
|
521 |
|
|
522 |
|
|
523 |
|
Hashtable servicePresets = null; |
524 |
|
|
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
boolean settingDialog = false; |
529 |
|
|
|
|
| 0% |
Uncovered Elements: 47 (47) |
Complexity: 10 |
Complexity Density: 0.32 |
|
530 |
0 |
void initForService(Jws2Instance service, WsParamSetI jabap,... |
531 |
|
List<Argument> jabajobArgset) |
532 |
|
{ |
533 |
0 |
WsParamSetI p = null; |
534 |
0 |
List<ArgumentI> jobArgset = null; |
535 |
0 |
settingDialog = true; |
536 |
|
{ |
537 |
0 |
jobArgset = jabajobArgset == null ? null |
538 |
|
: JabaParamStore.getJwsArgsfromJaba(jabajobArgset); |
539 |
0 |
p = jabap; |
540 |
|
|
541 |
|
} |
542 |
|
|
543 |
0 |
Hashtable exnames = new Hashtable(); |
544 |
0 |
for (int i = 0, iSize = setName.getItemCount(); i < iSize; i++) |
545 |
|
{ |
546 |
0 |
exnames.put(setName.getItemAt(i), setName.getItemAt(i)); |
547 |
|
} |
548 |
0 |
servicePresets = new Hashtable(); |
549 |
|
|
550 |
0 |
if (!exnames.contains(SVC_DEF)) |
551 |
|
{ |
552 |
0 |
setName.addItem(SVC_DEF); |
553 |
0 |
exnames.put(SVC_DEF, SVC_DEF); |
554 |
0 |
servicePresets.put(SVC_DEF, SVC_DEF); |
555 |
|
} |
556 |
0 |
String curname = (p == null ? "" : p.getName()); |
557 |
0 |
for (WsParamSetI pr : paramStore.getPresets()) |
558 |
|
{ |
559 |
0 |
if (!pr.isModifiable()) |
560 |
|
{ |
561 |
0 |
servicePresets.put(pr.getName(), "preset"); |
562 |
|
} |
563 |
|
else |
564 |
|
{ |
565 |
|
} |
566 |
0 |
if (!exnames.contains(pr.getName())) |
567 |
|
{ |
568 |
0 |
setName.addItem(pr.getName()); |
569 |
|
} |
570 |
|
} |
571 |
|
|
572 |
|
|
573 |
|
|
574 |
0 |
if (p != null) |
575 |
|
{ |
576 |
0 |
reInitDialog(p.getName()); |
577 |
0 |
initArgSetModified(); |
578 |
|
} |
579 |
|
else |
580 |
|
{ |
581 |
0 |
if (jobArgset != null && jobArgset.size() > 0) |
582 |
|
{ |
583 |
0 |
curSetName = "Supplied Settings"; |
584 |
0 |
isUserPreset = false; |
585 |
0 |
updateTable(p, jobArgset); |
586 |
0 |
setName.setSelectedItem(curSetName); |
587 |
0 |
updateButtonDisplay(); |
588 |
|
} |
589 |
|
else |
590 |
|
{ |
591 |
0 |
curSetName = null; |
592 |
0 |
reInitDialog(null); |
593 |
|
} |
594 |
|
} |
595 |
0 |
settingDialog = false; |
596 |
|
|
597 |
|
} |
598 |
|
|
|
|
| 0% |
Uncovered Elements: 61 (61) |
Complexity: 13 |
Complexity Density: 0.32 |
|
599 |
0 |
@SuppressWarnings("unchecked")... |
600 |
|
private void updateTable(WsParamSetI p, List<ArgumentI> jobArgset) |
601 |
|
{ |
602 |
0 |
boolean setDefaultParams = false; |
603 |
0 |
if (lastParmSet == null) |
604 |
|
{ |
605 |
0 |
isUserPreset = false; |
606 |
|
|
607 |
0 |
setName.setSelectedItem(lastSetName = SVC_DEF); |
608 |
|
} |
609 |
0 |
if (p == null && SVC_DEF.equals("" + setName.getSelectedItem())) |
610 |
|
{ |
611 |
|
|
612 |
0 |
setDefaultParams = true; |
613 |
|
} |
614 |
|
|
615 |
0 |
List<ArgumentI> args = paramStore.getServiceParameters(); |
616 |
|
|
617 |
|
|
618 |
|
{ |
619 |
0 |
int cw = 0; |
620 |
0 |
boolean optset = false; |
621 |
0 |
for (ArgumentI myarg : args) |
622 |
|
{ |
623 |
|
|
624 |
0 |
if (myarg instanceof ParameterI) |
625 |
|
{ |
626 |
0 |
ParameterI parm = (ParameterI) myarg; |
627 |
0 |
opanp.addParameter(parm).validate(); |
628 |
|
} |
629 |
|
else |
630 |
|
{ |
631 |
0 |
if (myarg instanceof OptionI) |
632 |
|
{ |
633 |
0 |
OptionI opt = (OptionI) myarg; |
634 |
0 |
OptionBox ob = opanp.addOption(opt); |
635 |
0 |
ob.resetToDefault(setDefaultParams); |
636 |
0 |
if (MAX_OPTWIDTH < ob.getPreferredSize().width) |
637 |
|
{ |
638 |
0 |
MAX_OPTWIDTH = ob.getPreferredSize().width; |
639 |
|
} |
640 |
0 |
ob.validate(); |
641 |
0 |
cw += ob.getPreferredSize().width + 5; |
642 |
|
} |
643 |
|
else |
644 |
|
{ |
645 |
0 |
jalview.bin.Console |
646 |
|
.errPrintln("Ignoring unknown service argument type " |
647 |
|
+ myarg.getClass().getName()); |
648 |
|
} |
649 |
|
} |
650 |
|
} |
651 |
0 |
args = null; |
652 |
|
} |
653 |
0 |
if (p != null) |
654 |
|
{ |
655 |
0 |
isUserPreset = false; |
656 |
|
|
657 |
0 |
setName.setSelectedItem(lastSetName = p.getName()); |
658 |
0 |
setDescr.setText(lastDescrText = p.getDescription()); |
659 |
|
|
660 |
0 |
try |
661 |
|
{ |
662 |
0 |
args = p.getArguments(); |
663 |
|
} catch (Exception e) |
664 |
|
{ |
665 |
0 |
e.printStackTrace(); |
666 |
|
} |
667 |
|
|
668 |
|
|
669 |
|
} |
670 |
|
|
671 |
0 |
if (jobArgset != null) |
672 |
|
{ |
673 |
0 |
argSetModified(jobArgset, true); |
674 |
0 |
args = jobArgset; |
675 |
|
} |
676 |
|
|
677 |
0 |
if (args != null) |
678 |
|
{ |
679 |
0 |
for (ArgumentI arg : args) |
680 |
|
{ |
681 |
0 |
if (arg instanceof ParameterI) |
682 |
|
{ |
683 |
0 |
opanp.setParameter((ParameterI) arg); |
684 |
|
} |
685 |
|
else |
686 |
|
{ |
687 |
0 |
if (arg instanceof OptionI) |
688 |
|
{ |
689 |
|
|
690 |
|
|
691 |
|
|
692 |
0 |
opanp.selectOption((OptionI) arg, arg.getValue()); |
693 |
|
} |
694 |
|
} |
695 |
|
|
696 |
|
} |
697 |
|
} |
698 |
|
|
699 |
0 |
refreshParamLayout(); |
700 |
0 |
revalidate(); |
701 |
|
} |
702 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
703 |
0 |
private boolean isModified()... |
704 |
|
{ |
705 |
0 |
return modifiedElements.size() > 0; |
706 |
|
} |
707 |
|
|
708 |
|
private Hashtable modifiedElements = new Hashtable(); |
709 |
|
|
710 |
|
|
711 |
|
|
712 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
713 |
0 |
private void initArgSetModified()... |
714 |
|
{ |
715 |
0 |
curSetName = null; |
716 |
0 |
modifiedElements.clear(); |
717 |
0 |
updateButtonDisplay(); |
718 |
|
} |
719 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.33 |
|
720 |
0 |
private void updateButtonDisplay()... |
721 |
|
{ |
722 |
0 |
boolean _update = false, _create = false, _delete = false, |
723 |
|
_revert = false; |
724 |
0 |
if (modifiedElements.size() > 0) |
725 |
|
{ |
726 |
|
|
727 |
0 |
_revert = true; |
728 |
0 |
_update = isUserPreset; |
729 |
0 |
if (!isUserPreset || modifiedElements.containsKey(setName)) |
730 |
|
{ |
731 |
|
|
732 |
0 |
_create = true; |
733 |
|
} |
734 |
|
} |
735 |
|
else |
736 |
|
{ |
737 |
|
|
738 |
|
} |
739 |
|
|
740 |
0 |
_delete = isUserPreset; |
741 |
|
|
742 |
0 |
createpref.setVisible(_create); |
743 |
0 |
updatepref.setVisible(_update); |
744 |
0 |
deletepref.setVisible(_delete); |
745 |
0 |
revertpref.setVisible(_revert); |
746 |
0 |
validate(); |
747 |
|
} |
748 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 8 |
Complexity Density: 0.73 |
|
749 |
0 |
@Override... |
750 |
|
public void argSetModified(Object modifiedElement, boolean b) |
751 |
|
{ |
752 |
0 |
if (settingDialog) |
753 |
|
{ |
754 |
0 |
return; |
755 |
|
} |
756 |
0 |
if (!b) |
757 |
|
{ |
758 |
0 |
modifiedElements.remove(modifiedElement); |
759 |
|
} |
760 |
|
else |
761 |
|
{ |
762 |
0 |
if (b && modifiedElement == setName |
763 |
|
&& modifiedElements.contains(modifiedElement)) |
764 |
|
{ |
765 |
|
|
766 |
0 |
b = false; |
767 |
|
} |
768 |
0 |
modifiedElements.put(modifiedElement, modifiedElement); |
769 |
|
} |
770 |
|
|
771 |
0 |
if (b && modifiedElements.size() > 0) |
772 |
|
{ |
773 |
0 |
makeSetNameValid(!isUserPreset); |
774 |
0 |
SetNamePanel.revalidate(); |
775 |
|
} |
776 |
0 |
updateButtonDisplay(); |
777 |
|
} |
778 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
779 |
0 |
private boolean isServicePreset(String selectedItem)... |
780 |
|
{ |
781 |
0 |
return selectedItem.equals(SVC_DEF) |
782 |
|
|| servicePresets.containsKey(selectedItem); |
783 |
|
} |
784 |
|
|
785 |
|
|
786 |
|
|
787 |
|
|
788 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 10 |
Complexity Density: 0.37 |
|
789 |
0 |
private void makeSetNameValid(boolean newuserset)... |
790 |
|
{ |
791 |
0 |
boolean stn = settingDialog; |
792 |
0 |
boolean renamed = false; |
793 |
0 |
settingDialog = true; |
794 |
0 |
String nm = (curSetName != null ? curSetName |
795 |
|
: (String) setName.getSelectedItem()); |
796 |
|
|
797 |
0 |
if (isServicePreset(nm)) |
798 |
|
{ |
799 |
0 |
nm = "User " + nm; |
800 |
0 |
renamed = true; |
801 |
|
} |
802 |
0 |
String tnm = nm; |
803 |
0 |
if (newuserset) |
804 |
|
{ |
805 |
0 |
int i = 0; |
806 |
0 |
while (paramStore.getPreset(tnm) != null) |
807 |
|
{ |
808 |
0 |
tnm = nm + " (" + (++i) + ")"; |
809 |
0 |
renamed = true; |
810 |
|
} |
811 |
0 |
if (i > 0) |
812 |
|
{ |
813 |
0 |
nm = tnm; |
814 |
|
} |
815 |
|
} |
816 |
|
|
817 |
0 |
boolean makeupdate = false; |
818 |
|
|
819 |
0 |
for (int i = 0, iS = setName.getItemCount(); i < iS; i++) |
820 |
|
{ |
821 |
0 |
String snm = (String) setName.getItemAt(i); |
822 |
0 |
if (snm.equals(nm)) |
823 |
|
{ |
824 |
0 |
makeupdate = true; |
825 |
|
|
826 |
|
} |
827 |
|
} |
828 |
0 |
if (!makeupdate) |
829 |
|
{ |
830 |
0 |
setName.addItem(curSetName = nm); |
831 |
0 |
setName.setSelectedItem(curSetName); |
832 |
|
} |
833 |
0 |
if (renamed) |
834 |
|
{ |
835 |
0 |
settingDialog = false; |
836 |
0 |
argSetModified(setName, renamed); |
837 |
|
} |
838 |
0 |
settingDialog = stn; |
839 |
|
} |
840 |
|
|
|
|
| 0% |
Uncovered Elements: 60 (60) |
Complexity: 8 |
Complexity Density: 0.17 |
|
841 |
0 |
@Override... |
842 |
|
public void refreshParamLayout() |
843 |
|
{ |
844 |
|
|
845 |
0 |
FlowLayout fl = new FlowLayout(FlowLayout.LEFT); |
846 |
0 |
int sep = fl.getVgap(); |
847 |
0 |
boolean fh = true; |
848 |
0 |
int os = 0, |
849 |
|
s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom |
850 |
|
+ jobOptions.getBorder().getBorderInsets(jobOptions).top |
851 |
|
+ 2 * sep; |
852 |
|
|
853 |
|
|
854 |
|
|
855 |
0 |
int finalh = s; |
856 |
0 |
int panewidth = paramPane.getViewport().getSize().width - 120 |
857 |
|
- jobOptions.getBorder().getBorderInsets(jobOptions).left |
858 |
|
+ jobOptions.getBorder().getBorderInsets(jobOptions).right; |
859 |
|
|
860 |
0 |
int w = 2 * fl.getHgap() |
861 |
0 |
+ (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH |
862 |
|
: OptsAndParamsPage.PARAM_WIDTH); |
863 |
0 |
int hgap = fl.getHgap(), cw = hgap; |
864 |
|
|
865 |
0 |
if (opanp.getOptSet().size() > 0) |
866 |
|
{ |
867 |
|
|
868 |
0 |
jobOptions.setLayout(new MigLayout("", "", "")); |
869 |
0 |
jobOptions.removeAll(); |
870 |
|
|
871 |
0 |
for (OptionBox pbox : opanp.getOptSet().values()) |
872 |
|
{ |
873 |
0 |
pbox.validate(); |
874 |
0 |
cw += pbox.getSize().width + hgap; |
875 |
0 |
if (cw + 120 > panewidth) |
876 |
|
{ |
877 |
0 |
jobOptions.add(pbox, "wrap"); |
878 |
|
|
879 |
0 |
cw = hgap + pbox.getSize().width; |
880 |
0 |
fh = true; |
881 |
|
} |
882 |
|
else |
883 |
|
{ |
884 |
0 |
jobOptions.add(pbox); |
885 |
|
} |
886 |
0 |
if (fh) |
887 |
|
{ |
888 |
0 |
finalh += pbox.getSize().height + fl.getVgap(); |
889 |
0 |
fh = false; |
890 |
|
} |
891 |
|
} |
892 |
0 |
jobOptions.revalidate(); |
893 |
|
} |
894 |
|
else |
895 |
|
{ |
896 |
0 |
jobOptions.setVisible(false); |
897 |
|
} |
898 |
|
|
899 |
|
|
900 |
|
|
901 |
0 |
fl = new FlowLayout(FlowLayout.LEFT); |
902 |
|
|
903 |
|
|
904 |
0 |
fl.setAlignOnBaseline(true); |
905 |
0 |
if (opanp.getParamSet().size() > 0) |
906 |
|
{ |
907 |
0 |
paramList.removeAll(); |
908 |
0 |
paramList.setLayout(new MigLayout("", "", "")); |
909 |
0 |
fh = true; |
910 |
0 |
for (ParamBox pbox : opanp.getParamSet().values()) |
911 |
|
{ |
912 |
0 |
pbox.validate(); |
913 |
0 |
cw += pbox.getSize().width + hgap; |
914 |
0 |
if (cw + 160 > panewidth) |
915 |
|
{ |
916 |
0 |
paramList.add(pbox, "wrap"); |
917 |
0 |
cw = pbox.getSize().width + hgap; |
918 |
0 |
fh = true; |
919 |
|
} |
920 |
|
else |
921 |
|
{ |
922 |
0 |
paramList.add(pbox); |
923 |
|
} |
924 |
0 |
if (fh) |
925 |
|
{ |
926 |
0 |
finalh += pbox.getSize().height + fl.getVgap(); |
927 |
0 |
fh = false; |
928 |
|
} |
929 |
|
|
930 |
|
} |
931 |
|
|
932 |
|
|
933 |
|
|
934 |
|
|
935 |
|
|
936 |
|
|
937 |
|
|
938 |
|
|
939 |
|
|
940 |
|
|
941 |
|
|
942 |
0 |
paramList.revalidate(); |
943 |
|
} |
944 |
|
else |
945 |
|
{ |
946 |
0 |
paramList.setVisible(false); |
947 |
|
} |
948 |
|
|
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
|
953 |
0 |
paramPane.getViewport().setAutoscrolls(true); |
954 |
0 |
paramPane.revalidate(); |
955 |
0 |
revalidate(); |
956 |
|
} |
957 |
|
|
958 |
|
|
959 |
|
|
960 |
|
|
961 |
|
@param |
962 |
|
|
963 |
|
|
|
|
| 0% |
Uncovered Elements: 118 (118) |
Complexity: 26 |
Complexity Density: 0.3 |
|
964 |
0 |
public static void main(String[] args)... |
965 |
|
{ |
966 |
0 |
jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer |
967 |
|
.getDiscoverer(); |
968 |
0 |
int p = 0; |
969 |
0 |
if (args.length > 0) |
970 |
|
{ |
971 |
0 |
Vector<String> services = new Vector<>(); |
972 |
0 |
services.addElement(args[p++]); |
973 |
0 |
Jws2Discoverer.getDiscoverer().setServiceUrls(services); |
974 |
|
} |
975 |
0 |
try |
976 |
|
{ |
977 |
0 |
disc.run(); |
978 |
|
} catch (Exception e) |
979 |
|
{ |
980 |
0 |
jalview.bin.Console |
981 |
|
.errPrintln("Aborting. Problem discovering services."); |
982 |
0 |
e.printStackTrace(); |
983 |
0 |
return; |
984 |
|
} |
985 |
0 |
Jws2Instance lastserv = null; |
986 |
0 |
for (Jws2Instance service : disc.getServices()) |
987 |
|
{ |
988 |
0 |
lastserv = service; |
989 |
0 |
if (p >= args.length || service.serviceType.equalsIgnoreCase(args[p])) |
990 |
|
{ |
991 |
0 |
if (lastserv != null) |
992 |
|
{ |
993 |
0 |
List<Preset> prl = null; |
994 |
0 |
Preset pr = null; |
995 |
0 |
if (++p < args.length) |
996 |
|
{ |
997 |
0 |
PresetManager prman = lastserv.getPresets(); |
998 |
0 |
if (prman != null) |
999 |
|
{ |
1000 |
0 |
pr = prman.getPresetByName(args[p]); |
1001 |
0 |
if (pr == null) |
1002 |
|
{ |
1003 |
|
|
1004 |
0 |
prl = prman.getPresets(); |
1005 |
|
} |
1006 |
|
} |
1007 |
|
} |
1008 |
|
else |
1009 |
|
{ |
1010 |
0 |
PresetManager prman = lastserv.getPresets(); |
1011 |
0 |
if (prman != null) |
1012 |
|
{ |
1013 |
0 |
prl = prman.getPresets(); |
1014 |
|
} |
1015 |
|
} |
1016 |
0 |
Iterator<Preset> en = (prl == null) ? null : prl.iterator(); |
1017 |
0 |
while (en != null && en.hasNext()) |
1018 |
|
{ |
1019 |
0 |
if (en != null) |
1020 |
|
{ |
1021 |
0 |
if (!en.hasNext()) |
1022 |
|
{ |
1023 |
0 |
en = prl.iterator(); |
1024 |
|
} |
1025 |
0 |
pr = en.next(); |
1026 |
|
} |
1027 |
|
{ |
1028 |
0 |
jalview.bin.Console.outPrintln("Testing opts dupes for " |
1029 |
|
+ lastserv.getUri() + " : " + lastserv.getActionText() |
1030 |
|
+ ":" + pr.getName()); |
1031 |
0 |
List<Option> rg = lastserv.getRunnerConfig().getOptions(); |
1032 |
0 |
for (Option o : rg) |
1033 |
|
{ |
1034 |
0 |
try |
1035 |
|
{ |
1036 |
0 |
Option cpy = jalview.ws.jws2.ParameterUtils.copyOption(o); |
1037 |
|
} catch (Exception e) |
1038 |
|
{ |
1039 |
0 |
jalview.bin.Console |
1040 |
|
.errPrintln("Failed to copy " + o.getName()); |
1041 |
0 |
e.printStackTrace(); |
1042 |
|
} catch (Error e) |
1043 |
|
{ |
1044 |
0 |
jalview.bin.Console |
1045 |
|
.errPrintln("Failed to copy " + o.getName()); |
1046 |
0 |
e.printStackTrace(); |
1047 |
|
} |
1048 |
|
} |
1049 |
|
} |
1050 |
|
{ |
1051 |
0 |
jalview.bin.Console.outPrintln("Testing param dupes:"); |
1052 |
0 |
List<Parameter> rg = lastserv.getRunnerConfig() |
1053 |
|
.getParameters(); |
1054 |
0 |
for (Parameter o : rg) |
1055 |
|
{ |
1056 |
0 |
try |
1057 |
|
{ |
1058 |
0 |
Parameter cpy = jalview.ws.jws2.ParameterUtils |
1059 |
|
.copyParameter(o); |
1060 |
|
} catch (Exception e) |
1061 |
|
{ |
1062 |
0 |
jalview.bin.Console |
1063 |
|
.errPrintln("Failed to copy " + o.getName()); |
1064 |
0 |
e.printStackTrace(); |
1065 |
|
} catch (Error e) |
1066 |
|
{ |
1067 |
0 |
jalview.bin.Console |
1068 |
|
.errPrintln("Failed to copy " + o.getName()); |
1069 |
0 |
e.printStackTrace(); |
1070 |
|
} |
1071 |
|
} |
1072 |
|
} |
1073 |
|
{ |
1074 |
0 |
jalview.bin.Console.outPrintln("Testing param write:"); |
1075 |
0 |
List<String> writeparam = null, readparam = null; |
1076 |
0 |
try |
1077 |
|
{ |
1078 |
0 |
writeparam = jalview.ws.jws2.ParameterUtils |
1079 |
|
.writeParameterSet( |
1080 |
|
pr.getArguments(lastserv.getRunnerConfig()), |
1081 |
|
" "); |
1082 |
0 |
jalview.bin.Console.outPrintln("Testing param read :"); |
1083 |
0 |
List<Option> pset = jalview.ws.jws2.ParameterUtils |
1084 |
|
.processParameters(writeparam, |
1085 |
|
lastserv.getRunnerConfig(), " "); |
1086 |
0 |
readparam = jalview.ws.jws2.ParameterUtils |
1087 |
|
.writeParameterSet(pset, " "); |
1088 |
0 |
Iterator<String> o = pr.getOptions().iterator(), |
1089 |
|
s = writeparam.iterator(), t = readparam.iterator(); |
1090 |
0 |
boolean failed = false; |
1091 |
0 |
while (s.hasNext() && t.hasNext()) |
1092 |
|
{ |
1093 |
0 |
String on = o.next(), sn = s.next(), st = t.next(); |
1094 |
0 |
if (!sn.equals(st)) |
1095 |
|
{ |
1096 |
0 |
jalview.bin.Console.outPrintln( |
1097 |
|
"Original was " + on + " Phase 1 wrote " + sn |
1098 |
|
+ "\tPhase 2 wrote " + st); |
1099 |
0 |
failed = true; |
1100 |
|
} |
1101 |
|
} |
1102 |
0 |
if (failed) |
1103 |
|
{ |
1104 |
0 |
jalview.bin.Console.outPrintln( |
1105 |
|
"Original parameters:\n" + pr.getOptions()); |
1106 |
0 |
jalview.bin.Console.outPrintln( |
1107 |
|
"Wrote parameters in first set:\n" + writeparam); |
1108 |
0 |
jalview.bin.Console.outPrintln( |
1109 |
|
"Wrote parameters in second set:\n" + readparam); |
1110 |
|
|
1111 |
|
} |
1112 |
|
} catch (Exception e) |
1113 |
|
{ |
1114 |
0 |
e.printStackTrace(); |
1115 |
|
} |
1116 |
|
} |
1117 |
0 |
WsJobParameters pgui = new WsJobParameters(lastserv, |
1118 |
|
new JabaPreset(lastserv, pr)); |
1119 |
0 |
JFrame jf = new JFrame(MessageManager |
1120 |
|
.formatMessage("label.ws_parameters_for", new String[] |
1121 |
|
{ lastserv.getActionText() })); |
1122 |
0 |
JPanel cont = new JPanel(new BorderLayout()); |
1123 |
0 |
pgui.validate(); |
1124 |
0 |
cont.setPreferredSize(pgui.getPreferredSize()); |
1125 |
0 |
cont.add(pgui, BorderLayout.CENTER); |
1126 |
0 |
jf.setLayout(new BorderLayout()); |
1127 |
0 |
jf.add(cont, BorderLayout.CENTER); |
1128 |
0 |
jf.validate(); |
1129 |
0 |
final Thread thr = Thread.currentThread(); |
1130 |
0 |
jf.addWindowListener(new WindowListener() |
1131 |
|
{ |
1132 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1133 |
0 |
@Override... |
1134 |
|
public void windowActivated(WindowEvent e) |
1135 |
|
{ |
1136 |
|
|
1137 |
|
|
1138 |
|
} |
1139 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1140 |
0 |
@Override... |
1141 |
|
public void windowClosed(WindowEvent e) |
1142 |
|
{ |
1143 |
|
} |
1144 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1145 |
0 |
@Override... |
1146 |
|
public void windowClosing(WindowEvent e) |
1147 |
|
{ |
1148 |
0 |
thr.interrupt(); |
1149 |
|
|
1150 |
|
} |
1151 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1152 |
0 |
@Override... |
1153 |
|
public void windowDeactivated(WindowEvent e) |
1154 |
|
{ |
1155 |
|
|
1156 |
|
|
1157 |
|
} |
1158 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1159 |
0 |
@Override... |
1160 |
|
public void windowDeiconified(WindowEvent e) |
1161 |
|
{ |
1162 |
|
|
1163 |
|
|
1164 |
|
} |
1165 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1166 |
0 |
@Override... |
1167 |
|
public void windowIconified(WindowEvent e) |
1168 |
|
{ |
1169 |
|
|
1170 |
|
|
1171 |
|
} |
1172 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1173 |
0 |
@Override... |
1174 |
|
public void windowOpened(WindowEvent e) |
1175 |
|
{ |
1176 |
|
|
1177 |
|
|
1178 |
|
} |
1179 |
|
|
1180 |
|
}); |
1181 |
0 |
jf.setVisible(true); |
1182 |
0 |
boolean inter = false; |
1183 |
0 |
while (!inter) |
1184 |
|
{ |
1185 |
0 |
try |
1186 |
|
{ |
1187 |
0 |
Thread.sleep(10000); |
1188 |
|
} catch (Exception e) |
1189 |
|
{ |
1190 |
0 |
inter = true; |
1191 |
|
} |
1192 |
|
} |
1193 |
0 |
jf.dispose(); |
1194 |
|
} |
1195 |
|
} |
1196 |
|
} |
1197 |
|
} |
1198 |
|
} |
1199 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1200 |
0 |
public boolean isServiceDefaults()... |
1201 |
|
{ |
1202 |
0 |
return (!isModified() |
1203 |
|
&& (lastParmSet != null && lastParmSet.equals(SVC_DEF))); |
1204 |
|
} |
1205 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1206 |
0 |
public List<ArgumentI> getJobParams()... |
1207 |
|
{ |
1208 |
0 |
return opanp.getCurrentSettings(); |
1209 |
|
} |
1210 |
|
|
1211 |
|
String lastParmSet = null; |
1212 |
|
|
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
@param |
1220 |
|
|
1221 |
|
@param |
1222 |
|
|
1223 |
|
@param |
1224 |
|
|
1225 |
|
|
1226 |
|
|
1227 |
|
|
1228 |
|
|
1229 |
|
|
1230 |
|
|
1231 |
|
|
1232 |
|
|
1233 |
|
|
1234 |
|
|
1235 |
|
|
1236 |
|
|
1237 |
|
|
1238 |
|
|
1239 |
|
|
1240 |
|
|
1241 |
|
@param |
1242 |
|
|
1243 |
|
|
1244 |
|
|
1245 |
|
|
1246 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
1247 |
0 |
private void syncSetNamesWithStore()... |
1248 |
|
{ |
1249 |
0 |
int n = 0; |
1250 |
|
|
1251 |
|
|
1252 |
0 |
Vector items = new Vector(); |
1253 |
0 |
while (n < setName.getItemCount()) |
1254 |
|
{ |
1255 |
0 |
String item = (String) setName.getItemAt(n); |
1256 |
0 |
if (!item.equals(SVC_DEF) && !paramStore.presetExists(item)) |
1257 |
|
{ |
1258 |
0 |
setName.removeItemAt(n); |
1259 |
|
} |
1260 |
|
else |
1261 |
|
{ |
1262 |
0 |
items.addElement(item); |
1263 |
0 |
n++; |
1264 |
|
} |
1265 |
|
} |
1266 |
0 |
if (!items.contains(SVC_DEF)) |
1267 |
|
{ |
1268 |
0 |
setName.addItem(SVC_DEF); |
1269 |
|
} |
1270 |
0 |
for (WsParamSetI upn : paramStore.getPresets()) |
1271 |
|
{ |
1272 |
0 |
if (!items.contains(upn.getName())) |
1273 |
|
{ |
1274 |
0 |
setName.addItem(upn.getName()); |
1275 |
|
} |
1276 |
|
} |
1277 |
|
} |
1278 |
|
|
1279 |
|
|
1280 |
|
|
1281 |
|
|
1282 |
|
boolean isUserPreset = false; |
1283 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 5 |
Complexity Density: 0.21 |
|
1284 |
0 |
private void reInitDialog(String nextPreset)... |
1285 |
|
{ |
1286 |
0 |
settingDialog = true; |
1287 |
|
|
1288 |
0 |
WsParamSetI pset = null; |
1289 |
0 |
if (nextPreset != null && nextPreset.length() > 0) |
1290 |
|
{ |
1291 |
0 |
pset = paramStore.getPreset(nextPreset); |
1292 |
|
} |
1293 |
0 |
if (pset != null) |
1294 |
|
{ |
1295 |
0 |
if (pset.isModifiable()) |
1296 |
|
{ |
1297 |
0 |
isUserPreset = true; |
1298 |
0 |
setDescr.setText(pset.getDescription()); |
1299 |
0 |
updateTable(null, pset.getArguments()); |
1300 |
0 |
lastParmSet = nextPreset; |
1301 |
|
} |
1302 |
|
else |
1303 |
|
{ |
1304 |
0 |
isUserPreset = false; |
1305 |
0 |
setDescr.setText(""); |
1306 |
|
|
1307 |
0 |
updateTable(pset, null); |
1308 |
0 |
lastParmSet = nextPreset; |
1309 |
|
} |
1310 |
|
} |
1311 |
|
else |
1312 |
|
{ |
1313 |
0 |
isUserPreset = false; |
1314 |
|
|
1315 |
0 |
setDescr.setText(""); |
1316 |
0 |
updateTable(null, null); |
1317 |
0 |
lastParmSet = SVC_DEF; |
1318 |
|
} |
1319 |
|
|
1320 |
0 |
initArgSetModified(); |
1321 |
0 |
syncSetNamesWithStore(); |
1322 |
0 |
setName.setSelectedItem(lastParmSet); |
1323 |
0 |
SetNamePanel.validate(); |
1324 |
0 |
validate(); |
1325 |
0 |
settingDialog = false; |
1326 |
|
} |
1327 |
|
|
1328 |
|
|
1329 |
|
|
1330 |
|
|
1331 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1332 |
0 |
protected void updateWebServiceMenus()... |
1333 |
|
{ |
1334 |
0 |
for (AlignFrame alignFrame : Desktop.getDesktopAlignFrames()) |
1335 |
|
{ |
1336 |
0 |
alignFrame.BuildWebServiceMenu(); |
1337 |
|
} |
1338 |
|
} |
1339 |
|
|
1340 |
|
String curSetName = null; |
1341 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.67 |
|
1342 |
0 |
@Override... |
1343 |
|
public void itemStateChanged(ItemEvent e) |
1344 |
|
{ |
1345 |
0 |
if (e.getSource() == setName && e.getStateChange() == e.SELECTED) |
1346 |
|
{ |
1347 |
0 |
final String setname = (String) setName.getSelectedItem(); |
1348 |
0 |
if (Console.isDebugEnabled()) |
1349 |
|
{ |
1350 |
0 |
Console.debug("Item state changed for " + setname + " (handling ? " |
1351 |
|
+ !settingDialog + ")"); |
1352 |
|
} |
1353 |
0 |
if (settingDialog) |
1354 |
|
{ |
1355 |
|
|
1356 |
0 |
return; |
1357 |
|
} |
1358 |
0 |
if (setname == null) |
1359 |
|
{ |
1360 |
0 |
return; |
1361 |
|
} |
1362 |
0 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
1363 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1364 |
0 |
@Override... |
1365 |
|
public void run() |
1366 |
|
{ |
1367 |
0 |
doPreferenceComboStateChange(setname); |
1368 |
|
} |
1369 |
|
}); |
1370 |
|
} |
1371 |
|
} |
1372 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 5 |
Complexity Density: 0.36 |
|
1373 |
0 |
private void doPreferenceComboStateChange(String setname)... |
1374 |
|
{ |
1375 |
|
|
1376 |
0 |
if (isModified()) |
1377 |
|
{ |
1378 |
0 |
String lsetname = (curSetName != null) ? curSetName : lastParmSet; |
1379 |
0 |
if (lsetname.equals(setname)) |
1380 |
|
{ |
1381 |
|
|
1382 |
0 |
return; |
1383 |
|
} |
1384 |
0 |
settingDialog = true; |
1385 |
0 |
jalview.bin.Console.outPrintln("Prompting to save " + lsetname); |
1386 |
0 |
if (JvOptionPane.showConfirmDialog(this, "Parameter set '" + lsetname |
1387 |
|
+ "' is modifed, and your changes will be lost.\nReally change preset ?", |
1388 |
|
"Warning: Unsaved Changes", |
1389 |
|
JvOptionPane.OK_CANCEL_OPTION) != JvOptionPane.OK_OPTION) |
1390 |
|
{ |
1391 |
|
|
1392 |
0 |
settingDialog = true; |
1393 |
0 |
setName.setSelectedItem(lsetname); |
1394 |
0 |
settingDialog = false; |
1395 |
|
|
1396 |
0 |
return; |
1397 |
|
|
1398 |
|
|
1399 |
|
|
1400 |
|
} |
1401 |
|
} |
1402 |
0 |
settingDialog = true; |
1403 |
0 |
reInitDialog(setname); |
1404 |
0 |
settingDialog = false; |
1405 |
|
|
1406 |
|
} |
1407 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1408 |
0 |
private void _renameExistingPreset(String oldName, String curSetName2)... |
1409 |
|
{ |
1410 |
0 |
paramStore.updatePreset(oldName, curSetName2, setDescr.getText(), |
1411 |
|
getJobParams()); |
1412 |
|
} |
1413 |
|
|
1414 |
|
|
1415 |
|
|
1416 |
|
|
1417 |
|
@param |
1418 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1419 |
0 |
private void _storeCurrentPreset(String curSetName2)... |
1420 |
|
{ |
1421 |
0 |
paramStore.storePreset(curSetName2, setDescr.getText(), getJobParams()); |
1422 |
|
} |
1423 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1424 |
0 |
private void _updatePreset(String lastParmSet2, String curname)... |
1425 |
|
{ |
1426 |
0 |
paramStore.updatePreset(lastParmSet2, curname, setDescr.getText(), |
1427 |
|
getJobParams()); |
1428 |
|
|
1429 |
|
} |
1430 |
|
|
1431 |
|
|
1432 |
|
|
1433 |
|
|
1434 |
|
String lastSetName = null; |
1435 |
|
|
1436 |
|
|
1437 |
|
|
1438 |
|
|
1439 |
|
String lastDescrText = null; |
1440 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 7 |
Complexity Density: 0.35 |
|
1441 |
0 |
@Override... |
1442 |
|
public void actionPerformed(ActionEvent e) |
1443 |
|
{ |
1444 |
0 |
if (e.getSource() instanceof Component) |
1445 |
|
{ |
1446 |
0 |
Component src = (Component) e.getSource(); |
1447 |
0 |
if (src.getParent() == setName) |
1448 |
|
{ |
1449 |
|
|
1450 |
0 |
String newname = e.getActionCommand().trim(); |
1451 |
0 |
String msg = null; |
1452 |
0 |
if (isServicePreset(newname)) |
1453 |
|
{ |
1454 |
0 |
final String oldname = curSetName != null ? curSetName |
1455 |
|
: lastParmSet; |
1456 |
0 |
final Component ourframe = this; |
1457 |
0 |
settingDialog = true; |
1458 |
0 |
setName.getEditor().setItem(oldname); |
1459 |
0 |
settingDialog = false; |
1460 |
0 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
1461 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1462 |
0 |
@Override... |
1463 |
|
public void run() |
1464 |
|
{ |
1465 |
0 |
JvOptionPane.showMessageDialog(ourframe, |
1466 |
|
MessageManager.getString( |
1467 |
|
"label.invalid_name_preset_exists"), |
1468 |
|
MessageManager.getString("label.invalid_name"), |
1469 |
|
JvOptionPane.WARNING_MESSAGE); |
1470 |
|
} |
1471 |
|
}); |
1472 |
|
|
1473 |
0 |
return; |
1474 |
|
} |
1475 |
0 |
curSetName = newname; |
1476 |
0 |
jalview.bin.Console.errPrintln("New name for user setting " |
1477 |
|
+ curSetName + " (was " + setName.getSelectedItem() + ")"); |
1478 |
0 |
if (curSetName.equals(setName.getSelectedItem())) |
1479 |
|
{ |
1480 |
0 |
curSetName = null; |
1481 |
|
} |
1482 |
0 |
if (curSetName != null) |
1483 |
|
{ |
1484 |
0 |
argSetModified(setName, true); |
1485 |
0 |
return; |
1486 |
|
} |
1487 |
|
|
1488 |
|
} |
1489 |
|
} |
1490 |
|
} |
1491 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 1.5 |
|
1492 |
0 |
private void checkDescrModified()... |
1493 |
|
{ |
1494 |
0 |
if (!settingDialog) |
1495 |
|
{ |
1496 |
|
|
1497 |
0 |
argSetModified(setDescr, |
1498 |
0 |
(lastDescrText == null |
1499 |
|
? setDescr.getText().trim().length() > 0 |
1500 |
|
: !setDescr.getText().equals(lastDescrText))); |
1501 |
|
|
1502 |
|
} |
1503 |
|
} |
1504 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1505 |
0 |
@Override... |
1506 |
|
public void insertUpdate(DocumentEvent e) |
1507 |
|
{ |
1508 |
0 |
checkDescrModified(); |
1509 |
|
} |
1510 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1511 |
0 |
@Override... |
1512 |
|
public void removeUpdate(DocumentEvent e) |
1513 |
|
{ |
1514 |
0 |
checkDescrModified(); |
1515 |
|
} |
1516 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1517 |
0 |
@Override... |
1518 |
|
public void changedUpdate(DocumentEvent e) |
1519 |
|
{ |
1520 |
0 |
checkDescrModified(); |
1521 |
|
} |
1522 |
|
|
1523 |
|
|
1524 |
|
|
1525 |
|
@return |
1526 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 5 |
Complexity Density: 1.67 |
|
1527 |
0 |
public WsParamSetI getPreset()... |
1528 |
|
{ |
1529 |
0 |
if (isUserPreset || isModified() |
1530 |
|
|| (lastParmSet != null && lastParmSet.equals(SVC_DEF))) |
1531 |
|
{ |
1532 |
0 |
return null; |
1533 |
|
} |
1534 |
|
else |
1535 |
|
{ |
1536 |
0 |
return paramStore.getPreset(lastParmSet); |
1537 |
|
} |
1538 |
|
} |
1539 |
|
} |