Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 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:
  `ComponentChooser`

Constructor Summary
`ComponentSearcher(java.awt.Container c)` Contructor.

Method Summary
`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)` Creates `ComponentChooser` implementation whose `checkComponent(Component)` method returns `true` for any component.
`void` | `setOutput(TestOut output)` Defines print output streams or writers.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ComponentSearcher

    public ComponentSearcher(java.awt.Container c)

  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 Detail

### getTrueChooser

    public static ComponentChooser getTrueChooser(java.lang.String description)

  Creates `ComponentChooser` implementation whose `checkComponent(Component)` method returns `true` 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 interface `Outputable`
  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 interface `Outputable`
  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 this `ComponentChooser`'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's `checkComponent(Component)` method returns `true`. A `null` reference is returned if there are fewer than `index-1` components meeting the search criteria exist in the component hierarchy rooted in this `ComponentChooser`'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 this `ComponentChooser`'s container.
  Parameters:
    `chooser` - ComponentChooser instance, defining and applying the search criteria.
  Returns:
    the first component for which the chooser's `checkComponent(Component)` method returns `true`. A `null` reference is returned if no component meeting the search criteria exist in the component hierarchy rooted in this `ComponentChooser`'s container.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD