| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.hierarchy; |
| 17 |
|
|
| 18 |
|
import static java.util.Collections.emptyList; |
| 19 |
|
import static org.fest.swing.hierarchy.ContainerComponentsQuery.componentsOf; |
| 20 |
|
|
| 21 |
|
import java.awt.Component; |
| 22 |
|
import java.awt.Container; |
| 23 |
|
import java.util.*; |
| 24 |
|
|
| 25 |
|
import org.fest.swing.annotation.RunsInCurrentThread; |
| 26 |
|
import org.fest.util.VisibleForTesting; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
@link |
| 31 |
|
|
| 32 |
|
@author |
| 33 |
|
@author |
| 34 |
|
|
|
|
|
| 91.3% |
Uncovered Elements: 2 (23) |
Complexity: 6 |
Complexity Density: 0.38 |
|
| 35 |
|
class ChildrenFinder { |
| 36 |
|
|
| 37 |
|
private static List<ChildrenFinderStrategy> strategies = new ArrayList<ChildrenFinderStrategy>(); |
| 38 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 39 |
626
|
static {... |
| 40 |
626
|
strategies.add(new JDesktopPaneChildrenFinder()); |
| 41 |
626
|
strategies.add(new JMenuChildrenFinder()); |
| 42 |
626
|
strategies.add(new WindowChildrenFinder()); |
| 43 |
|
} |
| 44 |
|
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
| 45 |
106838
|
@RunsInCurrentThread... |
| 46 |
|
Collection<Component> childrenOf(Component c) { |
| 47 |
106838
|
if (!(c instanceof Container)) return emptyList(); |
| 48 |
106838
|
Container container = (Container)c; |
| 49 |
106838
|
Collection<Component> children = new ArrayList<Component>(); |
| 50 |
106838
|
children.addAll(componentsOf(container)); |
| 51 |
106838
|
children.addAll(nonExplicitChildrenOf(container)); |
| 52 |
106838
|
return children; |
| 53 |
|
} |
| 54 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 55 |
106837
|
private Collection<Component> nonExplicitChildrenOf(Container c) {... |
| 56 |
106836
|
Collection<Component> children = new ArrayList<Component>(); |
| 57 |
106837
|
for (ChildrenFinderStrategy s : strategies) |
| 58 |
320508
|
children.addAll(s.nonExplicitChildrenOf(c)); |
| 59 |
106838
|
return children; |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
2
|
@VisibleForTesting... |
| 63 |
2
|
static List<ChildrenFinderStrategy> strategies() { return new ArrayList<ChildrenFinderStrategy>(strategies); } |
| 64 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
4
|
@VisibleForTesting... |
| 66 |
|
static void replaceStrategiesWith(List<ChildrenFinderStrategy> newStrategies) { |
| 67 |
4
|
strategies = new ArrayList<ChildrenFinderStrategy>(newStrategies); |
| 68 |
|
} |
| 69 |
|
} |