package jp.sourceforge.cfneo.at4ie2.api.browser.impl.ie;

import jp.sourceforge.cfneo.at4ie2.BTRuntimeError;
import jp.sourceforge.cfneo.at4ie2.api.browser.AlertDialog;

public class BTAlertDialog implements AlertDialog {

	watij.dialogs.AlertDialog alertDialog;

	BTAlertDialog(watij.dialogs.AlertDialog alertDialog) {
		this.alertDialog = alertDialog;
	}

	@Override
	public boolean exists() {
		if (this.alertDialog == null) {
			return false;
		}
		try {
			return this.alertDialog.exists();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public String getLabel() {
		if (this.alertDialog == null) {
			return "";
		}
		try {
			return this.alertDialog.text();
		} catch (Exception e) {
			throw new BTRuntimeError(e);
		}
	}
	@Override
	public void clickOk() {
		if (this.alertDialog != null) {
			try {
				this.alertDialog.ok();
			} catch (Exception e) {
				throw new BTRuntimeError(e);
			}
		}
	}

}
