All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.objogate.wl.swing.probe.ComponentFinders Maven / Gradle / Ivy

The newest version!
package com.objogate.wl.swing.probe;

import java.awt.Component;
import org.hamcrest.Matcher;

import com.objogate.wl.swing.ComponentFinder;
import com.objogate.wl.swing.ComponentSelector;

public class ComponentFinders {
    /**
     * Returns a selector that identifies all subcomponents of the component driven by this driver that match
     * the given criteria.
     *
     * @param type     The type of subcomponents to finde
     * @param criteria The criteria by which to select subcomponents
     * @return a selector that identifies the component driven by this driver.
     */
    public static  ComponentFinder all(Class type, Matcher criteria, ComponentFinder selector) {
        return new RecursiveComponentFinder(type, criteria, selector);
    }

    /**
     * Returns a selector that identifies a single subcomponent of the component driven by this driver that matches
     * the given criteria.
     *
     * @param type     The type of subcomponents to finde
     * @param criteria The criteria by which to select subcomponents
     * @return a selector that identifies the component driven by this driver.
     */
    public static  ComponentSelector the(Class type, Matcher criteria, ComponentFinder selector) {
        return new SingleComponentFinder(all(type, criteria, selector));
    }

}