junit.extensions.jfcunit.finder
Class AbstractButtonFinder

java.lang.Object
  extended byjunit.extensions.jfcunit.finder.Finder
      extended byjunit.extensions.jfcunit.finder.AbstractButtonFinder

public class AbstractButtonFinder
extends Finder

Class for checking if the (AbstractButton) component being searched for has been found. The pattern syntax can be found at the Jakarta RegExp API Documentation in RE. This class delegates the matching of the Icon to an instance of IconMatcher

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  boolean m_caseIndependent
          A boolean specifying whether the filtration is case insensitive.
private  IconMatcher m_iconMatcher
          The matcher for the icon of the AbstractButton component.
private  java.lang.String m_label
          The text of the AbstractButton component.
 
Fields inherited from class junit.extensions.jfcunit.finder.Finder
OP_CONTAINS, OP_ENDSWITH, OP_EQUALS, OP_MATCH, OP_STARTSWITH
 
Constructor Summary
AbstractButtonFinder(javax.swing.Icon icon)
          Constructor accepting all arguments needed to filter the component.
AbstractButtonFinder(java.lang.String text)
          Constructor accepting all arguments needed to filter the component.
AbstractButtonFinder(java.lang.String text, boolean caseIndependent)
          Constructor accepting all arguments needed to filter the component.
AbstractButtonFinder(java.lang.String str, javax.swing.Icon icon)
          Constructor accepting all arguments needed to filter the component.
AbstractButtonFinder(java.lang.String str, javax.swing.Icon icon, boolean caseIndependent)
          Constructor accepting all arguments needed to filter the component.
 
Method Summary
 javax.swing.Icon getIcon()
          Get the icon to be matched.
 java.lang.String getText()
          Get the text of the label to be matched.
 void setCaseIndependent(boolean ignoreCase)
          Set the finder into a case independent mode.
 void setIcon(javax.swing.Icon icon)
          Set the icon to be matched.
 void setText(java.lang.String text)
          Set the text of the button to be found.
 boolean testComponent(java.awt.Component comp)
          Method that returns true if the given component matches the search criteria.
 
Methods inherited from class junit.extensions.jfcunit.finder.Finder
createPatternMatcher, evaluate, find, find, find, find, findAll, findAll, findAll, findAll, findComponentList, getDebug, getDefaultWait, getOperation, getOperation, getOperationString, getShowDebug, getWait, isCaseIndependent, isValidForProcessing, matchPattern, matchPattern, matchPattern, pause, recreatePatternMatcher, setDebug, setDefaultWait, setIgnoreVisibility, setOperation, setShowDebug, setWait
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iconMatcher

private IconMatcher m_iconMatcher
The matcher for the icon of the AbstractButton component.


m_label

private java.lang.String m_label
The text of the AbstractButton component.


m_caseIndependent

private boolean m_caseIndependent
A boolean specifying whether the filtration is case insensitive.

Constructor Detail

AbstractButtonFinder

public AbstractButtonFinder(java.lang.String text)
Constructor accepting all arguments needed to filter the component.

Parameters:
text - The desired pattern for the text of the component.

AbstractButtonFinder

public AbstractButtonFinder(java.lang.String text,
                            boolean caseIndependent)
Constructor accepting all arguments needed to filter the component.

Parameters:
text - The desired pattern for the text of the component.
caseIndependent - Whether the match should be case independent (true) or not (false).

AbstractButtonFinder

public AbstractButtonFinder(javax.swing.Icon icon)
Constructor accepting all arguments needed to filter the component.

Parameters:
icon - The desired pattern for the icon of the component.

AbstractButtonFinder

public AbstractButtonFinder(java.lang.String str,
                            javax.swing.Icon icon)
Constructor accepting all arguments needed to filter the component.

Parameters:
str - The desired pattern for the text of the component.
icon - The desired pattern for the icon of the component.

AbstractButtonFinder

public AbstractButtonFinder(java.lang.String str,
                            javax.swing.Icon icon,
                            boolean caseIndependent)
Constructor accepting all arguments needed to filter the component.

Parameters:
str - The desired pattern for the text of the component.
icon - The desired pattern for the icon of the component.
caseIndependent - Whether the match should be case independent (true) or not (false)
Method Detail

setText

public final void setText(java.lang.String text)
Set the text of the button to be found.

Parameters:
text - Text of the button.

setCaseIndependent

public void setCaseIndependent(boolean ignoreCase)
Set the finder into a case independent mode.

Overrides:
setCaseIndependent in class Finder
Parameters:
ignoreCase - true if case should be ignored.

getText

public final java.lang.String getText()
Get the text of the label to be matched.

Returns:
String text of the label.

setIcon

public final void setIcon(javax.swing.Icon icon)
Set the icon to be matched.

Parameters:
icon - Icon to be matched.

getIcon

public final javax.swing.Icon getIcon()
Get the icon to be matched.

Returns:
Iocn to be matched.

testComponent

public boolean testComponent(java.awt.Component comp)
Method that returns true if the given component matches the search criteria.

Specified by:
testComponent in class Finder
Parameters:
comp - The component to test.
Returns:
true if this component is a match.


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999