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

## org.eclipse.swtbot.swt.finder.finders
Class ControlFinder

    java.lang.Object
      org.eclipse.swtbot.swt.finder.finders.ControlFinder

Direct Known Subclasses:
  ChildrenControlFinder

    public class ControlFinder

extends Object

Finds controls matching a particular matcher.

Version:
  $Id$
Author:
  Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
See Also:
  `UIThreadRunnable`

Field Summary
`protected IChildrenResolver` | `childrenResolver` The childrenResolver
`protected Display` | `display` The display
`protected IParentResolver` | `parentResolver` The parentResolver
`boolean` | `shouldFindInVisibleControls` Set to true if the control finder should find invisible controls.

Constructor Summary
`ControlFinder()` Creates a Control finder using `DefaultChildrenResolver` and `DefaultParentResolver`.
`ControlFinder(IChildrenResolver childrenResolver, IParentResolver parentResolver)` Creates a control finder using the given resolvers.

Method Summary
`Shell` | `activeShell()` Return the active shell.
`
`<T extends Widget> List<T>`
` | `findControls(List<Widget> widgets, Matcher<T> matcher, boolean recursive)` Finds the controls matching one of the widgets using the given matcher.
`
`<T extends Widget> List<T>`
` | `findControls(Matcher<T> matcher)` Finds the controls in the active shell matching the given matcher.
`
`<T extends Widget> List<T>`
` | `findControls(Widget parentWidget, Matcher<T> matcher, boolean recursive)` Finds the controls starting with the given parent widget and uses the given matcher.
`List<Shell>` | `findShells(String text)` Finds the shell matching the given text (shell.getText()).
`IChildrenResolver` | `getChildrenResolver()` Gets the registered children resolver.
`IParentResolver` | `getParentResolver()` Gets the registered parent resolver.
`TreePath` | `getPath(Widget w)` Gets the path to the widget.
`Shell[]` | `getShells()` Gets the shells registered with the display.
`protected boolean` | `visible(Widget w)` Returns true if the widget is a control and it is visible.

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

Field Detail

### childrenResolver

    protected final IChildrenResolver childrenResolver

  The childrenResolver

### display

    protected Display display

  The display

### parentResolver

    protected final IParentResolver parentResolver

  The parentResolver

### shouldFindInVisibleControls

    public boolean shouldFindInVisibleControls

  Set to true if the control finder should find invisible controls. Invisible controls are ones hidden from the display (isVisible() = false)

  Since:
    1.0

Constructor Detail

### ControlFinder

    public ControlFinder()

  Creates a Control finder using `DefaultChildrenResolver` and `DefaultParentResolver`.

### ControlFinder

    public ControlFinder(IChildrenResolver childrenResolver,
                         IParentResolver parentResolver)

  Creates a control finder using the given resolvers.

  Parameters:
    `childrenResolver` - the resolver used to resolve children of a control.
    `parentResolver` - the resolver used to resolve parent of a control.

Method Detail

### findControls

    public <T extends Widget> List<T> findControls(Matcher<T> matcher)

  Finds the controls in the active shell matching the given matcher.

  Note: This method is thread safe.

  Parameters:
    `matcher` - the matcher used to find controls in the active shell.
  Returns:
    all controls in the active shell that the matcher matches.
  See Also:
    `Display.getActiveShell()`

### findControls

    public <T extends Widget> List<T> findControls(List<Widget> widgets,
                                                   Matcher<T> matcher,
                                                   boolean recursive)

  Finds the controls matching one of the widgets using the given matcher. This will also go recursively though the `widgets` provided.

  Parameters:
    `widgets` - the list of widgets.
    `matcher` - the matcher used to match the widgets.
    `recursive` - if the match should be recursive.
  Returns:
    all visible widgets in the children that the matcher matches. If recursive is `true` then find the widgets within each of the widget.

### visible

    protected boolean visible(Widget w)

  Returns true if the widget is a control and it is visible.

  This method is not thread safe and must be invoked from the UI thread.

  TODO visibility of tab items.

  Parameters:
    `w` - the widget
  Returns:
    `true` if the control is visible, `false` otherwise.
  Since:
    1.0
  See Also:
    `Control.getVisible()`

### findControls

    public <T extends Widget> List<T> findControls(Widget parentWidget,
                                                   Matcher<T> matcher,
                                                   boolean recursive)

  Finds the controls starting with the given parent widget and uses the given matcher. If recursive is set, it will attempt to find the controls recursively in each child widget if they exist.

  This method is thread safe.

  Parameters:
    `parentWidget` - the parent widget in which controls should be found.
    `matcher` - the matcher used to match the widgets.
    `recursive` - if the match should be recursive.
  Returns:
    all visible widgets in the parentWidget that the matcher matches. If recursive is `true` then find the widget within each of the parentWidget.

### findShells

    public List<Shell> findShells(String text)

  Finds the shell matching the given text (shell.getText()).

  Parameters:
    `text` - The text on the Shell
  Returns:
    A Shell containing the specified text

### getChildrenResolver

    public IChildrenResolver getChildrenResolver()

  Gets the registered children resolver. If the resolver had never been set a default resolver will be created.

  Returns:
    the childrenResolver

### getParentResolver

    public IParentResolver getParentResolver()

  Gets the registered parent resolver. If the resolver was not registered then a default instance will be returned.

  Returns:
    the parentResolver

### getPath

    public TreePath getPath(Widget w)

  Gets the path to the widget. The path is the list of all parent containers of the widget.

  Parameters:
    `w` - the widget.
  Returns:
    the path to the widget w.

### getShells

    public Shell[] getShells()

  Gets the shells registered with the display.

  Returns:
    the shells

### activeShell

    public Shell activeShell()

  Return the active shell.

  Returns:
    the active shell.
  See Also:
    `Display.getActiveShell()`

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