package jp.sourceforge.cfneo.at4ie.api.impl.ie;

import org.apache.log4j.Logger;
import org.w3c.dom.Element;

import watij.elements.Button;
import watij.runtime.ie.IE;
import watij.runtime.ie.IEButton;

/**
 * watijのIEButtonの拡張実装クラス。
 * @author imaitakafumi
 *
 */
public class AT4IEButton extends IEButton implements Button {

	Logger logger = Logger.getLogger(AT4IEButton.class);

	/**
	 * コンストラクタ。
	 * @param element
	 * @param ie
	 * @throws Exception
	 */
	public AT4IEButton(Element element, IE ie) throws Exception {
		super(element, ie);
	}
	/**
	 * コンストラクタ。
	 * @param button
	 * @param ie
	 * @throws Exception
	 */
	public AT4IEButton(Button button, IE ie) throws Exception {
		super((Element) button.element(), ie);
	}
	@Override
	public void click() throws Exception {
		synchronized (this) {
			Thread t = new Thread(new ButtonClicker(this));
			logger.debug("t.id=" + t.getId());
			t.start();
			Thread.sleep(500L);
			t = null;
		}
	}
	/**
	 * 継承元のclick()を実行する。
	 * @throws Exception
	 */
	public void invokeClickAtSuper() throws Exception {
		super.click();
	}

}
