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.Color; |
25 |
|
import java.awt.Component; |
26 |
|
import java.awt.Dimension; |
27 |
|
import java.awt.event.ActionEvent; |
28 |
|
import java.awt.event.ActionListener; |
29 |
|
import java.net.URL; |
30 |
|
import java.util.List; |
31 |
|
import java.util.Vector; |
32 |
|
|
33 |
|
import javax.swing.JLabel; |
34 |
|
import javax.swing.JPanel; |
35 |
|
import javax.swing.JTable; |
36 |
|
import javax.swing.JTextField; |
37 |
|
import javax.swing.table.AbstractTableModel; |
38 |
|
import javax.swing.table.TableCellRenderer; |
39 |
|
|
40 |
|
import jalview.bin.Cache; |
41 |
|
import jalview.jbgui.GWsPreferences; |
42 |
|
import jalview.util.MessageManager; |
43 |
|
import jalview.ws.jws2.Jws2Discoverer; |
44 |
|
import jalview.ws.rest.RestServiceDescription; |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 284 (284) |
Complexity: 75 |
Complexity Density: 0.41 |
|
46 |
|
public class WsPreferences extends GWsPreferences |
47 |
|
{ |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
49 |
0 |
public WsPreferences()... |
50 |
|
{ |
51 |
0 |
super(); |
52 |
0 |
initFromPreferences(); |
53 |
|
} |
54 |
|
|
55 |
|
List<String> wsUrls; |
56 |
|
|
57 |
|
Vector<String> oldUrls, rsbsUrls, oldRsbsUrls; |
58 |
|
|
59 |
|
private boolean needWsMenuUpdate; |
60 |
|
|
61 |
|
private boolean oldJws1, oldJws2, oldIndexByHost, oldIndexByType, |
62 |
|
oldEnfin, oldWsWarning; |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 3 |
Complexity Density: 0.13 |
|
64 |
0 |
private void initFromPreferences()... |
65 |
|
{ |
66 |
|
|
67 |
0 |
wsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls(); |
68 |
0 |
if (!wsUrls.isEmpty()) |
69 |
|
{ |
70 |
0 |
oldUrls = new Vector<String>(wsUrls); |
71 |
|
} |
72 |
|
else |
73 |
|
{ |
74 |
0 |
oldUrls = null; |
75 |
0 |
wsUrls = new Vector<String>(); |
76 |
|
} |
77 |
0 |
wsList.setDefaultRenderer(Integer.class, new JabaWSStatusRenderer()); |
78 |
0 |
wsList.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
79 |
0 |
updateList(); |
80 |
0 |
rsbsUrls = jalview.ws.rest.RestClient.getRsbsDescriptions(); |
81 |
0 |
if (rsbsUrls != null) |
82 |
|
{ |
83 |
0 |
oldRsbsUrls = new Vector<String>(rsbsUrls); |
84 |
|
} |
85 |
|
else |
86 |
|
{ |
87 |
0 |
oldRsbsUrls = null; |
88 |
0 |
rsbsUrls = new Vector<String>(); |
89 |
|
} |
90 |
0 |
updateRsbsList(); |
91 |
0 |
enableEnfinServices.setSelected( |
92 |
|
oldEnfin = Cache.getDefault("SHOW_ENFIN_SERVICES", true)); |
93 |
0 |
enableEnfinServices.addActionListener(updateAction); |
94 |
0 |
enableJws2Services.setSelected( |
95 |
|
oldJws2 = Cache.getDefault("SHOW_JWS2_SERVICES", true)); |
96 |
0 |
enableJws2Services.addActionListener(updateAction); |
97 |
0 |
indexByHost.setSelected( |
98 |
|
oldIndexByHost = Cache.getDefault("WSMENU_BYHOST", false)); |
99 |
0 |
indexByHost.addActionListener(updateAction); |
100 |
0 |
indexByType.setSelected( |
101 |
|
oldIndexByType = Cache.getDefault("WSMENU_BYTYPE", false)); |
102 |
0 |
indexByType.addActionListener(updateAction); |
103 |
0 |
displayWsWarning.setSelected(oldWsWarning = Cache |
104 |
|
.getDefault("SHOW_WSDISCOVERY_ERRORS", true)); |
105 |
|
} |
106 |
|
|
107 |
|
ActionListener updateAction = new ActionListener() |
108 |
|
{ |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0 |
@Override... |
111 |
|
public void actionPerformed(ActionEvent e) |
112 |
|
{ |
113 |
0 |
update++; |
114 |
|
} |
115 |
|
|
116 |
|
}; |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
118 |
0 |
private void updateList()... |
119 |
|
{ |
120 |
0 |
Object tdat[][] = new Object[wsUrls.size()][2]; |
121 |
0 |
int r = 0; |
122 |
0 |
for (String url : wsUrls) |
123 |
|
{ |
124 |
0 |
int status = Jws2Discoverer.getDiscoverer().getServerStatusFor(url); |
125 |
0 |
tdat[r][1] = Integer.valueOf(status); |
126 |
0 |
tdat[r++][0] = url; |
127 |
|
} |
128 |
|
|
129 |
0 |
wsList.setModel(new WsUrlTableModel(tdat)); |
130 |
0 |
wsList.getColumn(MessageManager.getString("label.status")) |
131 |
|
.setMinWidth(10); |
132 |
|
} |
133 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.28 |
|
134 |
|
private class JabaWSStatusRenderer extends JPanel |
135 |
|
implements TableCellRenderer |
136 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
137 |
0 |
public JabaWSStatusRenderer()... |
138 |
|
{ |
139 |
0 |
setOpaque(true); |
140 |
0 |
setMinimumSize(new Dimension(10, 10)); |
141 |
|
|
142 |
|
|
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.25 |
|
149 |
0 |
@Override... |
150 |
|
public Component getTableCellRendererComponent(JTable arg0, |
151 |
|
Object status, boolean isSelected, boolean hasFocus, int row, |
152 |
|
int column) |
153 |
|
{ |
154 |
0 |
Color c; |
155 |
0 |
String t = new String(""); |
156 |
0 |
switch (((Integer) status).intValue()) |
157 |
|
{ |
158 |
0 |
case 1: |
159 |
|
|
160 |
|
|
161 |
0 |
c = Color.green; |
162 |
0 |
break; |
163 |
0 |
case 0: |
164 |
|
|
165 |
|
|
166 |
0 |
c = Color.lightGray; |
167 |
0 |
break; |
168 |
0 |
case -1: |
169 |
|
|
170 |
|
|
171 |
0 |
c = Color.red; |
172 |
0 |
break; |
173 |
0 |
default: |
174 |
|
|
175 |
|
|
176 |
0 |
c = Color.orange; |
177 |
|
} |
178 |
0 |
setBackground(c); |
179 |
|
|
180 |
0 |
return this; |
181 |
|
|
182 |
|
} |
183 |
|
|
184 |
|
} |
185 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 7 |
Complexity Density: 0.88 |
|
186 |
|
private class WsUrlTableModel extends AbstractTableModel |
187 |
|
{ |
188 |
|
|
189 |
|
private Object[][] data; |
190 |
|
|
191 |
|
private String[] columnNames = new String[] { |
192 |
|
MessageManager.getString("label.service_url"), |
193 |
|
MessageManager.getString("label.status") }; |
194 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
195 |
0 |
public WsUrlTableModel(Object[][] tdat)... |
196 |
|
{ |
197 |
0 |
this.data = tdat; |
198 |
|
} |
199 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
0 |
@Override... |
201 |
|
public int getColumnCount() |
202 |
|
{ |
203 |
0 |
return 2; |
204 |
|
} |
205 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
0 |
@Override... |
207 |
|
public String getColumnName(int column) |
208 |
|
{ |
209 |
0 |
return columnNames[column]; |
210 |
|
} |
211 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
212 |
0 |
@Override... |
213 |
|
public int getRowCount() |
214 |
|
{ |
215 |
0 |
if (data == null) |
216 |
|
{ |
217 |
0 |
return 0; |
218 |
|
} |
219 |
0 |
return data.length; |
220 |
|
} |
221 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
0 |
@Override... |
223 |
|
public java.lang.Class<?> getColumnClass(int columnIndex) |
224 |
|
{ |
225 |
0 |
return getValueAt(0, columnIndex).getClass(); |
226 |
|
}; |
227 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
228 |
0 |
@Override... |
229 |
|
public Object getValueAt(int rowIndex, int columnIndex) |
230 |
|
{ |
231 |
0 |
return data[rowIndex][columnIndex]; |
232 |
|
} |
233 |
|
|
234 |
|
} |
235 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
236 |
0 |
private void updateRsbsList()... |
237 |
|
{ |
238 |
0 |
sbrsList.setListData(rsbsUrls); |
239 |
|
} |
240 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
241 |
0 |
private void updateServiceList()... |
242 |
|
{ |
243 |
0 |
Jws2Discoverer.getDiscoverer().setServiceUrls(wsUrls); |
244 |
|
} |
245 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
246 |
0 |
private void updateRsbsServiceList()... |
247 |
|
{ |
248 |
0 |
jalview.ws.rest.RestClient.setRsbsServices(rsbsUrls); |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
@see |
255 |
|
|
256 |
|
|
257 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
258 |
0 |
@Override... |
259 |
|
protected void deleteWsUrl_actionPerformed(ActionEvent e) |
260 |
|
{ |
261 |
0 |
int sel = wsList.getSelectedRow(); |
262 |
0 |
if (sel > -1) |
263 |
|
{ |
264 |
0 |
wsUrls.remove(sel); |
265 |
0 |
update++; |
266 |
0 |
updateList(); |
267 |
|
} |
268 |
|
} |
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
@see |
274 |
|
|
275 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
276 |
0 |
@Override... |
277 |
|
protected void editWsUrl_actionPerformed(ActionEvent e) |
278 |
|
{ |
279 |
0 |
int sel = wsList.getSelectedRow(); |
280 |
0 |
if (sel > -1) |
281 |
|
{ |
282 |
0 |
String url = editUrl(wsUrls.get(sel), |
283 |
|
MessageManager.getString("label.edit_jabaws_url")); |
284 |
0 |
if (url != null) |
285 |
|
{ |
286 |
0 |
int present = wsUrls.indexOf(url); |
287 |
0 |
if (present == -1) |
288 |
|
{ |
289 |
0 |
update++; |
290 |
0 |
wsUrls.set(sel, url); |
291 |
0 |
updateList(); |
292 |
|
} |
293 |
|
else |
294 |
|
{ |
295 |
0 |
if (present != sel) |
296 |
|
{ |
297 |
0 |
wsUrls.remove(sel); |
298 |
0 |
updateList(); |
299 |
|
} |
300 |
|
} |
301 |
|
} |
302 |
|
} |
303 |
|
} |
304 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
305 |
0 |
@Override... |
306 |
|
protected void newSbrsUrl_actionPerformed(ActionEvent e) |
307 |
|
{ |
308 |
0 |
RestServiceEditorPane rse = new RestServiceEditorPane(); |
309 |
0 |
rse.showDialog(MessageManager.getString("label.add_new_sbrs_service")); |
310 |
0 |
String rservice = rse.getEditedRestService(); |
311 |
0 |
if (rservice != null && !rsbsUrls.contains(rservice)) |
312 |
|
{ |
313 |
0 |
rsbsUrls.add(rservice); |
314 |
0 |
update++; |
315 |
0 |
updateRsbsList(); |
316 |
|
} |
317 |
|
} |
318 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 5 |
Complexity Density: 0.33 |
|
319 |
0 |
@Override... |
320 |
|
protected void editSbrsUrl_actionPerformed(ActionEvent e) |
321 |
|
{ |
322 |
0 |
int sel = sbrsList.getSelectedIndex(); |
323 |
0 |
if (sel > -1) |
324 |
|
{ |
325 |
0 |
RestServiceEditorPane rse = new RestServiceEditorPane( |
326 |
|
new RestServiceDescription(rsbsUrls.elementAt(sel))); |
327 |
0 |
rse.showDialog(MessageManager.getString("label.edit_sbrs_entry")); |
328 |
0 |
String rservice = rse.getEditedRestService(); |
329 |
0 |
if (rservice != null) |
330 |
|
{ |
331 |
0 |
int present = rsbsUrls.indexOf(rservice); |
332 |
0 |
if (present == -1) |
333 |
|
{ |
334 |
0 |
update++; |
335 |
0 |
rsbsUrls.setElementAt(rservice, sel); |
336 |
0 |
updateRsbsList(); |
337 |
|
} |
338 |
|
else |
339 |
|
{ |
340 |
0 |
if (present != sel) |
341 |
|
{ |
342 |
0 |
rsbsUrls.removeElementAt(sel); |
343 |
0 |
update++; |
344 |
0 |
updateRsbsList(); |
345 |
|
} |
346 |
|
} |
347 |
|
} |
348 |
|
} |
349 |
|
} |
350 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 17 |
Complexity Density: 1.21 |
|
351 |
0 |
void updateWsMenuConfig(boolean old)... |
352 |
|
{ |
353 |
0 |
if (old) |
354 |
|
{ |
355 |
0 |
if (oldUrls != wsUrls || (wsUrls != null && oldUrls != null |
356 |
|
&& !wsUrls.equals(oldUrls))) |
357 |
|
{ |
358 |
0 |
update++; |
359 |
|
} |
360 |
0 |
wsUrls = (oldUrls == null) ? null : new Vector(oldUrls); |
361 |
0 |
if (oldRsbsUrls != rsbsUrls || (rsbsUrls != null |
362 |
|
&& oldRsbsUrls != null && !oldRsbsUrls.equals(rsbsUrls))) |
363 |
|
{ |
364 |
0 |
update++; |
365 |
|
} |
366 |
0 |
oldRsbsUrls = (oldRsbsUrls == null) ? null : new Vector(oldRsbsUrls); |
367 |
|
} |
368 |
|
else |
369 |
|
{ |
370 |
|
|
371 |
|
} |
372 |
0 |
Cache.setProperty("SHOW_ENFIN_SERVICES", |
373 |
|
Boolean.valueOf( |
374 |
0 |
old ? oldEnfin : enableEnfinServices.isSelected()) |
375 |
|
.toString()); |
376 |
0 |
Cache.setProperty("SHOW_JWS2_SERVICES", |
377 |
0 |
Boolean.valueOf(old ? oldJws2 : enableJws2Services.isSelected()) |
378 |
|
.toString()); |
379 |
0 |
Cache.setProperty("WSMENU_BYHOST", |
380 |
0 |
Boolean.valueOf(old ? oldIndexByHost : indexByHost.isSelected()) |
381 |
|
.toString()); |
382 |
0 |
Cache.setProperty("WSMENU_BYTYPE", |
383 |
0 |
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected()) |
384 |
|
.toString()); |
385 |
|
|
386 |
0 |
Cache.setProperty("SHOW_WSDISCOVERY_ERRORS", |
387 |
|
Boolean.valueOf( |
388 |
0 |
old ? oldWsWarning : displayWsWarning.isSelected()) |
389 |
|
.toString()); |
390 |
0 |
updateServiceList(); |
391 |
0 |
updateRsbsServiceList(); |
392 |
|
} |
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
@see |
398 |
|
|
399 |
|
|
400 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
401 |
0 |
@Override... |
402 |
|
protected void moveWsUrlDown_actionPerformed(ActionEvent e) |
403 |
|
{ |
404 |
0 |
int p = wsList.getSelectedRow(); |
405 |
0 |
if (p > -1 && p < wsUrls.size() - 1) |
406 |
|
{ |
407 |
0 |
String t = wsUrls.get(p + 1); |
408 |
0 |
wsUrls.set(p + 1, wsUrls.get(p)); |
409 |
0 |
wsUrls.set(p, t); |
410 |
0 |
updateList(); |
411 |
0 |
wsList.getSelectionModel().setSelectionInterval(p + 1, p + 1); |
412 |
0 |
update++; |
413 |
|
} |
414 |
|
} |
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
@see |
420 |
|
|
421 |
|
|
422 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
423 |
0 |
@Override... |
424 |
|
protected void moveWsUrlUp_actionPerformed(ActionEvent e) |
425 |
|
{ |
426 |
0 |
int p = wsList.getSelectedRow(); |
427 |
0 |
if (p > 0) |
428 |
|
{ |
429 |
0 |
String t = wsUrls.get(p - 1); |
430 |
0 |
wsUrls.set(p - 1, wsUrls.get(p)); |
431 |
0 |
wsUrls.set(p, t); |
432 |
0 |
updateList(); |
433 |
0 |
wsList.getSelectionModel().setSelectionInterval(p - 1, p - 1); |
434 |
0 |
update++; |
435 |
|
} |
436 |
|
} |
437 |
|
|
|
|
| 0% |
Uncovered Elements: 47 (47) |
Complexity: 12 |
Complexity Density: 0.36 |
|
438 |
0 |
private String editUrl(String initUrl, String title)... |
439 |
|
{ |
440 |
0 |
String url = initUrl; |
441 |
0 |
URL foo = null; |
442 |
0 |
if (url == null) |
443 |
|
{ |
444 |
0 |
url = ""; |
445 |
|
} |
446 |
0 |
JTextField urltf = new JTextField(url, 40); |
447 |
0 |
JPanel panel = new JPanel(new BorderLayout()); |
448 |
0 |
JPanel pane12 = new JPanel(new BorderLayout()); |
449 |
0 |
pane12.add(new JLabel(MessageManager.getString("label.url:")), |
450 |
|
BorderLayout.CENTER); |
451 |
0 |
pane12.add(urltf, BorderLayout.EAST); |
452 |
0 |
panel.add(pane12, BorderLayout.NORTH); |
453 |
0 |
boolean valid = false; |
454 |
0 |
int resp = JvOptionPane.CANCEL_OPTION; |
455 |
0 |
while (!valid && (resp = JvOptionPane.showInternalConfirmDialog( |
456 |
|
Desktop.desktop, panel, title, |
457 |
|
JvOptionPane.OK_CANCEL_OPTION)) == JvOptionPane.OK_OPTION) |
458 |
|
{ |
459 |
0 |
try |
460 |
|
{ |
461 |
|
|
462 |
|
|
463 |
0 |
String tx = urltf.getText().trim(); |
464 |
0 |
while (tx.length() > 0 && tx.lastIndexOf('/') == tx.length() - 1) |
465 |
|
{ |
466 |
0 |
tx = tx.substring(0, tx.length() - 1); |
467 |
|
} |
468 |
0 |
foo = new URL(tx); |
469 |
0 |
valid = true; |
470 |
0 |
urltf.setText(tx); |
471 |
|
} catch (Exception e) |
472 |
|
{ |
473 |
0 |
valid = false; |
474 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
475 |
|
MessageManager.getString("label.invalid_url")); |
476 |
|
} |
477 |
|
} |
478 |
0 |
if (valid && resp == JvOptionPane.OK_OPTION) |
479 |
|
{ |
480 |
0 |
int validate = JvOptionPane.showInternalConfirmDialog(Desktop.desktop, |
481 |
|
MessageManager.getString("info.validate_jabaws_server"), |
482 |
|
MessageManager.getString("label.test_server"), |
483 |
|
JvOptionPane.YES_NO_OPTION); |
484 |
|
|
485 |
0 |
if (validate == JvOptionPane.OK_OPTION) |
486 |
|
{ |
487 |
0 |
if (Jws2Discoverer.testServiceUrl(foo)) |
488 |
|
{ |
489 |
0 |
return foo.toString(); |
490 |
|
} |
491 |
|
else |
492 |
|
{ |
493 |
0 |
int opt = JvOptionPane.showInternalOptionDialog(Desktop.desktop, |
494 |
|
"The Server '" + foo.toString() |
495 |
|
+ "' failed validation,\ndo you want to add it anyway? ", |
496 |
|
"Server Validation Failed", JvOptionPane.YES_NO_OPTION, |
497 |
|
JvOptionPane.INFORMATION_MESSAGE, null, null, null); |
498 |
0 |
if (opt == JvOptionPane.YES_OPTION) |
499 |
|
{ |
500 |
0 |
return foo.toString(); |
501 |
|
} |
502 |
|
else |
503 |
|
{ |
504 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
505 |
|
MessageManager.getString( |
506 |
|
"warn.server_didnt_pass_validation")); |
507 |
|
} |
508 |
|
|
509 |
|
} |
510 |
|
} |
511 |
|
else |
512 |
|
{ |
513 |
|
|
514 |
0 |
return foo.toString(); |
515 |
|
} |
516 |
|
} |
517 |
0 |
return initUrl; |
518 |
|
} |
519 |
|
|
520 |
|
|
521 |
|
|
522 |
|
|
523 |
|
@see |
524 |
|
|
525 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
526 |
0 |
@Override... |
527 |
|
protected void newWsUrl_actionPerformed(ActionEvent e) |
528 |
|
{ |
529 |
0 |
String url = editUrl(null, |
530 |
|
MessageManager.getString("label.add_jabaws_url")); |
531 |
0 |
if (url != null) |
532 |
|
{ |
533 |
0 |
if (!wsUrls.contains(url)) |
534 |
|
{ |
535 |
0 |
int selind = wsList.getSelectedRow(); |
536 |
0 |
if (selind > -1) |
537 |
|
{ |
538 |
0 |
wsUrls.add(selind, url); |
539 |
|
} |
540 |
|
else |
541 |
|
{ |
542 |
0 |
wsUrls.add(url); |
543 |
|
} |
544 |
0 |
update++; |
545 |
0 |
updateList(); |
546 |
|
} |
547 |
|
} |
548 |
|
} |
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
@see |
554 |
|
|
555 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
556 |
0 |
@Override... |
557 |
|
protected void refreshWs_actionPerformed(ActionEvent e) |
558 |
|
{ |
559 |
0 |
new Thread(new Runnable() |
560 |
|
{ |
561 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
562 |
0 |
@Override... |
563 |
|
public void run() |
564 |
|
{ |
565 |
|
|
566 |
0 |
lastrefresh = update - 1; |
567 |
0 |
updateWsMenuConfig(false); |
568 |
0 |
refreshWsMenu(true); |
569 |
|
} |
570 |
|
}).start(); |
571 |
|
|
572 |
|
} |
573 |
|
|
574 |
|
|
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
@param |
579 |
|
|
580 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
581 |
0 |
protected void refreshWsMenu(boolean showProgress)... |
582 |
|
{ |
583 |
0 |
if (showProgress) |
584 |
|
{ |
585 |
0 |
new Thread(new Runnable() |
586 |
|
{ |
587 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
588 |
0 |
@Override... |
589 |
|
public void run() |
590 |
|
{ |
591 |
0 |
progressBar.setVisible(true); |
592 |
0 |
validate(); |
593 |
0 |
progressBar.setIndeterminate(true); |
594 |
0 |
if (lastrefresh != update) |
595 |
|
{ |
596 |
0 |
lastrefresh = update; |
597 |
0 |
Desktop.instance.startServiceDiscovery(true); |
598 |
|
|
599 |
0 |
updateList(); |
600 |
|
|
601 |
|
} |
602 |
0 |
progressBar.setIndeterminate(false); |
603 |
0 |
progressBar.setVisible(false); |
604 |
0 |
validate(); |
605 |
|
} |
606 |
|
}).start(); |
607 |
|
|
608 |
|
} |
609 |
|
else |
610 |
|
{ |
611 |
0 |
new Thread(new Runnable() |
612 |
|
{ |
613 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
614 |
0 |
@Override... |
615 |
|
public void run() |
616 |
|
{ |
617 |
0 |
long ct = System.currentTimeMillis(); |
618 |
0 |
Desktop.instance.setProgressBar(MessageManager |
619 |
|
.getString("status.refreshing_web_service_menus"), ct); |
620 |
0 |
if (lastrefresh != update) |
621 |
|
{ |
622 |
0 |
lastrefresh = update; |
623 |
0 |
Desktop.instance.startServiceDiscovery(true); |
624 |
0 |
updateList(); |
625 |
|
} |
626 |
0 |
Desktop.instance.setProgressBar(null, ct); |
627 |
|
} |
628 |
|
|
629 |
|
}).start(); |
630 |
|
} |
631 |
|
} |
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
protected long update = 0; |
637 |
|
|
638 |
|
private long lastrefresh = 0; |
639 |
|
|
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
@see |
644 |
|
|
645 |
|
|
646 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
647 |
0 |
@Override... |
648 |
|
protected void resetWs_actionPerformed(ActionEvent e) |
649 |
|
{ |
650 |
0 |
Jws2Discoverer.getDiscoverer().setServiceUrls(null); |
651 |
0 |
List<String> nwsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls(); |
652 |
0 |
if (!wsUrls.equals(nwsUrls)) |
653 |
|
{ |
654 |
0 |
update++; |
655 |
|
} |
656 |
0 |
wsUrls = nwsUrls; |
657 |
0 |
updateList(); |
658 |
|
|
659 |
0 |
updateAndRefreshWsMenuConfig(true); |
660 |
|
} |
661 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
662 |
0 |
protected void ok_ActionPerformed(ActionEvent e)... |
663 |
|
{ |
664 |
|
|
665 |
0 |
updateAndRefreshWsMenuConfig(false); |
666 |
|
} |
667 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
668 |
0 |
public void updateAndRefreshWsMenuConfig(... |
669 |
|
final boolean showProgressInDialog) |
670 |
|
{ |
671 |
0 |
new Thread(new Runnable() |
672 |
|
{ |
673 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
674 |
0 |
@Override... |
675 |
|
public void run() |
676 |
|
{ |
677 |
0 |
updateWsMenuConfig(false); |
678 |
0 |
refreshWsMenu(showProgressInDialog); |
679 |
|
} |
680 |
|
}).start(); |
681 |
|
|
682 |
|
} |
683 |
|
} |