package junit.extensions.jfcunit.finder;

import org.w3c.dom.Element;

import junit.extensions.xml.XMLException;
import junit.extensions.xml.IXMLTestCase;

/**
 * This class will handle the processing of &lt;find&gt; nodes.
 *
 * @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
 */
public class FrameFinderTagHandler extends BaseFindTagHandler {
    /**
     * Constructor for ComponentFinderTagHandler.
     *
     * @param element     The element to be processed
     * @param testCase    The IXMLTestCase that uses this element
     */
    public FrameFinderTagHandler(Element element, IXMLTestCase testCase) {
        super(element, testCase);
    }

    /**
     * @see junit.extensions.jfcunit.xml.nodehandler.AbstractTagHandler#validateElement()
     */
    public void validateElement() throws XMLException {
        // do the default validations from the super class
        super.validateElement();

        // reqd attribute: class
        checkRequiredAttribute(TITLE);
    }

    /**
     * @see junit.extensions.jfcunit.xml.nodehandler.AbstractTagHandler#processElement()
     */
    public void processElement() throws Exception {
        validateElement();
        find(new FrameFinder(getTitleName(), getCaseIndependent()));
    }
}