| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.monitor; |
| 17 |
|
|
| 18 |
|
import static java.lang.Boolean.TRUE; |
| 19 |
|
import static org.fest.swing.query.ComponentParentQuery.parentOf; |
| 20 |
|
|
| 21 |
|
import java.awt.*; |
| 22 |
|
import java.util.*; |
| 23 |
|
|
| 24 |
|
import org.fest.swing.annotation.RunsInCurrentThread; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
@author |
| 30 |
|
@author |
| 31 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (36) |
Complexity: 11 |
Complexity Density: 0.48 |
|
| 32 |
|
class WindowEventQueueMapping { |
| 33 |
|
|
| 34 |
|
final Map<EventQueue, Map<Window, Boolean>> queueMap = new WeakHashMap<EventQueue, Map<Window, Boolean>>(); |
| 35 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 36 |
622
|
void addQueueFor(Toolkit toolkit) {... |
| 37 |
622
|
queueMap.put(toolkit.getSystemEventQueue(), new WeakHashMap<Window, Boolean>()); |
| 38 |
|
} |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
| 40 |
3539
|
void addQueueFor(Component component) {... |
| 41 |
3539
|
EventQueue queue = component.getToolkit().getSystemEventQueue(); |
| 42 |
3539
|
Map<Window, Boolean> windowMapping = queueMap.get(queue); |
| 43 |
6
|
if (windowMapping == null) windowMapping = createWindowMapping(queue); |
| 44 |
633
|
if (!(component instanceof Window) || parentOf(component) != null) return; |
| 45 |
2906
|
windowMapping.put((Window)component, TRUE); |
| 46 |
|
} |
| 47 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 48 |
6
|
private Map<Window, Boolean> createWindowMapping(EventQueue queue) {... |
| 49 |
6
|
Map<Window, Boolean> windowMapping = new WeakHashMap<Window, Boolean>(); |
| 50 |
6
|
queueMap.put(queue, windowMapping); |
| 51 |
6
|
return windowMapping; |
| 52 |
|
} |
| 53 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 54 |
4517
|
@RunsInCurrentThread... |
| 55 |
|
void removeMappingFor(Component component) { |
| 56 |
4517
|
EventQueue queue = component.getToolkit().getSystemEventQueue(); |
| 57 |
4517
|
removeComponent(component, queue); |
| 58 |
4517
|
for (EventQueue q : queueMap.keySet()) removeComponent(component, q); |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 61 |
9034
|
private void removeComponent(Component component, EventQueue queue) {... |
| 62 |
9034
|
Map<Window, Boolean> windowMapping = queueMap.get(queue); |
| 63 |
9033
|
if (windowMapping != null) windowMapping.remove(component); |
| 64 |
|
} |
| 65 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 66 |
18068
|
Collection<Window> windows() {... |
| 67 |
18068
|
Set<Window> rootWindows = new HashSet<Window>(); |
| 68 |
18068
|
for (EventQueue queue : queueMap.keySet()) |
| 69 |
18068
|
rootWindows.addAll(queueMap.get(queue).keySet()); |
| 70 |
18068
|
return rootWindows; |
| 71 |
|
} |
| 72 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
1851
|
Collection<EventQueue> eventQueues() {... |
| 74 |
1851
|
return queueMap.keySet(); |
| 75 |
|
} |
| 76 |
|
} |