| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
package org.fest.swing.driver; |
| 16 |
|
|
| 17 |
|
import static org.fest.swing.timing.Pause.pause; |
| 18 |
|
import static org.fest.swing.util.TimeoutWatch.startWatchWithTimeoutOf; |
| 19 |
|
|
| 20 |
|
import java.awt.Component; |
| 21 |
|
import java.awt.Container; |
| 22 |
|
import java.util.ArrayList; |
| 23 |
|
import java.util.List; |
| 24 |
|
|
| 25 |
|
import javax.swing.*; |
| 26 |
|
|
| 27 |
|
import org.fest.swing.annotation.RunsInEDT; |
| 28 |
|
import org.fest.swing.core.*; |
| 29 |
|
import org.fest.swing.util.TimeoutWatch; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@link@link |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@author |
| 36 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 7 |
Complexity Density: 0.47 |
|
| 37 |
|
final class JComboBoxDropDownListFinder { |
| 38 |
|
|
| 39 |
|
static final ComponentMatcher LIST_MATCHER = new TypeMatcher(JList.class); |
| 40 |
|
|
| 41 |
|
private final Robot robot; |
| 42 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 43 |
294
|
JComboBoxDropDownListFinder(Robot robot) {... |
| 44 |
294
|
this.robot = robot; |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@link@link |
| 49 |
|
|
| 50 |
|
@return |
| 51 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
| 52 |
16
|
@RunsInEDT... |
| 53 |
|
JList findDropDownList() { |
| 54 |
16
|
JPopupMenu popup = robot.findActivePopupMenu(); |
| 55 |
16
|
if (popup == null) { |
| 56 |
2
|
TimeoutWatch watch = startWatchWithTimeoutOf(robot.settings().timeoutToFindPopup()); |
| 57 |
2
|
popup = robot.findActivePopupMenu(); |
| 58 |
9
|
while (popup == null) { |
| 59 |
1
|
if (watch.isTimeOut()) return null; |
| 60 |
7
|
pause(); |
| 61 |
7
|
popup = robot.findActivePopupMenu(); |
| 62 |
|
} |
| 63 |
|
} |
| 64 |
15
|
return findListIn(popup); |
| 65 |
|
} |
| 66 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 67 |
15
|
private JList findListIn(Container parent) {... |
| 68 |
15
|
List<Component> found = new ArrayList<Component>(robot.finder().findAll(parent, LIST_MATCHER)); |
| 69 |
1
|
if (found.size() != 1) return null; |
| 70 |
14
|
return (JList)found.get(0); |
| 71 |
|
} |
| 72 |
|
} |