|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.core.AbstractComponentMatcher
org.fest.swing.core.GenericTypeMatcher<T>
org.fest.swing.core.matcher.NamedComponentMatcherTemplate<JButton>
org.fest.swing.core.matcher.JButtonMatcher
public final class JButtonMatcher
Understands matching a
by name, text and visibility on the screen.
JButton
Field Summary |
---|
Fields inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate |
---|
ANY, name |
Method Summary | |
---|---|
JButtonMatcher |
andShowing()
Indicates that the to match should be showing on the screen. |
JButtonMatcher |
andText(Pattern textPattern)
Specifies the text to match. |
JButtonMatcher |
andText(String newText)
Specifies the text to match. |
static JButtonMatcher |
any()
Creates a new that matches any . |
protected boolean |
isMatching(JButton button)
Indicates whether: the name of the given JButton is equal to the name in this matcher, and
the text of the given JButton matches the text (or pattern) in this matcher
|
String |
toString()
|
static JButtonMatcher |
withName(String name)
Creates a new that matches a that:
has a matching name
(optionally) has matching text
(optionally) is showing on the screen |
static JButtonMatcher |
withText(Pattern textPattern)
Creates a new that matches a by its text. |
static JButtonMatcher |
withText(String text)
Creates a new that matches a by its text. |
Methods inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate |
---|
arePropertyValuesMatching, isNameMatching, quoted, quotedName |
Methods inherited from class org.fest.swing.core.GenericTypeMatcher |
---|
matches, supportedType |
Methods inherited from class org.fest.swing.core.AbstractComponentMatcher |
---|
requireShowing, requireShowing, requireShowingMatches, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static JButtonMatcher withName(String name)
JButtonMatcher
that matches a JButton
that:
The following code listing shows how to match a
by name and text:
JButton
JButtonMatcher m =withName
("ok").andText
("OK");
The following code listing shows how to match a
, that should be showing on the screen,
by name and text:
JButton
JButtonMatcher m =withName
("ok").andText
("OK").andShowing
();
name
- the name to match.
public static JButtonMatcher withText(String text)
JButtonMatcher
that matches a JButton
by its text.
The following code listing shows how to match a
by text:
JButton
JButtonMatcher m = withText
("OK");
The following code listing shows how to match a
, that should be showing on the screen,
by text:
JButton
JButtonMatcher m =withText
("OK").andShowing
();
text
- the text to match. It can be a regular expression.
public static JButtonMatcher withText(Pattern textPattern)
JButtonMatcher
that matches a JButton
by its text.
The following code listing shows how to match a
by text, using a regular expression
pattern:
JButton
JButtonMatcher m = withText
(Pattern.compile("O.*"));
The following code listing shows how to match a
, that should be showing on the screen,
by text, using a regular expression pattern:
JButton
JButtonMatcher m =withText
(Pattern.compile("O.*")).andShowing
();
textPattern
- the regular expression pattern to match.
public static JButtonMatcher any()
JButtonMatcher
that matches any JButton
.
public JButtonMatcher andText(String newText)
withText(String)
or
withText(Pattern)
, this method will simply update the text to match.
newText
- the new text to match. It can be a regular expression.
public JButtonMatcher andText(Pattern textPattern)
withText(String)
or
withText(Pattern)
, this method will simply update the text to match.
textPattern
- the regular expression pattern to match.
public JButtonMatcher andShowing()
JButton
to match should be showing on the screen.
@RunsInCurrentThread protected boolean isMatching(JButton button)
JButton
is equal to the name in this matcher, andJButton
matches the text (or pattern) in this matcherNote: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
isMatching
in class GenericTypeMatcher<JButton>
button
- the JButton
to match.
true
if the JButton
matches the search criteria in this matcher.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |