|
||||||||||
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<JTextComponent>
org.fest.swing.core.matcher.JTextComponentMatcher
public final class JTextComponentMatcher
Understands matching a
by type, name or text.
JTextComponent
Field Summary |
---|
Fields inherited from class org.fest.swing.core.matcher.NamedComponentMatcherTemplate |
---|
ANY, name |
Method Summary | |
---|---|
JTextComponentMatcher |
andShowing()
Indicates that the to match should be showing on the screen. |
JTextComponentMatcher |
andText(Pattern textPattern)
Specifies the text to match. |
JTextComponentMatcher |
andText(String newText)
Specifies the text to match. |
static JTextComponentMatcher |
any()
Creates a new that matches any . |
protected boolean |
isMatching(JTextComponent button)
Indicates whether the text of the given is equal to the text in this matcher. |
String |
toString()
|
static JTextComponentMatcher |
withName(String name)
Creates a new that matches a that:
has a matching name
(optionally) has matching text
(optionally) is showing on the screen
The following code listing shows how to match a by name and text:
JTextComponentMatcher m = withName ("lastName"). |
static JTextComponentMatcher |
withText(Pattern textPattern)
Creates a new that matches a by its
text. |
static JTextComponentMatcher |
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 JTextComponentMatcher withName(String name)
JTextComponentMatcher
that matches a JTextComponent
that:
The following code listing shows how to match a
by name and text:
JTextComponent
JTextComponentMatcher m =withName
("lastName").andText
("Wang");
The following code listing shows how to match a
, that should be showing on the screen,
by name and text:
JTextComponent
JTextComponentMatcher m =withName
("lastName").andText
("Wang").andShowing
();
name
- the id to match.
public static JTextComponentMatcher withText(String text)
JTextComponentMatcher
that matches a JTextComponent
by its
text.
The following code listing shows how to match a
by text:
JTextComponent
JTextComponentMatcher m = withText
("Wang");
The following code listing shows how to match a
, that should be showing on the
screen, by text:
JTextComponent
JTextComponentMatcher m =withText
("Wang").andShowing
();
text
- the text to match. It can be a regular expression.
public static JTextComponentMatcher withText(Pattern textPattern)
JTextComponentMatcher
that matches a JTextComponent
by its
text.
The following code listing shows how to match a
by text, using a regular
expression pattern:
JTextComponent
JTextComponentMatcher m = withText
(Pattern.compile("W.*"));
The following code listing shows how to match a
, that should be showing on the
screen, by text, using a regular expression pattern:
JTextComponent
JTextComponentMatcher m =withText
(Pattern.compile("W.*")).andShowing
();
textPattern
- the text to match. It can be a regular expression.
public static JTextComponentMatcher any()
JTextComponentMatcher
that matches any JTextComponent
.
public JTextComponentMatcher 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 JTextComponentMatcher 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 JTextComponentMatcher andShowing()
JTextComponent
to match should be showing on the screen.
@RunsInCurrentThread protected boolean isMatching(JTextComponent button)
JTextComponent
is equal to the text in this matcher.
Note: 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<JTextComponent>
button
- the JTextComponent
to match.
true
if the text in the JTextComponent
is equal to the text in this matcher,
false
otherwise.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |