junit.extensions.jfcunit.finder
Class LabeledComponentFinder

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

public class LabeledComponentFinder
extends Finder

Find a component based upon the label attached via JLabel.setLabelFor(Component comp).

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  boolean m_caseIndependent
          Ignore the case of the search.
private  java.lang.String m_text
          The label Regular expression to be found.
 
Fields inherited from class junit.extensions.jfcunit.finder.Finder
OP_CONTAINS, OP_ENDSWITH, OP_EQUALS, OP_MATCH, OP_STARTSWITH
 
Constructor Summary
LabeledComponentFinder(java.lang.String text, boolean caseIndependent)
          Constructor accepting all arguments needed to filter the Component.
 
Method Summary
 java.awt.Component find(java.awt.Container[] conts, int index)
          Find the component in the container at the given index.
 java.lang.String getText()
          Get the text to be matched against the label.
 void setCaseIndependent(boolean ignoreCase)
          Set the finder into a case independent mode.
 void setText(java.lang.String text)
          Set the text to be matched against the label.
 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, 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_text

private java.lang.String m_text
The label Regular expression to be found.


m_caseIndependent

private boolean m_caseIndependent
Ignore the case of the search.

Constructor Detail

LabeledComponentFinder

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

Parameters:
text - Regular expression describing the label to be found.
caseIndependent - true if the case should be ignored.
Method Detail

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.

setText

public final void setText(java.lang.String text)
Set the text to be matched against the label.

Parameters:
text - String to be matched.

getText

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

Returns:
String text 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

find

public java.awt.Component find(java.awt.Container[] conts,
                               int index)
Find the component in the container at the given index.

Overrides:
find in class Finder
Parameters:
conts - Containers to be searched.
index - Index of the component to find.
Returns:
Component which was found or null.


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