|
1
|
|
package abbot.finder.matchers;
|
|
2
|
|
|
|
3
|
|
import abbot.finder.Matcher;
|
|
4
|
|
import java.awt.Component;
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
public class ClassMatcher extends AbstractMatcher {
|
|
8
|
|
private Class cls;
|
|
9
|
|
private boolean mustBeShowing;
|
|
10
|
567
|
public ClassMatcher(Class cls) {
|
|
11
|
567
|
this(cls, false);
|
|
12
|
|
}
|
|
13
|
682
|
public ClassMatcher(Class cls, boolean mustBeShowing) {
|
|
14
|
682
|
this.cls = cls;
|
|
15
|
682
|
this.mustBeShowing = mustBeShowing;
|
|
16
|
|
}
|
|
17
|
5191
|
public boolean matches(Component c) {
|
|
18
|
5191
|
return cls.isAssignableFrom(c.getClass())
|
|
19
|
|
&& (!mustBeShowing || c.isShowing());
|
|
20
|
|
}
|
|
21
|
458
|
public String toString() {
|
|
22
|
458
|
return "Class matcher (" + cls.getName() + ")";
|
|
23
|
|
}
|
|
24
|
|
}
|
|
25
|
|
|