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.Container
in the display containment hierarchy. Uses aComponentChooser
interface 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.Component
findComponent(ComponentChooser chooser)
Searches for a component.java.awt.Component
findComponent(ComponentChooser chooser, int index)
Searches for a component.TestOut
getOutput()
Returns print output streams or writers.static ComponentChooser
getTrueChooser(java.lang.String description)
CreatesComponentChooser
implementation whosecheckComponent(Component)
method returnstrue
for any component.void
setOutput(TestOut output)
Defines print output streams or writers.
-
-
-
Method Detail
-
getTrueChooser
public static ComponentChooser getTrueChooser(java.lang.String description)
CreatesComponentChooser
implementation whosecheckComponent(Component)
method returnstrue
for any component.- Parameters:
description
- Component description.- Returns:
- ComponentChooser instance.
-
setOutput
public void setOutput(TestOut output)
Defines print output streams or writers.- Specified by:
setOutput
in 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:
getOutput
in 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
. Anull
reference is returned if there are fewer thanindex-1
components 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
. Anull
reference is returned if no component meeting the search criteria exist in the component hierarchy rooted in thisComponentChooser
's container.
-
-