1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package jalview.gui; |
23 |
|
|
24 |
|
import jalview.util.dialogrunner.DialogRunner; |
25 |
|
import jalview.util.dialogrunner.DialogRunnerI; |
26 |
|
import jalview.util.dialogrunner.RunResponse; |
27 |
|
|
28 |
|
import java.awt.Component; |
29 |
|
import java.awt.HeadlessException; |
30 |
|
import java.beans.PropertyChangeEvent; |
31 |
|
import java.beans.PropertyChangeListener; |
32 |
|
import java.util.Arrays; |
33 |
|
import java.util.List; |
34 |
|
|
35 |
|
import javax.swing.Icon; |
36 |
|
import javax.swing.JOptionPane; |
37 |
|
import javax.swing.JPanel; |
38 |
|
|
|
|
| 42.2% |
Uncovered Elements: 133 (230) |
Complexity: 85 |
Complexity Density: 0.65 |
|
39 |
|
public class JvOptionPane extends JOptionPane |
40 |
|
implements DialogRunnerI, PropertyChangeListener |
41 |
|
{ |
42 |
|
|
43 |
|
|
44 |
|
private static final long serialVersionUID = -3019167117756785229L; |
45 |
|
|
46 |
|
private static Object mockResponse = JvOptionPane.CANCEL_OPTION; |
47 |
|
|
48 |
|
private static boolean interactiveMode = true; |
49 |
|
|
50 |
|
private Component parentComponent; |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0 |
public JvOptionPane(final Component parentComponent)... |
53 |
|
{ |
54 |
|
|
55 |
0 |
this.parentComponent = parentComponent; |
56 |
|
} |
57 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
58 |
1 |
public static int showConfirmDialog(Component parentComponent,... |
59 |
|
Object message) throws HeadlessException |
60 |
|
{ |
61 |
|
|
62 |
1 |
return isInteractiveMode() |
63 |
|
? JOptionPane.showConfirmDialog(parentComponent, message) |
64 |
|
: (int) getMockResponse(); |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
@param |
71 |
|
@param |
72 |
|
@param |
73 |
|
@param |
74 |
|
@return |
75 |
|
@throws |
76 |
|
|
|
|
| 30% |
Uncovered Elements: 7 (10) |
Complexity: 5 |
Complexity Density: 0.62 |
|
77 |
1 |
public static int showConfirmDialog(Component parentComponent,... |
78 |
|
Object message, String title, int optionType) |
79 |
|
throws HeadlessException |
80 |
|
{ |
81 |
1 |
if (!isInteractiveMode()) |
82 |
|
{ |
83 |
1 |
return (int) getMockResponse(); |
84 |
|
} |
85 |
0 |
switch (optionType) |
86 |
|
{ |
87 |
0 |
case JvOptionPane.YES_NO_CANCEL_OPTION: |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
0 |
default: |
93 |
0 |
case JvOptionPane.YES_NO_OPTION: |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
0 |
case JvOptionPane.OK_CANCEL_OPTION: |
98 |
|
|
99 |
0 |
return JOptionPane.showConfirmDialog(parentComponent, message, title, |
100 |
|
optionType); |
101 |
|
} |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@param |
108 |
|
@param |
109 |
|
@param |
110 |
|
@param |
111 |
|
@param |
112 |
|
@return |
113 |
|
@throws |
114 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
115 |
4 |
public static int showConfirmDialog(Component parentComponent,... |
116 |
|
Object message, String title, int optionType, int messageType) |
117 |
|
throws HeadlessException |
118 |
|
{ |
119 |
|
|
120 |
|
|
121 |
4 |
return isInteractiveMode() |
122 |
|
? JOptionPane.showConfirmDialog(parentComponent, message, title, |
123 |
|
optionType, messageType) |
124 |
|
: (int) getMockResponse(); |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
@param |
131 |
|
@param |
132 |
|
@param |
133 |
|
@param |
134 |
|
@param |
135 |
|
@param |
136 |
|
@return |
137 |
|
@throws |
138 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
139 |
1 |
public static int showConfirmDialog(Component parentComponent,... |
140 |
|
Object message, String title, int optionType, int messageType, |
141 |
|
Icon icon) throws HeadlessException |
142 |
|
{ |
143 |
|
|
144 |
1 |
return isInteractiveMode() |
145 |
|
? JOptionPane.showConfirmDialog(parentComponent, message, title, |
146 |
|
optionType, messageType, icon) |
147 |
|
: (int) getMockResponse(); |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
@param |
154 |
|
@param |
155 |
|
@return |
156 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
157 |
1 |
public static int showInternalConfirmDialog(Component parentComponent,... |
158 |
|
Object message) |
159 |
|
{ |
160 |
|
|
161 |
1 |
return isInteractiveMode() ? JOptionPane.showInternalConfirmDialog( |
162 |
|
parentComponent, message) : (int) getMockResponse(); |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
@param |
169 |
|
@param |
170 |
|
@param |
171 |
|
@param |
172 |
|
@return |
173 |
|
|
|
|
| 30% |
Uncovered Elements: 7 (10) |
Complexity: 5 |
Complexity Density: 0.62 |
|
174 |
1 |
public static int showInternalConfirmDialog(Component parentComponent,... |
175 |
|
String message, String title, int optionType) |
176 |
|
{ |
177 |
1 |
if (!isInteractiveMode()) |
178 |
|
{ |
179 |
1 |
return (int) getMockResponse(); |
180 |
|
} |
181 |
0 |
switch (optionType) |
182 |
|
{ |
183 |
0 |
case JvOptionPane.YES_NO_CANCEL_OPTION: |
184 |
|
|
185 |
0 |
case JvOptionPane.YES_NO_OPTION: |
186 |
|
|
187 |
|
|
188 |
0 |
default: |
189 |
0 |
case JvOptionPane.OK_CANCEL_OPTION: |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
0 |
return JOptionPane.showConfirmDialog(parentComponent, message, title, |
196 |
|
optionType); |
197 |
|
} |
198 |
|
} |
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
@param |
203 |
|
@param |
204 |
|
@param |
205 |
|
@param |
206 |
|
@param |
207 |
|
@return |
208 |
|
|
|
|
| 30% |
Uncovered Elements: 7 (10) |
Complexity: 5 |
Complexity Density: 0.62 |
|
209 |
1 |
public static int showInternalConfirmDialog(Component parentComponent,... |
210 |
|
Object message, String title, int optionType, int messageType) |
211 |
|
{ |
212 |
1 |
if (!isInteractiveMode()) |
213 |
|
{ |
214 |
1 |
return (int) getMockResponse(); |
215 |
|
} |
216 |
0 |
switch (optionType) |
217 |
|
{ |
218 |
0 |
case JvOptionPane.YES_NO_CANCEL_OPTION: |
219 |
0 |
case JvOptionPane.YES_NO_OPTION: |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
0 |
default: |
224 |
0 |
case JvOptionPane.OK_CANCEL_OPTION: |
225 |
|
|
226 |
0 |
return JOptionPane.showConfirmDialog(parentComponent, message, title, |
227 |
|
optionType, messageType); |
228 |
|
} |
229 |
|
} |
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
@param |
235 |
|
@param |
236 |
|
@param |
237 |
|
@param |
238 |
|
@param |
239 |
|
@param |
240 |
|
@return |
241 |
|
|
|
|
| 30% |
Uncovered Elements: 7 (10) |
Complexity: 5 |
Complexity Density: 0.62 |
|
242 |
1 |
public static int showInternalConfirmDialog(Component parentComponent,... |
243 |
|
Object message, String title, int optionType, int messageType, |
244 |
|
Icon icon) |
245 |
|
{ |
246 |
1 |
if (!isInteractiveMode()) |
247 |
|
{ |
248 |
1 |
return (int) getMockResponse(); |
249 |
|
} |
250 |
0 |
switch (optionType) |
251 |
|
{ |
252 |
0 |
case JvOptionPane.YES_NO_CANCEL_OPTION: |
253 |
0 |
case JvOptionPane.YES_NO_OPTION: |
254 |
|
|
255 |
0 |
default: |
256 |
0 |
case JvOptionPane.OK_CANCEL_OPTION: |
257 |
|
|
258 |
0 |
return JOptionPane.showConfirmDialog(parentComponent, message, title, |
259 |
|
optionType, messageType, icon); |
260 |
|
} |
261 |
|
|
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
@param |
268 |
|
@param |
269 |
|
@param |
270 |
|
@param |
271 |
|
@param |
272 |
|
@param |
273 |
|
@param |
274 |
|
@param |
275 |
|
@return |
276 |
|
@throws |
277 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
278 |
0 |
public static int showOptionDialog(Component parentComponent,... |
279 |
|
String message, String title, int optionType, int messageType, |
280 |
|
Icon icon, Object[] options, Object initialValue) |
281 |
|
throws HeadlessException |
282 |
|
{ |
283 |
0 |
if (!isInteractiveMode()) |
284 |
|
{ |
285 |
0 |
return (int) getMockResponse(); |
286 |
|
} |
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
0 |
return JOptionPane.showOptionDialog(parentComponent, message, title, |
302 |
|
optionType, messageType, icon, options, initialValue); |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
@param |
309 |
|
@throws |
310 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
311 |
1 |
public static void showMessageDialog(Component parentComponent,... |
312 |
|
String message) throws HeadlessException |
313 |
|
{ |
314 |
1 |
if (!isInteractiveMode()) |
315 |
|
{ |
316 |
1 |
outputMessage(message); |
317 |
1 |
return; |
318 |
|
} |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
0 |
JOptionPane.showMessageDialog(parentComponent, message); |
323 |
|
} |
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
|
328 |
|
@param |
329 |
|
@param |
330 |
|
@param |
331 |
|
@param |
332 |
|
@throws |
333 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
334 |
2 |
public static void showMessageDialog(Component parentComponent,... |
335 |
|
String message, String title, int messageType) |
336 |
|
throws HeadlessException |
337 |
|
{ |
338 |
|
|
339 |
|
|
340 |
2 |
if (!isInteractiveMode()) |
341 |
|
{ |
342 |
2 |
outputMessage(message); |
343 |
2 |
return; |
344 |
|
} |
345 |
|
|
346 |
0 |
JOptionPane.showMessageDialog(parentComponent, |
347 |
|
getPrefix(messageType) + message, title, messageType); |
348 |
|
} |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
@param |
354 |
|
@param |
355 |
|
@param |
356 |
|
@param |
357 |
|
@param |
358 |
|
@throws |
359 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
360 |
1 |
public static void showMessageDialog(Component parentComponent,... |
361 |
|
String message, String title, int messageType, Icon icon) |
362 |
|
throws HeadlessException |
363 |
|
{ |
364 |
|
|
365 |
|
|
366 |
|
|
367 |
1 |
if (!isInteractiveMode()) |
368 |
|
{ |
369 |
1 |
outputMessage(message); |
370 |
1 |
return; |
371 |
|
} |
372 |
|
|
373 |
0 |
JOptionPane.showMessageDialog(parentComponent, message, title, |
374 |
|
messageType, icon); |
375 |
|
} |
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
381 |
1 |
public static void showInternalMessageDialog(Component parentComponent,... |
382 |
|
Object message) |
383 |
|
{ |
384 |
|
|
385 |
|
|
386 |
|
|
387 |
1 |
if (!isInteractiveMode()) |
388 |
|
{ |
389 |
1 |
outputMessage(message); |
390 |
1 |
return; |
391 |
|
} |
392 |
|
|
393 |
0 |
JOptionPane.showMessageDialog(parentComponent, message); |
394 |
|
} |
395 |
|
|
396 |
|
|
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
@param |
401 |
|
@param |
402 |
|
@param |
403 |
|
@param |
404 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
405 |
1 |
public static void showInternalMessageDialog(Component parentComponent,... |
406 |
|
String message, String title, int messageType) |
407 |
|
{ |
408 |
|
|
409 |
|
|
410 |
|
|
411 |
1 |
if (!isInteractiveMode()) |
412 |
|
{ |
413 |
1 |
outputMessage(message); |
414 |
1 |
return; |
415 |
|
} |
416 |
|
|
417 |
0 |
JOptionPane.showMessageDialog(parentComponent, |
418 |
|
getPrefix(messageType) + message, title, messageType); |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
@param |
424 |
|
@param |
425 |
|
@param |
426 |
|
@param |
427 |
|
@param |
428 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
429 |
1 |
public static void showInternalMessageDialog(Component parentComponent,... |
430 |
|
Object message, String title, int messageType, Icon icon) |
431 |
|
{ |
432 |
|
|
433 |
|
|
434 |
|
|
435 |
1 |
if (!isInteractiveMode()) |
436 |
|
{ |
437 |
1 |
outputMessage(message); |
438 |
1 |
return; |
439 |
|
} |
440 |
|
|
441 |
0 |
JOptionPane.showMessageDialog(parentComponent, message, title, |
442 |
|
messageType, icon); |
443 |
|
} |
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
@param |
448 |
|
@return |
449 |
|
@throws |
450 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
451 |
1 |
public static String showInputDialog(Object message)... |
452 |
|
throws HeadlessException |
453 |
|
{ |
454 |
|
|
455 |
|
|
456 |
1 |
if (!isInteractiveMode()) |
457 |
|
{ |
458 |
1 |
return getMockResponse().toString(); |
459 |
|
} |
460 |
|
|
461 |
0 |
return JOptionPane.showInputDialog(message); |
462 |
|
} |
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
@param |
468 |
|
@param |
469 |
|
@return |
470 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
471 |
0 |
public static String showInputDialog(String message,... |
472 |
|
String initialSelectionValue) |
473 |
|
{ |
474 |
0 |
if (!isInteractiveMode()) |
475 |
|
{ |
476 |
0 |
return getMockResponse().toString(); |
477 |
|
} |
478 |
|
|
479 |
|
|
480 |
|
|
481 |
0 |
return JOptionPane.showInputDialog(message, initialSelectionValue); |
482 |
|
} |
483 |
|
|
484 |
|
|
485 |
|
|
486 |
|
|
487 |
|
@param |
488 |
|
@param |
489 |
|
@return |
490 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
491 |
1 |
public static String showInputDialog(Object message,... |
492 |
|
Object initialSelectionValue) |
493 |
|
{ |
494 |
1 |
if (!isInteractiveMode()) |
495 |
|
{ |
496 |
1 |
return getMockResponse().toString(); |
497 |
|
} |
498 |
|
|
499 |
|
|
500 |
|
|
501 |
0 |
return JOptionPane.showInputDialog(message, initialSelectionValue); |
502 |
|
} |
503 |
|
|
504 |
|
|
505 |
|
|
506 |
|
@param |
507 |
|
@param |
508 |
|
@return |
509 |
|
@throws |
510 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
511 |
1 |
public static String showInputDialog(Component parentComponent,... |
512 |
|
String message) throws HeadlessException |
513 |
|
{ |
514 |
|
|
515 |
|
|
516 |
1 |
return isInteractiveMode() |
517 |
|
? JOptionPane.showInputDialog(parentComponent, message) |
518 |
|
: getMockResponse().toString(); |
519 |
|
} |
520 |
|
|
521 |
|
|
522 |
|
|
523 |
|
|
524 |
|
@param |
525 |
|
@param |
526 |
|
@param |
527 |
|
@return |
528 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
529 |
0 |
public static String showInputDialog(Component parentComponent,... |
530 |
|
String message, String initialSelectionValue) |
531 |
|
{ |
532 |
|
|
533 |
|
|
534 |
|
|
535 |
0 |
return isInteractiveMode() |
536 |
|
? JOptionPane.showInputDialog(parentComponent, message, |
537 |
|
initialSelectionValue) |
538 |
|
: getMockResponse().toString(); |
539 |
|
} |
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
@param |
546 |
|
@param |
547 |
|
@param |
548 |
|
@return |
549 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
550 |
1 |
public static String showInputDialog(Component parentComponent,... |
551 |
|
Object message, Object initialSelectionValue) |
552 |
|
{ |
553 |
|
|
554 |
|
|
555 |
|
|
556 |
1 |
return isInteractiveMode() |
557 |
|
? JOptionPane.showInputDialog(parentComponent, message, |
558 |
|
initialSelectionValue) |
559 |
|
: getMockResponse().toString(); |
560 |
|
} |
561 |
|
|
562 |
|
|
563 |
|
|
564 |
|
@param |
565 |
|
@param |
566 |
|
@param |
567 |
|
@param |
568 |
|
@return |
569 |
|
@throws |
570 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
571 |
1 |
public static String showInputDialog(Component parentComponent,... |
572 |
|
String message, String title, int messageType) |
573 |
|
throws HeadlessException |
574 |
|
{ |
575 |
|
|
576 |
|
|
577 |
|
|
578 |
1 |
return isInteractiveMode() ? JOptionPane |
579 |
|
.showInputDialog(parentComponent, message, title, messageType) |
580 |
|
: getMockResponse().toString(); |
581 |
|
} |
582 |
|
|
583 |
|
|
584 |
|
|
585 |
|
|
586 |
|
@param |
587 |
|
@param |
588 |
|
@param |
589 |
|
@param |
590 |
|
@param |
591 |
|
@param |
592 |
|
@param |
593 |
|
@return |
594 |
|
@throws |
595 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
596 |
1 |
public static Object showInputDialog(Component parentComponent,... |
597 |
|
Object message, String title, int messageType, Icon icon, |
598 |
|
Object[] selectionValues, Object initialSelectionValue) |
599 |
|
throws HeadlessException |
600 |
|
{ |
601 |
|
|
602 |
|
|
603 |
|
|
604 |
1 |
return isInteractiveMode() |
605 |
|
? JOptionPane.showInputDialog(parentComponent, message, title, |
606 |
|
messageType, icon, selectionValues, |
607 |
|
initialSelectionValue) |
608 |
|
: getMockResponse().toString(); |
609 |
|
} |
610 |
|
|
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
616 |
|
@param |
617 |
|
@param |
618 |
|
@return |
619 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
620 |
1 |
public static String showInternalInputDialog(Component parentComponent,... |
621 |
|
String message) |
622 |
|
{ |
623 |
|
|
624 |
|
|
625 |
1 |
return isInteractiveMode() |
626 |
|
? JOptionPane.showInternalInputDialog(parentComponent, message) |
627 |
|
: getMockResponse().toString(); |
628 |
|
} |
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
@param |
635 |
|
@param |
636 |
|
@param |
637 |
|
@param |
638 |
|
@return |
639 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
640 |
1 |
public static String showInternalInputDialog(Component parentComponent,... |
641 |
|
String message, String title, int messageType) |
642 |
|
{ |
643 |
|
|
644 |
|
|
645 |
|
|
646 |
1 |
return isInteractiveMode() |
647 |
|
? JOptionPane.showInternalInputDialog(parentComponent, |
648 |
|
getPrefix(messageType) + message, title, messageType) |
649 |
|
: getMockResponse().toString(); |
650 |
|
} |
651 |
|
|
652 |
|
|
653 |
|
|
654 |
|
|
655 |
|
@param |
656 |
|
@param |
657 |
|
@param |
658 |
|
@param |
659 |
|
@param |
660 |
|
@param |
661 |
|
@param |
662 |
|
@return |
663 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
664 |
1 |
public static Object showInternalInputDialog(Component parentComponent,... |
665 |
|
String message, String title, int messageType, Icon icon, |
666 |
|
Object[] selectionValues, Object initialSelectionValue) |
667 |
|
{ |
668 |
|
|
669 |
|
|
670 |
1 |
return isInteractiveMode() |
671 |
|
? JOptionPane.showInternalInputDialog(parentComponent, message, |
672 |
|
title, messageType, icon, selectionValues, |
673 |
|
initialSelectionValue) |
674 |
|
: getMockResponse().toString(); |
675 |
|
} |
676 |
|
|
677 |
|
|
678 |
|
|
679 |
|
|
680 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
681 |
7 |
private static void outputMessage(Object message)... |
682 |
|
{ |
683 |
7 |
System.out.println(">>> JOption Message : " + message.toString()); |
684 |
|
} |
685 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
686 |
20 |
public static Object getMockResponse()... |
687 |
|
{ |
688 |
20 |
return mockResponse; |
689 |
|
} |
690 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
691 |
141 |
public static void setMockResponse(Object mockOption)... |
692 |
|
{ |
693 |
141 |
JvOptionPane.mockResponse = mockOption; |
694 |
|
} |
695 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
696 |
0 |
public static void resetMock()... |
697 |
|
{ |
698 |
0 |
setMockResponse(JvOptionPane.CANCEL_OPTION); |
699 |
0 |
setInteractiveMode(true); |
700 |
|
} |
701 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
702 |
27 |
public static boolean isInteractiveMode()... |
703 |
|
{ |
704 |
27 |
return interactiveMode; |
705 |
|
} |
706 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
707 |
141 |
public static void setInteractiveMode(boolean interactiveMode)... |
708 |
|
{ |
709 |
141 |
JvOptionPane.interactiveMode = interactiveMode; |
710 |
|
} |
711 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.29 |
|
712 |
0 |
@SuppressWarnings("unused")... |
713 |
|
private static String getPrefix(int messageType) |
714 |
|
{ |
715 |
0 |
String prefix = ""; |
716 |
|
|
717 |
0 |
if ( |
718 |
|
false) |
719 |
|
{ |
720 |
0 |
switch (messageType) |
721 |
|
{ |
722 |
0 |
default: |
723 |
0 |
case JvOptionPane.INFORMATION_MESSAGE: |
724 |
0 |
prefix = "Note: "; |
725 |
0 |
break; |
726 |
0 |
case JvOptionPane.WARNING_MESSAGE: |
727 |
0 |
prefix = "WARNING! "; |
728 |
0 |
break; |
729 |
0 |
case JvOptionPane.ERROR_MESSAGE: |
730 |
0 |
prefix = "ERRROR! "; |
731 |
0 |
break; |
732 |
|
} |
733 |
|
} |
734 |
0 |
return prefix; |
735 |
|
} |
736 |
|
|
737 |
|
DialogRunner<JvOptionPane> runner = new DialogRunner(this); |
738 |
|
|
739 |
|
private List<Object> ourOptions; |
740 |
|
|
741 |
|
|
742 |
|
|
743 |
|
|
744 |
|
@param |
745 |
|
@param |
746 |
|
@param |
747 |
|
@param |
748 |
|
@param |
749 |
|
@param |
750 |
|
@param |
751 |
|
@param |
752 |
|
@return |
753 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
754 |
0 |
public static JvOptionPane newOptionDialog(Component parentComponent)... |
755 |
|
{ |
756 |
0 |
return new JvOptionPane(parentComponent); |
757 |
|
} |
758 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
759 |
0 |
public void showDialog(... |
760 |
|
String message, String title, int optionType, int messageType, |
761 |
|
Icon icon, Object[] options, Object initialValue) |
762 |
|
{ |
763 |
|
|
764 |
0 |
if (!isInteractiveMode()) |
765 |
|
{ |
766 |
0 |
runner.firstRun((int) getMockResponse()); |
767 |
|
} |
768 |
|
|
769 |
|
|
770 |
|
|
771 |
|
|
772 |
|
|
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
|
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
782 |
0 |
Component parent; |
783 |
|
|
784 |
|
|
785 |
|
|
786 |
|
|
787 |
|
{ |
788 |
0 |
parent = parentComponent; |
789 |
|
} |
790 |
0 |
; |
791 |
0 |
ourOptions = Arrays.asList(options); |
792 |
0 |
int response = JOptionPane.showOptionDialog(parent, message, title, |
793 |
|
optionType, messageType, icon, options, initialValue); |
794 |
|
|
795 |
|
|
796 |
|
|
797 |
|
{ |
798 |
0 |
runner.firstRun(response); |
799 |
|
} |
800 |
|
|
801 |
|
} |
802 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
803 |
0 |
public void showInternalDialog(JPanel mainPanel, String title,... |
804 |
|
int yesNoCancelOption, int questionMessage, Icon icon, |
805 |
|
Object[] options, String initresponse) |
806 |
|
{ |
807 |
0 |
if (!isInteractiveMode()) |
808 |
|
{ |
809 |
0 |
runner.firstRun((int) getMockResponse()); |
810 |
|
} |
811 |
0 |
Component parent; |
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
{ |
816 |
0 |
parent = parentComponent; |
817 |
|
} |
818 |
0 |
; |
819 |
0 |
ourOptions = Arrays.asList(options); |
820 |
|
|
821 |
0 |
int response; |
822 |
0 |
if (parent!=this) { |
823 |
|
|
824 |
0 |
response = JOptionPane.showInternalOptionDialog(parent, mainPanel, |
825 |
|
title, yesNoCancelOption, questionMessage, icon, options, |
826 |
|
initresponse); |
827 |
|
} |
828 |
|
else |
829 |
|
{ |
830 |
0 |
response = JOptionPane.showOptionDialog(parent, mainPanel, title, |
831 |
|
yesNoCancelOption, questionMessage, icon, options, |
832 |
|
initresponse); |
833 |
|
} |
834 |
|
|
835 |
|
|
836 |
|
|
837 |
|
{ |
838 |
0 |
runner.firstRun(response); |
839 |
|
} |
840 |
|
|
841 |
|
} |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
842 |
0 |
@Override... |
843 |
|
public JvOptionPane response(RunResponse action) |
844 |
|
{ |
845 |
|
|
846 |
0 |
runner.response(action); |
847 |
0 |
return this; |
848 |
|
} |
849 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
850 |
0 |
public JvOptionPane defaultResponse(Runnable runnable)... |
851 |
|
{ |
852 |
0 |
runner.setDefaultResponse(runnable); |
853 |
0 |
return this; |
854 |
|
} |
855 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
856 |
0 |
@Override... |
857 |
|
public void propertyChange(PropertyChangeEvent evt) |
858 |
|
{ |
859 |
0 |
int ourOption = ourOptions.indexOf(evt.getNewValue()); |
860 |
0 |
if (ourOption == -1) |
861 |
|
{ |
862 |
|
|
863 |
0 |
runner.run(evt.getNewValue()); |
864 |
|
} |
865 |
|
else |
866 |
|
{ |
867 |
0 |
runner.run(ourOption); |
868 |
|
} |
869 |
|
} |
870 |
|
|
871 |
|
|
872 |
|
} |