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

junit.extensions.jfcunit.finder.DialogFinder Maven / Gradle / Ivy

The newest version!
package junit.extensions.jfcunit.finder;

import java.awt.Component;
import java.awt.Dialog;

/**
 * Class for checking if the ({@link java.awt.Dialog}) component being searched
 * for has been found The pattern syntax can be found at the Jakarta RegExp API
 * Documentation in {@link org.apache.regexp.RE}.
 * 
 * @author Vijay Aravamudhan :
 *         ThoughtWorks Inc.
 */
public class DialogFinder extends AbstractWindowFinder
{
	/**
	 * Constructor accepting all arguments needed to filter component.
	 * 
	 * @param title
	 *            The desired pattern for the title of the component.
	 */
	public DialogFinder(final String title)
	{
		super(title);
	}

	/**
	 * Constructor accepting all arguments needed to filter
	 * {@link java.awt.Component}.
	 * 
	 * @param title
	 *            The desired pattern for the title of the component.
	 * @param caseIndependent
	 *            Whether the match should be case independent (true) or not
	 *            (false)
	 */
	public DialogFinder(final String title, final boolean caseIndependent)
	{
		super(title, caseIndependent);
	}

	/**
	 * Method that returns true if the given {@link java.awt.Component} matches
	 * the search criteria.
	 * 
	 * @param comp
	 *            The component to test
	 * @return true if this component is a match
	 */
	@Override
	public boolean testComponent(final Component comp)
	{
		return comp != null && isValidForProcessing(comp, Dialog.class)
				&& checkIfTitleMatches(((Dialog) comp).getTitle());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy