Package org.netbeans.jemmy
Class ComponentSearcher
java.lang.Object
org.netbeans.jemmy.ComponentSearcher
- All Implemented Interfaces:
Outputable
Contains methods to search for components below a
a given
java.awt.Container
in the display containment hierarchy.
Uses a ComponentChooser
interface implementation to find a
component.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindComponent
(ComponentChooser chooser) Searches for a component.findComponent
(ComponentChooser chooser, int index) Searches for a component.Returns print output streams or writers.static ComponentChooser
getTrueChooser
(String description) CreatesComponentChooser
implementation whosecheckComponent(Component)
method returnstrue
for any component.void
Defines print output streams or writers.
-
Constructor Details
-
ComponentSearcher
Contructor. The search is constrained so that only components that lie below the given container in the containment hierarchy are considered.- Parameters:
c
- Container to find components in.
-
-
Method Details
-
getTrueChooser
CreatesComponentChooser
implementation whosecheckComponent(Component)
method returnstrue
for any component.- Parameters:
description
- Component description.- Returns:
- ComponentChooser instance.
-
setOutput
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:
-
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:
-
findComponent
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
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.
-