junit.extensions.jfcunit.finder
Class AbstractWindowFinder

java.lang.Object
  extended byjunit.extensions.jfcunit.finder.Finder
      extended byjunit.extensions.jfcunit.finder.AbstractWindowFinder
Direct Known Subclasses:
DialogFinder, FrameFinder, JWindowFinder

public abstract class AbstractWindowFinder
extends Finder

Class for checking if the (Window) component being searched for has been found. This class can be used to check only windows that have titles (Frame/Dialog and their sub-classes) The pattern syntax can be found at the Jakarta RegExp API Documentation in RE.

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  boolean m_caseIndependent
          A boolean specifying whether the filtration is case insensitive.
private  java.lang.String m_title
          The title of the component.
 
Fields inherited from class junit.extensions.jfcunit.finder.Finder
OP_CONTAINS, OP_ENDSWITH, OP_EQUALS, OP_MATCH, OP_STARTSWITH
 
Constructor Summary
AbstractWindowFinder(java.lang.String str)
          Constructor accepting all arguments needed to filter component.
AbstractWindowFinder(java.lang.String title, boolean caseIndependent)
          Constructor accepting all arguments needed to filter component.
 
Method Summary
protected  boolean checkIfTitleMatches(java.lang.String winTitle)
          This method checks whether the winTitle and the title strings are equal.
 java.util.List findAll(java.awt.Container[] owners)
          Find the components matching this finder.
 java.lang.String getTitle()
          Returns the title.
static java.util.List getWindows(java.util.List pRet, java.awt.Container[] windows, Finder finder)
          Returns a set of all the Windows that are currently visible and the title contains the given titlematch string.
 boolean isCaseIndependent()
          Returns the caseIndependent.
 void setCaseIndependent(boolean ignoreCase)
          Set the finder into a case independent mode.
 void setTitle(java.lang.String title)
          Set the title for the finder.
 
Methods inherited from class junit.extensions.jfcunit.finder.Finder
createPatternMatcher, evaluate, find, find, find, find, findAll, findAll, findAll, findComponentList, getDebug, getDefaultWait, getOperation, getOperation, getOperationString, getShowDebug, getWait, isValidForProcessing, matchPattern, matchPattern, matchPattern, pause, recreatePatternMatcher, setDebug, setDefaultWait, setIgnoreVisibility, setOperation, setShowDebug, setWait, testComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_title

private java.lang.String m_title
The title of the component.


m_caseIndependent

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

Constructor Detail

AbstractWindowFinder

public AbstractWindowFinder(java.lang.String str)
Constructor accepting all arguments needed to filter component.

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

AbstractWindowFinder

public AbstractWindowFinder(java.lang.String title,
                            boolean caseIndependent)
Constructor accepting all arguments needed to filter component.

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

setTitle

public final void setTitle(java.lang.String title)
Set the title for the finder.

Parameters:
title - String title to be set.

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.

isCaseIndependent

public boolean isCaseIndependent()
Returns the caseIndependent.

Overrides:
isCaseIndependent in class Finder
Returns:
boolean

getTitle

public final java.lang.String getTitle()
Returns the title.

Returns:
String

getWindows

public static java.util.List getWindows(java.util.List pRet,
                                        java.awt.Container[] windows,
                                        Finder finder)
Returns a set of all the Windows that are currently visible and the title contains the given titlematch string.

Parameters:
pRet - The list of already filtered and accepted windows.
windows - The array of windows to filter and add.
finder - The FrameFinder which is used to filter using a title match
Returns:
Set of Window objects.

findAll

public java.util.List findAll(java.awt.Container[] owners)
Find the components matching this finder. Windows searched will be owned by the containers given.

Overrides:
findAll in class Finder
Parameters:
owners - Owner windows which should be searched.
Returns:
Set contain the windows matching the finder.

checkIfTitleMatches

protected final boolean checkIfTitleMatches(java.lang.String winTitle)
This method checks whether the winTitle and the title strings are equal. Note: If the title string is null, we need to return all showing windows, so 'true' is returned.

Parameters:
winTitle - The title of the window being checked
Returns:
True if either the filter string is null or if the filter string is a substring of the window title


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