Package org.netbeans.jemmy
Class ComponentSearcher
- java.lang.Object
-
- org.netbeans.jemmy.ComponentSearcher
-
- All Implemented Interfaces:
Outputable
public class ComponentSearcher extends java.lang.Object implements Outputable
Contains methods to search for components below a a givenjava.awt.Containerin the display containment hierarchy. Uses aComponentChooserinterface implementation to find a component.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
ComponentChooser
-
-
Constructor Summary
Constructors Constructor Description ComponentSearcher(java.awt.Container c)Contructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ComponentfindComponent(ComponentChooser chooser)Searches for a component.java.awt.ComponentfindComponent(ComponentChooser chooser, int index)Searches for a component.TestOutgetOutput()Returns print output streams or writers.static ComponentChoosergetTrueChooser(java.lang.String description)CreatesComponentChooserimplementation whosecheckComponent(Component)method returnstruefor any component.voidsetOutput(TestOut output)Defines print output streams or writers.
-
-
-
Method Detail
-
getTrueChooser
public static ComponentChooser getTrueChooser(java.lang.String description)
CreatesComponentChooserimplementation whosecheckComponent(Component)method returnstruefor any component.- Parameters:
description- Component description.- Returns:
- ComponentChooser instance.
-
setOutput
public void setOutput(TestOut output)
Defines print output streams or writers.- Specified by:
setOutputin interfaceOutputable- Parameters:
output- ?out? Identify the streams or writers used for print output.- See Also:
TestOut,Outputable,getOutput()
-
getOutput
public TestOut getOutput()
Returns print output streams or writers.- Specified by:
getOutputin interfaceOutputable- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
TestOut,Outputable,setOutput(org.netbeans.jemmy.TestOut)
-
findComponent
public java.awt.Component findComponent(ComponentChooser chooser, int index)
Searches for a component. The search for the component proceeds recursively in the component hierarchy rooted in thisComponentChooser's container.- Parameters:
chooser- ComponentChooser instance, defining and applying the search criteria.index- Ordinal component index. Indices start at 0.- Returns:
- the
index'th component from among those components for which the chooser'scheckComponent(Component)method returnstrue. Anullreference is returned if there are fewer thanindex-1components meeting the search criteria exist in the component hierarchy rooted in thisComponentChooser's container.
-
findComponent
public java.awt.Component findComponent(ComponentChooser chooser)
Searches for a component. The search for the component proceeds recursively in the component hierarchy rooted in thisComponentChooser's container.- Parameters:
chooser- ComponentChooser instance, defining and applying the search criteria.- Returns:
- the first component for which the chooser's
checkComponent(Component)method returnstrue. Anullreference is returned if no component meeting the search criteria exist in the component hierarchy rooted in thisComponentChooser's container.
-
-