Example usage for java.awt.event KeyEvent VK_SPACE

List of usage examples for java.awt.event KeyEvent VK_SPACE

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_SPACE.

Prototype

int VK_SPACE

To view the source code for java.awt.event KeyEvent VK_SPACE.

Click Source Link

Document

Constant for the SPACE virtual key.

Usage

From source file:SwiftSeleniumWeb.WebHelper.java

/**
 * This class performs the reuired action on an element
 * /*from   w  w  w .jav a  2s.  c  om*/
 * @param imageType
 * @param controlType
 * @param controlId
 * @param controlName
 * @param ctrlValue
 * @param logicalName
 * @param action
 * @param webElement
 * @param Results
 * @param strucSheet
 * @param valSheet
 * @param rowIndex
 * @param rowcount
 * @param rowNo
 * @param colNo
 * @return
 * @throws Exception
 */
@SuppressWarnings("incomplete-switch")
public static String doAction(String imageType, String controlType, String controlId, String controlName,
        String ctrlValue, String logicalName, String action, WebElement webElement, Boolean Results,
        HSSFSheet strucSheet, HSSFSheet valSheet, int rowIndex, int rowcount, String rowNo, String colNo)
        throws Exception {
    List<WebElement> WebElementList = null;
    String currentValue = null;
    String uniqueNumber = "";
    ControlTypeEnum controlTypeEnum = ControlTypeEnum.valueOf(controlType);
    ControlTypeEnum actionName = ControlTypeEnum.valueOf(action.toString());
    if (controlType.contains("Robot") && !isIntialized) {
        robot = new Robot();
        isIntialized = true;
    }

    if (action.toString().equalsIgnoreCase("I") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("Read") || action.toString().equalsIgnoreCase("Write")
            || action.toString().equalsIgnoreCase("V") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("NC")
            || action.toString().equalsIgnoreCase("T") && !ctrlValue.equalsIgnoreCase("")) {
        try {
            switch (controlTypeEnum) {

            case WebEdit:
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    webElement.clear();
                    webElement.sendKeys(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    if (!ctrlValue.equalsIgnoreCase("null")) {
                        webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                        webElement.clear();
                        webElement.sendKeys(ctrlValue);
                    } else {
                        webElement.clear();
                    }
                    break;
                case V:
                    currentValue = webElement.getText();
                    break;
                }
                break;

            case WebButton:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                        webElement.click();
                    }
                    break;
                case NC:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    webElement.click();
                    break;
                case V:
                    if (webElement.isDisplayed()) {
                        if (webElement.isEnabled() == true)
                            currentValue = "True";
                        else
                            currentValue = "False";
                    }
                }
                break;

            case WebElement:
                switch (actionName) {
                case I:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    webElement.click();
                    break;

                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    webElement.clear();
                    webElement.sendKeys(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case V:
                    boolean textPresent = false;
                    textPresent = webElement.getText().contains(ctrlValue);
                    if (textPresent == false)
                        currentValue = webElement.getText();
                    else
                        currentValue = ctrlValue;
                    break;
                }
                break;

            case JSScript:
                ((JavascriptExecutor) Automation.driver).executeScript(controlName, ctrlValue);
                break;

            case Wait:
                Thread.sleep(Integer.parseInt(controlName) * 1000);
                break;

            case CheckBox:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                        webElement.click();
                    }
                    break;
                case NC:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    webElement.click();
                    break;
                }
                break;

            case Radio:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                        if (!webElement.isSelected()) {
                            webElement.click();
                        }
                    }
                    break;
                case NC:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    if (!webElement.isSelected()) {
                        webElement.click();
                    }
                    break;
                case V:
                    if (webElement.isSelected()) {
                        currentValue = webElement.getAttribute(controlName.toString());
                    }
                    break;
                }
                break;

            case WebLink:
            case CloseWindow://added this Case to bypass page loading after clicking the event
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    WebElementList = getElementsByType(controlId, controlName, controlType, imageType,
                            uniqueNumber);
                    webElement = GetControlByIndex("", WebElementList, controlId, controlName, controlType,
                            uniqueNumber);
                    webElement.click();
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    if (controlId.equalsIgnoreCase("LinkValue")) {
                        webElement.click();
                    } else {
                        if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                            webElement.click();
                        }
                    }
                    break;
                case NC:
                    webElement.click();
                    break;
                }
                break;

            case WaitForJS:
                waitForCondition();
                break;

            case ListBox:
            case WebList:
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    new Select(webElement).selectByVisibleText(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    ExpectedCondition<Boolean> isTextPresent = CommonExpectedConditions
                            .textToBePresentInElement(webElement, ctrlValue);
                    if (isTextPresent != null) {
                        if (webElement != null) {
                            new Select(webElement).selectByVisibleText(ctrlValue);
                        }
                    }
                    break;
                case V:
                    currentValue = new Select(webElement).getFirstSelectedOption().getText();
                    if (currentValue.isEmpty()) {
                        currentValue = new Select(webElement).getFirstSelectedOption().getAttribute("value");
                    }
                    break;
                }
                break;

            case IFrame:
                Automation.driver = Automation.driver.switchTo().frame(controlName);
                break;

            case Browser:
                //Thread.sleep(3000); //DS:Check if required
                Set<String> handlers = Automation.driver.getWindowHandles();
                handlers = Automation.driver.getWindowHandles();
                for (String handler : handlers) {
                    Automation.driver = Automation.driver.switchTo().window(handler);
                    if (Automation.driver.getTitle().equalsIgnoreCase(controlName)) {
                        System.out.println("Focus on window with title: " + Automation.driver.getTitle());
                        break;
                    }
                }
                break;

            case URL:
                switch (actionName) {
                case I:
                    Automation.driver.navigate().to(ctrlValue);
                    break;
                case NC:
                    break;
                }
                break;

            case Menu:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                webElement.click();
                break;

            case Alert:
                switch (actionName) {
                case V:
                    Alert alert = Automation.driver.switchTo().alert();
                    if (alert != null) {
                        currentValue = alert.getText();
                        System.out.println(currentValue);
                        alert.accept();
                    }
                    break;
                }
                break;

            case WebImage:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                webElement.click();
                Thread.sleep(5000);
                for (int Seconds = 0; Seconds <= Integer
                        .parseInt(Automation.configHashMap.get("TIMEOUT").toString()); Seconds++) {
                    if (!((Automation.driver.getWindowHandles().size()) > 1)) {
                        webElement.click();
                        Thread.sleep(5000);
                    } else {
                        break;
                    }
                }
                break;

            case ActionClick:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                Actions builderClick = new Actions(Automation.driver);
                Action clickAction = builderClick.moveToElement(webElement).clickAndHold().release().build();
                clickAction.perform();
                break;

            case ActionDoubleClick:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                Actions builderdoubleClick = new Actions(Automation.driver);
                Action doubleClickAction = builderdoubleClick.moveToElement(webElement).click().build();
                doubleClickAction.perform();
                doubleClickAction.perform();
                break;

            case ActionClickandEsc:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                Actions clickandEsc = new Actions(Automation.driver);
                Action clickEscAction = clickandEsc.moveToElement(webElement).click()
                        .sendKeys(Keys.ENTER, Keys.ESCAPE).build();
                clickEscAction.perform();
                break;

            case ActionMouseOver:
                Actions builderMouserOver = new Actions(Automation.driver);
                Action mouseOverAction = builderMouserOver.moveToElement(webElement).build();
                mouseOverAction.perform();
                break;

            case CalendarNew:
                Boolean isCalendarDisplayed = Automation.driver.switchTo().activeElement().isDisplayed();
                System.out.println(isCalendarDisplayed);
                if (isCalendarDisplayed == true) {

                    String[] dtMthYr = ctrlValue.split("/");
                    Thread.sleep(2000);
                    //String[] CurrentDate = dtFormat.format(frmDate).split("/");
                    WebElement Monthyear = Automation.driver.findElement(By.xpath("//table/thead/tr/td[2]"));
                    String Monthyear1 = Monthyear.getText();
                    String[] Monthyear2 = Monthyear1.split(",");
                    Monthyear2[1] = Monthyear2[1].trim();

                    month = CalendarSnippet.getMonthForString(Monthyear2[0]);

                    while (!Monthyear2[1].equalsIgnoreCase(dtMthYr[2])) {
                        if (Integer.parseInt(Monthyear2[1]) > Integer.parseInt(dtMthYr[2])) {
                            WebElement yearButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            yearButton.click();
                            Monthyear2[1] = Integer.toString(Integer.parseInt(Monthyear2[1]) - 1);
                        } else if (Integer.parseInt(Monthyear2[1]) < Integer.parseInt(dtMthYr[2])) {
                            WebElement yearButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            yearButton.click();
                            Monthyear2[1] = Integer.toString(Integer.parseInt(Monthyear2[1]) + 1);
                        }
                    }

                    while (!month.equalsIgnoreCase(dtMthYr[1])) {
                        if (Integer.parseInt(month) > Integer.parseInt(dtMthYr[1])) {
                            WebElement monthButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            monthButton.click();
                            if (Integer.parseInt(month) < 11) {
                                month = "0" + Integer.toString(Integer.parseInt(month) - 1);
                            } else {
                                month = Integer.toString(Integer.parseInt(month) - 1);
                            }

                        } else if (Integer.parseInt(month) < Integer.parseInt(dtMthYr[1])) {
                            WebElement monthButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            monthButton.click();
                            if (Integer.parseInt(month) < 9) {
                                month = "0" + Integer.toString(Integer.parseInt(month) + 1);
                            } else {
                                month = Integer.toString(Integer.parseInt(month) + 1);
                            }
                        }
                    }

                    WebElement dateButton = Automation.driver
                            .findElement(By.cssSelector("td.day:contains('" + dtMthYr[0] + "')"));
                    System.out.println(dateButton);
                    dateButton.click();

                } else {
                    System.out.println("Calendar not Diplayed");
                }
                break;

            case CalendarIPF:
                String[] dtMthYr = ctrlValue.split("/");
                Thread.sleep(2000);
                String year = dtMthYr[2];
                String monthNum = dtMthYr[1];
                String day = dtMthYr[0];

                //Xpath for Year, mMnth & Days
                String xpathYear = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-years']";
                String xpathMonth = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-months']";
                String xpathDay = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-days']";

                //Selecting year in 3 steps
                Automation.driver.findElement(By.xpath(xpathDay + "/table/thead/tr[1]/th[2]")).click();
                Automation.driver.findElement(By.xpath(xpathMonth + "/table/thead/tr/th[2]")).click();
                Automation.driver
                        .findElement(By.xpath(xpathYear
                                + "/table/tbody/tr/td/span[@class='year'][contains(text()," + year + ")]"))
                        .click();

                //Selecting month in 1 step   
                Automation.driver
                        .findElement(By.xpath(xpathMonth + "/table/tbody/tr/td/span[" + monthNum + "]"))
                        .click();

                //Selecting day in 1 step
                Automation.driver
                        .findElement(By.xpath(
                                xpathDay + "/table/tbody/tr/td[@class='day'][contains(text()," + day + ")]"))
                        .click();

            case CalendarEBP:
                String[] dtMthYrEBP = ctrlValue.split("/");
                Thread.sleep(2000);
                String yearEBP = dtMthYrEBP[2];
                String monthNumEBP = CalendarSnippet.getMonthForInt(Integer.parseInt(dtMthYrEBP[1]))
                        .substring(0, 3);
                String dayEBP = dtMthYrEBP[0];

                //common path used for most of the elements
                String pathToVisibleCalendar = "//div[@class='ajax__calendar'][contains(@style, 'visibility: visible;')]/div";

                //following is to click the title once to reach the year page
                wait.until(ExpectedConditions.elementToBeClickable(
                        By.xpath(pathToVisibleCalendar + "/div[@class='ajax__calendar_header']/div[3]/div")))
                        .click();
                //check if 'Dec' is visibly clickable after refreshing
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(
                        pathToVisibleCalendar + "/div/div/table/tbody/tr/td/div[contains(text(), 'Dec')]")));
                //following is to click the title once again to reach the year page
                Automation.driver
                        .findElement(By.xpath(
                                pathToVisibleCalendar + "/div[@class='ajax__calendar_header']/div[3]/div"))
                        .click();

                //common path used for most of the elements while selection of year, month and date
                pathToVisibleCalendar = "//div[@class='ajax__calendar'][contains(@style, 'visibility: visible;')]/div/div/div/table/tbody/tr/td";

                //each of the following line selects the year, month and date
                wait.until(ExpectedConditions.elementToBeClickable(
                        By.xpath(pathToVisibleCalendar + "/div[contains(text()," + yearEBP + ")]"))).click();
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(pathToVisibleCalendar
                        + "/div[@class='ajax__calendar_month'][contains(text(),'" + monthNumEBP + "')]")))
                        .click();
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(pathToVisibleCalendar
                        + "/div[@class='ajax__calendar_day'][contains(text()," + dayEBP + ")]"))).click();

                break;

            /**Code for window popups**/
            case Window:
                switch (actionName) {
                case O:
                    String parentHandle = Automation.driver.getWindowHandle();
                    for (String winHandle : Automation.driver.getWindowHandles()) {
                        Automation.driver.switchTo().window(winHandle);
                        if (Automation.driver.getTitle().equalsIgnoreCase(controlName)) {
                            Automation.driver.close();
                        }
                    }
                    Automation.driver.switchTo().window(parentHandle);
                    break;
                }
                break;

            case WebTable:
                switch (actionName) {
                case Read:
                    ReadFromExcel(ctrlValue);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case NC:
                    WebElement table = webElement;
                    List<WebElement> tableRows = table.findElements(By.tagName("tr"));
                    int tableRowIndex = 0;
                    //int tableColumnIndex = 0;
                    boolean matchFound = false;
                    for (WebElement tableRow : tableRows) {
                        tableRowIndex += 1;
                        List<WebElement> tableColumns = tableRow.findElements(By.tagName("td"));
                        if (tableColumns.size() > 0) {
                            for (WebElement tableColumn : tableColumns)
                                if (tableColumn.getText().equals(ctrlValue)) {
                                    matchFound = true;
                                    System.out.println(tableRowIndex);
                                    List<Object> elementProperties = getPropertiesOfWebElement(
                                            tableColumns.get(Integer.parseInt(colNo)), imageType);
                                    controlName = elementProperties.get(0).toString();
                                    if (controlName.equals("")) {
                                        controlName = elementProperties.get(1).toString();
                                    }
                                    controlType = elementProperties.get(2).toString();
                                    webElement = (WebElement) elementProperties.get(3);
                                    doAction(imageType, controlType, controlId, controlName, ctrlValue,
                                            logicalName, action, webElement, Results, strucSheet, valSheet,
                                            tableRowIndex, rowcount, rowNo, colNo);
                                    break;
                                }
                            if (matchFound) {
                                break;
                            }
                        }

                    }
                    break;
                case V:
                    WriteToDetailResults(ctrlValue, "", logicalName);
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    break;
                }
                break;

            case Robot:
                if (controlName.equalsIgnoreCase("SetFilePath")) {
                    StringSelection stringSelection = new StringSelection(ctrlValue);
                    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
                    robot.delay(1000);
                    robot.keyPress(KeyEvent.VK_CONTROL);
                    robot.keyPress(KeyEvent.VK_V);
                    robot.keyRelease(KeyEvent.VK_V);
                    robot.keyRelease(KeyEvent.VK_CONTROL);

                } else if (controlName.equalsIgnoreCase("TAB")) {
                    robot.keyPress(KeyEvent.VK_TAB);
                    robot.keyRelease(KeyEvent.VK_TAB);
                } else if (controlName.equalsIgnoreCase("SPACE")) {
                    robot.keyPress(KeyEvent.VK_SPACE);
                    robot.keyRelease(KeyEvent.VK_SPACE);
                } else if (controlName.equalsIgnoreCase("ENTER")) {
                    robot.keyPress(KeyEvent.VK_ENTER);
                    robot.keyRelease(KeyEvent.VK_ENTER);
                }
                break;

            case WaitForEC:
                wait.until(CommonExpectedConditions.elementToBeClickable(webElement));
                break;

            case SikuliType:
                sikuliScreen.type(controlName, ctrlValue);
                break;

            case SikuliButton:
                sikuliScreen.click(controlName);
                System.out.println("Done");
                break;

            case Date:
                Calendar cal = new GregorianCalendar();
                int i = cal.get(Calendar.DAY_OF_MONTH);
                if (i >= 31) {
                    i = i - 10;
                }
                break;

            case FileUpload:
                webElement.sendKeys(ctrlValue);
                break;

            case ScrollTo:
                Locatable element = (Locatable) webElement;
                Point p = element.getCoordinates().onScreen();
                JavascriptExecutor js = (JavascriptExecutor) Automation.driver;
                js.executeScript("window.scrollTo(" + p.getX() + "," + (p.getY() + 150) + ");");
                break;

            default:
                System.out.println("U r in Default");
                break;
            }
        } catch (WebDriverException we) {
            throw new Exception("Error Occurred from Do Action " + controlName + we.getMessage());
        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }
    }

    if (action.toString().equalsIgnoreCase("V") && !ctrlValue.equalsIgnoreCase("")) {
        if (Results == true) {
            SwiftSeleniumWeb.WebDriver.report = WriteToDetailResults(ctrlValue, currentValue, logicalName);
        }
    }

    return currentValue;

}

From source file:com.hexidec.ekit.EkitCore.java

/**
 * Master Constructor//  w  ww  . j av a2 s . com
 * 
 * @param sDocument
 *            [String] A text or HTML document to load in the editor upon
 *            startup.
 * @param sStyleSheet
 *            [String] A CSS stylesheet to load in the editor upon startup.
 * @param sRawDocument
 *            [String] A document encoded as a String to load in the editor
 *            upon startup.
 * @param sdocSource
 *            [StyledDocument] Optional document specification, using
 *            javax.swing.text.StyledDocument.
 * @param urlStyleSheet
 *            [URL] A URL reference to the CSS style sheet.
 * @param includeToolBar
 *            [boolean] Specifies whether the app should include the
 *            toolbar(s).
 * @param showViewSource
 *            [boolean] Specifies whether or not to show the View Source
 *            window on startup.
 * @param showMenuIcons
 *            [boolean] Specifies whether or not to show icon pictures in
 *            menus.
 * @param sLanguage
 *            [String] The language portion of the Internationalization
 *            Locale to run Ekit in.
 * @param sCountry
 *            [String] The country portion of the Internationalization
 *            Locale to run Ekit in.
 * @param base64
 *            [boolean] Specifies whether the raw document is Base64 encoded
 *            or not.
 * @param debugMode
 *            [boolean] Specifies whether to show the Debug menu or not.
 * @param hasSpellChecker
 *            [boolean] Specifies whether or not this uses the SpellChecker
 *            module
 * @param multiBar
 *            [boolean] Specifies whether to use multiple toolbars or one
 *            big toolbar.
 * @param toolbarSeq
 *            [String] Code string specifying the toolbar buttons to show.
 * @param keepUnknownTags
 *            [boolean] Specifies whether or not the parser should retain
 *            unknown tags.
 * @param enterBreak
 *            [boolean] Specifies whether the ENTER key should insert breaks
 *            instead of paragraph tags.
 * @param inlineEdit
 *            [boolean] Should edit inline content only (no line breaks)
 */
public EkitCore(boolean isParentApplet, String sDocument, String sStyleSheet, String sRawDocument,
        StyledDocument sdocSource, URL urlStyleSheet, boolean includeToolBar, boolean showViewSource,
        boolean showMenuIcons, String sLanguage, String sCountry, boolean base64, boolean debugMode,
        boolean hasSpellChecker, boolean multiBar, String toolbarSeq, boolean keepUnknownTags,
        boolean enterBreak, boolean inlineEdit, List<HTMLDocumentBehavior> behaviors) {
    super();

    if (behaviors != null) {
        this.behaviors.addAll(behaviors);
    }

    preserveUnknownTags = keepUnknownTags;
    enterIsBreak = enterBreak;
    this.inlineEdit = inlineEdit;

    frameHandler = new Frame();

    // Determine if system clipboard is available (SecurityManager version)
    /*
     * SecurityManager secManager = System.getSecurityManager();
     * if(secManager != null) { try {
     * secManager.checkSystemClipboardAccess(); sysClipboard =
     * Toolkit.getDefaultToolkit().getSystemClipboard(); }
     * catch(SecurityException se) { sysClipboard = null; } }
     */

    // Obtain system clipboard if available
    try {
        sysClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    } catch (Exception ex) {
        sysClipboard = null;
    }

    // Plain text DataFlavor for unformatted paste
    try {
        dfPlainText = new DataFlavor("text/plain; class=java.lang.String; charset=Unicode"); // Charsets
        // usually
        // available
        // include
        // Unicode,
        // UTF-16,
        // UTF-8,
        // &
        // US-ASCII
    } catch (ClassNotFoundException cnfe) {
        // it would be nice to use DataFlavor.plainTextFlavor, but that is
        // deprecated
        // this will not work as desired, but it will prevent errors from
        // being thrown later
        // alternately, we could flag up here that Unformatted Paste is not
        // available and adjust the UI accordingly
        // however, the odds of java.lang.String not being found are pretty
        // slim one imagines
        dfPlainText = DataFlavor.stringFlavor;
    }

    /* Localize for language */
    Locale baseLocale = Locale.getDefault();
    if (sLanguage != null && sCountry != null) {
        baseLocale = new Locale(sLanguage, sCountry);
    }
    Translatrix.init("EkitLanguageResources", baseLocale);

    /* Initialise system-specific control key value */
    if (!(GraphicsEnvironment.isHeadless())) {
        CTRLKEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    }

    /* Create the editor kit, document, and stylesheet */
    jtpMain = new EkitTextPane();
    htmlKit = new ExtendedHTMLEditorKit();
    htmlDoc = (ExtendedHTMLDocument) (htmlKit.createDefaultDocument());
    htmlDoc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
    htmlDoc.setPreservesUnknownTags(preserveUnknownTags);
    styleSheet = htmlDoc.getStyleSheet();
    htmlKit.setDefaultCursor(new Cursor(Cursor.TEXT_CURSOR));
    jtpMain.setCursor(new Cursor(Cursor.TEXT_CURSOR));

    /* Set up the text pane */
    jtpMain.setEditorKit(htmlKit);
    jtpMain.setDocument(htmlDoc);
    //      jtpMain.addMouseMotionListener(new EkitMouseMotionListener());
    jtpMain.addFocusListener(this);
    jtpMain.setMargin(new Insets(4, 4, 4, 4));
    jtpMain.addKeyListener(this);
    // jtpMain.setDragEnabled(true); // this causes an error in older Java
    // versions

    /* Create the source text area */
    if (sdocSource == null) {
        jtpSource = new JTextArea();
        jtpSource.setText(jtpMain.getText());
    } else {
        jtpSource = new JTextArea(sdocSource);
        jtpMain.setText(jtpSource.getText());
    }
    jtpSource.setBackground(new Color(212, 212, 212));
    jtpSource.setSelectionColor(new Color(255, 192, 192));
    jtpSource.setMargin(new Insets(4, 4, 4, 4));
    jtpSource.getDocument().addDocumentListener(this);
    jtpSource.addFocusListener(this);
    jtpSource.setCursor(new Cursor(Cursor.TEXT_CURSOR));
    jtpSource.setColumns(1024);
    jtpSource.setEditable(false);

    /* Add CaretListener for tracking caret location events */
    jtpMain.addCaretListener(new CaretListener() {
        public void caretUpdate(CaretEvent ce) {
            handleCaretPositionChange(ce);
        }
    });

    // Default text
    if (!inlineEdit) {
        setDocumentText("<p></p>");
    }

    /* Set up the undo features */
    undoMngr = new UndoManager();
    undoAction = new UndoAction();
    redoAction = new RedoAction();
    jtpMain.getDocument().addUndoableEditListener(new CustomUndoableEditListener());

    /* Insert raw document, if exists */
    if (sRawDocument != null && sRawDocument.length() > 0) {
        if (base64) {
            jtpMain.setText(Base64Codec.decode(sRawDocument));
        } else {
            jtpMain.setText(sRawDocument);
        }
    }
    jtpMain.setCaretPosition(0);
    jtpMain.getDocument().addDocumentListener(this);

    /* Import CSS from reference, if exists */
    if (urlStyleSheet != null) {
        try {
            String currDocText = jtpMain.getText();
            htmlDoc = (ExtendedHTMLDocument) (htmlKit.createDefaultDocument());
            htmlDoc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
            htmlDoc.setPreservesUnknownTags(preserveUnknownTags);
            styleSheet = htmlDoc.getStyleSheet();
            BufferedReader br = new BufferedReader(new InputStreamReader(urlStyleSheet.openStream()));
            styleSheet.loadRules(br, urlStyleSheet);
            br.close();
            htmlDoc = new ExtendedHTMLDocument(styleSheet);
            registerDocument(htmlDoc);
            jtpMain.setText(currDocText);
            jtpSource.setText(jtpMain.getText());
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    /* Preload the specified HTML document, if exists */
    if (sDocument != null) {
        File defHTML = new File(sDocument);
        if (defHTML.exists()) {
            try {
                openDocument(defHTML);
            } catch (Exception e) {
                logException("Exception in preloading HTML document", e);
            }
        }
    }

    /* Preload the specified CSS document, if exists */
    if (sStyleSheet != null) {
        File defCSS = new File(sStyleSheet);
        if (defCSS.exists()) {
            try {
                openStyleSheet(defCSS);
            } catch (Exception e) {
                logException("Exception in preloading CSS stylesheet", e);
            }
        }
    }

    /* Collect the actions that the JTextPane is naturally aware of */
    Hashtable<Object, Action> actions = new Hashtable<Object, Action>();
    Action[] actionsArray = jtpMain.getActions();
    for (Action a : actionsArray) {
        actions.put(a.getValue(Action.NAME), a);
    }

    /* Create shared actions */
    actionFontBold = new StyledEditorKit.BoldAction();
    actionFontItalic = new StyledEditorKit.ItalicAction();
    actionFontUnderline = new StyledEditorKit.UnderlineAction();
    actionFontStrike = new FormatAction(this, Translatrix.getTranslationString("FontStrike"), HTML.Tag.STRIKE);
    actionFontSuperscript = new FormatAction(this, Translatrix.getTranslationString("FontSuperscript"),
            HTML.Tag.SUP);
    actionFontSubscript = new FormatAction(this, Translatrix.getTranslationString("FontSubscript"),
            HTML.Tag.SUB);
    actionListUnordered = new ListAutomationAction(this, Translatrix.getTranslationString("ListUnordered"),
            HTML.Tag.UL);
    actionListOrdered = new ListAutomationAction(this, Translatrix.getTranslationString("ListOrdered"),
            HTML.Tag.OL);
    actionSelectFont = new SetFontFamilyAction(this, "[MENUFONTSELECTOR]");
    actionAlignLeft = new AlignmentAction(Translatrix.getTranslationString("AlignLeft"),
            StyleConstants.ALIGN_LEFT);
    actionAlignCenter = new AlignmentAction(Translatrix.getTranslationString("AlignCenter"),
            StyleConstants.ALIGN_CENTER);
    actionAlignRight = new AlignmentAction(Translatrix.getTranslationString("AlignRight"),
            StyleConstants.ALIGN_RIGHT);
    actionAlignJustified = new AlignmentAction(Translatrix.getTranslationString("AlignJustified"),
            StyleConstants.ALIGN_JUSTIFIED);
    actionInsertAnchor = new CustomAction(this, Translatrix.getTranslationString("InsertAnchor") + menuDialog,
            HTML.Tag.A);
    actionClearFormat = new ClearFormatAction(this);
    actionSpecialChar = new SpecialCharAction(this);

    // actionTableButtonMenu
    Action actionTableInsert = new CommandAction(Translatrix.getTranslationString("InsertTable") + menuDialog,
            getEkitIcon("TableCreate"), CMD_TABLE_INSERT, this);
    Action actionTableDelete = new CommandAction(Translatrix.getTranslationString("DeleteTable"),
            getEkitIcon("TableDelete"), CMD_TABLE_DELETE, this);
    Action actionTableRow = new CommandAction(Translatrix.getTranslationString("InsertTableRow"),
            getEkitIcon("InsertRow"), CMD_TABLE_ROW_INSERT, this);
    Action actionTableRowAfter = new CommandAction(Translatrix.getTranslationString("InsertTableRowAfter"),
            getEkitIcon("InsertRowAfter"), CMD_TABLE_ROW_INSERT_AFTER, this);
    Action actionTableCol = new CommandAction(Translatrix.getTranslationString("InsertTableColumn"),
            getEkitIcon("InsertColumn"), CMD_TABLE_COLUMN_INSERT, this);
    Action actionTableColAfter = new CommandAction(Translatrix.getTranslationString("InsertTableColumnAfter"),
            getEkitIcon("InsertColumnAfter"), CMD_TABLE_COLUMN_INSERT_AFTER, this);
    Action actionTableRowDel = new CommandAction(Translatrix.getTranslationString("DeleteTableRow"),
            getEkitIcon("DeleteRow"), CMD_TABLE_ROW_DELETE, this);
    Action actionTableColDel = new CommandAction(Translatrix.getTranslationString("DeleteTableColumn"),
            getEkitIcon("DeleteColumn"), CMD_TABLE_COLUMN_DELETE, this);
    Action actionTableColFmt = new CommandAction(Translatrix.getTranslationString("FormatTableColumn"),
            getEkitIcon("FormatColumn"), CMD_TABLE_COLUMN_FORMAT, this);
    actionTableButtonMenu = new ButtonMenuAction(Translatrix.getTranslationString("TableMenu"),
            getEkitIcon("TableMenu"), actionTableInsert, actionTableDelete, null, actionTableRow,
            actionTableRowAfter, actionTableCol, actionTableColAfter, null, actionTableRowDel,
            actionTableColDel, null, actionTableColFmt);

    /* Build the menus */
    /* FILE Menu */
    jMenuFile = new JMenu(Translatrix.getTranslationString("File"));
    htMenus.put(KEY_MENU_FILE, jMenuFile);
    JMenuItem jmiNew = new JMenuItem(Translatrix.getTranslationString("NewDocument"));
    jmiNew.setActionCommand(CMD_DOC_NEW);
    jmiNew.addActionListener(this);
    jmiNew.setAccelerator(KeyStroke.getKeyStroke('N', CTRLKEY, false));
    if (showMenuIcons) {
        jmiNew.setIcon(getEkitIcon("New"));
    }
    ;
    jMenuFile.add(jmiNew);
    JMenuItem jmiNewStyled = new JMenuItem(Translatrix.getTranslationString("NewStyledDocument"));
    jmiNewStyled.setActionCommand(CMD_DOC_NEW_STYLED);
    jmiNewStyled.addActionListener(this);
    if (showMenuIcons) {
        jmiNewStyled.setIcon(getEkitIcon("NewStyled"));
    }
    ;
    jMenuFile.add(jmiNewStyled);
    JMenuItem jmiOpenHTML = new JMenuItem(Translatrix.getTranslationString("OpenDocument") + menuDialog);
    jmiOpenHTML.setActionCommand(CMD_DOC_OPEN_HTML);
    jmiOpenHTML.addActionListener(this);
    jmiOpenHTML.setAccelerator(KeyStroke.getKeyStroke('O', CTRLKEY, false));
    if (showMenuIcons) {
        jmiOpenHTML.setIcon(getEkitIcon("Open"));
    }
    ;
    jMenuFile.add(jmiOpenHTML);
    JMenuItem jmiOpenCSS = new JMenuItem(Translatrix.getTranslationString("OpenStyle") + menuDialog);
    jmiOpenCSS.setActionCommand(CMD_DOC_OPEN_CSS);
    jmiOpenCSS.addActionListener(this);
    jMenuFile.add(jmiOpenCSS);
    jMenuFile.addSeparator();
    JMenuItem jmiSave = new JMenuItem(Translatrix.getTranslationString("Save"));
    jmiSave.setActionCommand(CMD_DOC_SAVE);
    jmiSave.addActionListener(this);
    jmiSave.setAccelerator(KeyStroke.getKeyStroke('S', CTRLKEY, false));
    if (showMenuIcons) {
        jmiSave.setIcon(getEkitIcon("Save"));
    }
    ;
    jMenuFile.add(jmiSave);
    JMenuItem jmiSaveAs = new JMenuItem(Translatrix.getTranslationString("SaveAs") + menuDialog);
    jmiSaveAs.setActionCommand(CMD_DOC_SAVE_AS);
    jmiSaveAs.addActionListener(this);
    jMenuFile.add(jmiSaveAs);
    JMenuItem jmiSaveBody = new JMenuItem(Translatrix.getTranslationString("SaveBody") + menuDialog);
    jmiSaveBody.setActionCommand(CMD_DOC_SAVE_BODY);
    jmiSaveBody.addActionListener(this);
    jMenuFile.add(jmiSaveBody);
    JMenuItem jmiSaveRTF = new JMenuItem(Translatrix.getTranslationString("SaveRTF") + menuDialog);
    jmiSaveRTF.setActionCommand(CMD_DOC_SAVE_RTF);
    jmiSaveRTF.addActionListener(this);
    jMenuFile.add(jmiSaveRTF);
    jMenuFile.addSeparator();
    JMenuItem jmiPrint = new JMenuItem(Translatrix.getTranslationString("Print"));
    jmiPrint.setActionCommand(CMD_DOC_PRINT);
    jmiPrint.addActionListener(this);
    jMenuFile.add(jmiPrint);
    jMenuFile.addSeparator();
    JMenuItem jmiSerialOut = new JMenuItem(Translatrix.getTranslationString("Serialize") + menuDialog);
    jmiSerialOut.setActionCommand(CMD_DOC_SERIALIZE_OUT);
    jmiSerialOut.addActionListener(this);
    jMenuFile.add(jmiSerialOut);
    JMenuItem jmiSerialIn = new JMenuItem(Translatrix.getTranslationString("ReadFromSer") + menuDialog);
    jmiSerialIn.setActionCommand(CMD_DOC_SERIALIZE_IN);
    jmiSerialIn.addActionListener(this);
    jMenuFile.add(jmiSerialIn);
    jMenuFile.addSeparator();
    JMenuItem jmiExit = new JMenuItem(Translatrix.getTranslationString("Exit"));
    jmiExit.setActionCommand(CMD_EXIT);
    jmiExit.addActionListener(this);
    jMenuFile.add(jmiExit);

    /* EDIT Menu */
    jMenuEdit = new JMenu(Translatrix.getTranslationString("Edit"));
    htMenus.put(KEY_MENU_EDIT, jMenuEdit);
    if (sysClipboard != null) {
        // System Clipboard versions of menu commands
        JMenuItem jmiCut = new JMenuItem(Translatrix.getTranslationString("Cut"));
        jmiCut.setActionCommand(CMD_CLIP_CUT);
        jmiCut.addActionListener(this);
        jmiCut.setAccelerator(KeyStroke.getKeyStroke('X', CTRLKEY, false));
        if (showMenuIcons) {
            jmiCut.setIcon(getEkitIcon("Cut"));
        }
        jMenuEdit.add(jmiCut);
        JMenuItem jmiCopy = new JMenuItem(Translatrix.getTranslationString("Copy"));
        jmiCopy.setActionCommand(CMD_CLIP_COPY);
        jmiCopy.addActionListener(this);
        jmiCopy.setAccelerator(KeyStroke.getKeyStroke('C', CTRLKEY, false));
        if (showMenuIcons) {
            jmiCopy.setIcon(getEkitIcon("Copy"));
        }
        jMenuEdit.add(jmiCopy);
        JMenuItem jmiPaste = new JMenuItem(Translatrix.getTranslationString("Paste"));
        jmiPaste.setActionCommand(CMD_CLIP_PASTE);
        jmiPaste.addActionListener(this);
        jmiPaste.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY, false));
        if (showMenuIcons) {
            jmiPaste.setIcon(getEkitIcon("Paste"));
        }
        jMenuEdit.add(jmiPaste);
        JMenuItem jmiPasteX = new JMenuItem(Translatrix.getTranslationString("PasteUnformatted"));
        jmiPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN);
        jmiPasteX.addActionListener(this);
        jmiPasteX.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY + KeyEvent.SHIFT_MASK, false));
        if (showMenuIcons) {
            jmiPasteX.setIcon(getEkitIcon("PasteUnformatted"));
        }
        jMenuEdit.add(jmiPasteX);
    } else {
        // DefaultEditorKit versions of menu commands
        JMenuItem jmiCut = new JMenuItem(new DefaultEditorKit.CutAction());
        jmiCut.setText(Translatrix.getTranslationString("Cut"));
        jmiCut.setAccelerator(KeyStroke.getKeyStroke('X', CTRLKEY, false));
        if (showMenuIcons) {
            jmiCut.setIcon(getEkitIcon("Cut"));
        }
        jMenuEdit.add(jmiCut);
        JMenuItem jmiCopy = new JMenuItem(new DefaultEditorKit.CopyAction());
        jmiCopy.setText(Translatrix.getTranslationString("Copy"));
        jmiCopy.setAccelerator(KeyStroke.getKeyStroke('C', CTRLKEY, false));
        if (showMenuIcons) {
            jmiCopy.setIcon(getEkitIcon("Copy"));
        }
        jMenuEdit.add(jmiCopy);
        JMenuItem jmiPaste = new JMenuItem(new DefaultEditorKit.PasteAction());
        jmiPaste.setText(Translatrix.getTranslationString("Paste"));
        jmiPaste.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY, false));
        if (showMenuIcons) {
            jmiPaste.setIcon(getEkitIcon("Paste"));
        }
        jMenuEdit.add(jmiPaste);
        JMenuItem jmiPasteX = new JMenuItem(Translatrix.getTranslationString("PasteUnformatted"));
        jmiPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN);
        jmiPasteX.addActionListener(this);
        jmiPasteX.setAccelerator(KeyStroke.getKeyStroke('V', CTRLKEY + KeyEvent.SHIFT_MASK, false));
        if (showMenuIcons) {
            jmiPasteX.setIcon(getEkitIcon("PasteUnformatted"));
        }
        jMenuEdit.add(jmiPasteX);
    }
    jMenuEdit.addSeparator();
    JMenuItem jmiUndo = new JMenuItem(undoAction);
    jmiUndo.setAccelerator(KeyStroke.getKeyStroke('Z', CTRLKEY, false));
    if (showMenuIcons) {
        jmiUndo.setIcon(getEkitIcon("Undo"));
    }
    jMenuEdit.add(jmiUndo);
    JMenuItem jmiRedo = new JMenuItem(redoAction);
    jmiRedo.setAccelerator(KeyStroke.getKeyStroke('Y', CTRLKEY, false));
    if (showMenuIcons) {
        jmiRedo.setIcon(getEkitIcon("Redo"));
    }
    jMenuEdit.add(jmiRedo);
    jMenuEdit.addSeparator();
    JMenuItem jmiSelAll = new JMenuItem((Action) actions.get(DefaultEditorKit.selectAllAction));
    jmiSelAll.setText(Translatrix.getTranslationString("SelectAll"));
    jmiSelAll.setAccelerator(KeyStroke.getKeyStroke('A', CTRLKEY, false));
    jMenuEdit.add(jmiSelAll);
    JMenuItem jmiSelPara = new JMenuItem((Action) actions.get(DefaultEditorKit.selectParagraphAction));
    jmiSelPara.setText(Translatrix.getTranslationString("SelectParagraph"));
    jMenuEdit.add(jmiSelPara);
    JMenuItem jmiSelLine = new JMenuItem((Action) actions.get(DefaultEditorKit.selectLineAction));
    jmiSelLine.setText(Translatrix.getTranslationString("SelectLine"));
    jMenuEdit.add(jmiSelLine);
    JMenuItem jmiSelWord = new JMenuItem((Action) actions.get(DefaultEditorKit.selectWordAction));
    jmiSelWord.setText(Translatrix.getTranslationString("SelectWord"));
    jMenuEdit.add(jmiSelWord);
    jMenuEdit.addSeparator();
    JMenu jMenuEnterKey = new JMenu(Translatrix.getTranslationString("EnterKeyMenu"));
    jcbmiEnterKeyParag = new JCheckBoxMenuItem(Translatrix.getTranslationString("EnterKeyParag"),
            !enterIsBreak);
    jcbmiEnterKeyParag.setActionCommand(CMD_ENTER_PARAGRAPH);
    jcbmiEnterKeyParag.addActionListener(this);
    jMenuEnterKey.add(jcbmiEnterKeyParag);
    jcbmiEnterKeyBreak = new JCheckBoxMenuItem(Translatrix.getTranslationString("EnterKeyBreak"), enterIsBreak);
    jcbmiEnterKeyBreak.setActionCommand(CMD_ENTER_BREAK);
    jcbmiEnterKeyBreak.addActionListener(this);
    jMenuEnterKey.add(jcbmiEnterKeyBreak);
    jMenuEdit.add(jMenuEnterKey);

    /* VIEW Menu */
    jMenuView = new JMenu(Translatrix.getTranslationString("View"));
    htMenus.put(KEY_MENU_VIEW, jMenuView);
    if (includeToolBar) {
        if (multiBar) {
            jMenuToolbars = new JMenu(Translatrix.getTranslationString("ViewToolbars"));

            jcbmiViewToolbarMain = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewToolbarMain"),
                    false);
            jcbmiViewToolbarMain.setActionCommand(CMD_TOGGLE_TOOLBAR_MAIN);
            jcbmiViewToolbarMain.addActionListener(this);
            jMenuToolbars.add(jcbmiViewToolbarMain);

            jcbmiViewToolbarFormat = new JCheckBoxMenuItem(
                    Translatrix.getTranslationString("ViewToolbarFormat"), false);
            jcbmiViewToolbarFormat.setActionCommand(CMD_TOGGLE_TOOLBAR_FORMAT);
            jcbmiViewToolbarFormat.addActionListener(this);
            jMenuToolbars.add(jcbmiViewToolbarFormat);

            jcbmiViewToolbarStyles = new JCheckBoxMenuItem(
                    Translatrix.getTranslationString("ViewToolbarStyles"), false);
            jcbmiViewToolbarStyles.setActionCommand(CMD_TOGGLE_TOOLBAR_STYLES);
            jcbmiViewToolbarStyles.addActionListener(this);
            jMenuToolbars.add(jcbmiViewToolbarStyles);

            jMenuView.add(jMenuToolbars);
        } else {
            jcbmiViewToolbar = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewToolbar"), false);
            jcbmiViewToolbar.setActionCommand(CMD_TOGGLE_TOOLBAR_SINGLE);
            jcbmiViewToolbar.addActionListener(this);

            jMenuView.add(jcbmiViewToolbar);
        }
    }
    jcbmiViewSource = new JCheckBoxMenuItem(Translatrix.getTranslationString("ViewSource"), false);
    jcbmiViewSource.setActionCommand(CMD_TOGGLE_SOURCE_VIEW);
    jcbmiViewSource.addActionListener(this);
    jMenuView.add(jcbmiViewSource);

    /* FONT Menu */
    jMenuFont = new JMenu(Translatrix.getTranslationString("Font"));
    htMenus.put(KEY_MENU_FONT, jMenuFont);
    JMenuItem jmiBold = new JMenuItem(actionFontBold);
    jmiBold.setText(Translatrix.getTranslationString("FontBold"));
    jmiBold.setAccelerator(KeyStroke.getKeyStroke('B', CTRLKEY, false));
    if (showMenuIcons) {
        jmiBold.setIcon(getEkitIcon("Bold"));
    }
    jMenuFont.add(jmiBold);
    JMenuItem jmiItalic = new JMenuItem(actionFontItalic);
    jmiItalic.setText(Translatrix.getTranslationString("FontItalic"));
    jmiItalic.setAccelerator(KeyStroke.getKeyStroke('I', CTRLKEY, false));
    if (showMenuIcons) {
        jmiItalic.setIcon(getEkitIcon("Italic"));
    }
    jMenuFont.add(jmiItalic);
    JMenuItem jmiUnderline = new JMenuItem(actionFontUnderline);
    jmiUnderline.setText(Translatrix.getTranslationString("FontUnderline"));
    jmiUnderline.setAccelerator(KeyStroke.getKeyStroke('U', CTRLKEY, false));
    if (showMenuIcons) {
        jmiUnderline.setIcon(getEkitIcon("Underline"));
    }
    jMenuFont.add(jmiUnderline);
    JMenuItem jmiStrike = new JMenuItem(actionFontStrike);
    jmiStrike.setText(Translatrix.getTranslationString("FontStrike"));
    if (showMenuIcons) {
        jmiStrike.setIcon(getEkitIcon("Strike"));
    }
    jMenuFont.add(jmiStrike);
    JMenuItem jmiSupscript = new JMenuItem(actionFontSuperscript);
    if (showMenuIcons) {
        jmiSupscript.setIcon(getEkitIcon("Super"));
    }
    jMenuFont.add(jmiSupscript);
    JMenuItem jmiSubscript = new JMenuItem(actionFontSubscript);
    if (showMenuIcons) {
        jmiSubscript.setIcon(getEkitIcon("Sub"));
    }
    jMenuFont.add(jmiSubscript);
    jMenuFont.addSeparator();
    jMenuFont.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatBig"), HTML.Tag.BIG)));
    jMenuFont.add(new JMenuItem(
            new FormatAction(this, Translatrix.getTranslationString("FormatSmall"), HTML.Tag.SMALL)));
    JMenu jMenuFontSize = new JMenu(Translatrix.getTranslationString("FontSize"));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize1"), 8)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize2"), 10)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize3"), 12)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize4"), 14)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize5"), 18)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize6"), 24)));
    jMenuFontSize.add(new JMenuItem(
            new StyledEditorKit.FontSizeAction(Translatrix.getTranslationString("FontSize7"), 32)));
    jMenuFont.add(jMenuFontSize);
    jMenuFont.addSeparator();
    JMenu jMenuFontSub = new JMenu(Translatrix.getTranslationString("Font"));
    JMenuItem jmiSelectFont = new JMenuItem(actionSelectFont);
    jmiSelectFont.setText(Translatrix.getTranslationString("FontSelect") + menuDialog);
    if (showMenuIcons) {
        jmiSelectFont.setIcon(getEkitIcon("FontFaces"));
    }
    jMenuFontSub.add(jmiSelectFont);
    JMenuItem jmiSerif = new JMenuItem((Action) actions.get("font-family-Serif"));
    jmiSerif.setText(Translatrix.getTranslationString("FontSerif"));
    jMenuFontSub.add(jmiSerif);
    JMenuItem jmiSansSerif = new JMenuItem((Action) actions.get("font-family-SansSerif"));
    jmiSansSerif.setText(Translatrix.getTranslationString("FontSansserif"));
    jMenuFontSub.add(jmiSansSerif);
    JMenuItem jmiMonospaced = new JMenuItem((Action) actions.get("font-family-Monospaced"));
    jmiMonospaced.setText(Translatrix.getTranslationString("FontMonospaced"));
    jMenuFontSub.add(jmiMonospaced);
    jMenuFont.add(jMenuFontSub);
    jMenuFont.addSeparator();
    JMenu jMenuFontColor = new JMenu(Translatrix.getTranslationString("Color"));
    Hashtable<String, String> customAttr = new Hashtable<String, String>();
    customAttr.put("color", "black");
    jMenuFontColor.add(new JMenuItem(new CustomAction(this,
            Translatrix.getTranslationString("CustomColor") + menuDialog, HTML.Tag.FONT, customAttr)));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorAqua"), new Color(0, 255, 255))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorBlack"), new Color(0, 0, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorBlue"), new Color(0, 0, 255))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorFuschia"), new Color(255, 0, 255))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorGray"), new Color(128, 128, 128))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorGreen"), new Color(0, 128, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorLime"), new Color(0, 255, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorMaroon"), new Color(128, 0, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorNavy"), new Color(0, 0, 128))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorOlive"), new Color(128, 128, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorPurple"), new Color(128, 0, 128))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorRed"), new Color(255, 0, 0))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorSilver"), new Color(192, 192, 192))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorTeal"), new Color(0, 128, 128))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorWhite"), new Color(255, 255, 255))));
    jMenuFontColor.add(new JMenuItem(new StyledEditorKit.ForegroundAction(
            Translatrix.getTranslationString("ColorYellow"), new Color(255, 255, 0))));
    jMenuFont.add(jMenuFontColor);

    /* FORMAT Menu */
    jMenuFormat = new JMenu(Translatrix.getTranslationString("Format"));
    htMenus.put(KEY_MENU_FORMAT, jMenuFormat);
    JMenuItem jmiClearFormat = new JMenuItem(actionClearFormat);
    jMenuFormat.add(jmiClearFormat);
    jMenuFormat.addSeparator();
    JMenu jMenuFormatAlign = new JMenu(Translatrix.getTranslationString("Align"));
    JMenuItem jmiAlignLeft = new JMenuItem(actionAlignLeft);
    if (showMenuIcons) {
        jmiAlignLeft.setIcon(getEkitIcon("AlignLeft"));
    }
    ;
    jMenuFormatAlign.add(jmiAlignLeft);
    JMenuItem jmiAlignCenter = new JMenuItem(actionAlignCenter);
    if (showMenuIcons) {
        jmiAlignCenter.setIcon(getEkitIcon("AlignCenter"));
    }
    ;
    jMenuFormatAlign.add(jmiAlignCenter);
    JMenuItem jmiAlignRight = new JMenuItem(actionAlignRight);
    if (showMenuIcons) {
        jmiAlignRight.setIcon(getEkitIcon("AlignRight"));
    }
    ;
    jMenuFormatAlign.add(jmiAlignRight);
    JMenuItem jmiAlignJustified = new JMenuItem(actionAlignJustified);
    if (showMenuIcons) {
        jmiAlignJustified.setIcon(getEkitIcon("AlignJustified"));
    }
    ;
    jMenuFormatAlign.add(jmiAlignJustified);
    jMenuFormat.add(jMenuFormatAlign);
    jMenuFormat.addSeparator();
    JMenu jMenuFormatHeading = new JMenu(Translatrix.getTranslationString("Heading"));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading1"), HTML.Tag.H1)));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading2"), HTML.Tag.H2)));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading3"), HTML.Tag.H3)));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading4"), HTML.Tag.H4)));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading5"), HTML.Tag.H5)));
    jMenuFormatHeading.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("Heading6"), HTML.Tag.H6)));
    jMenuFormat.add(jMenuFormatHeading);
    jMenuFormat.addSeparator();
    JMenuItem jmiUList = new JMenuItem(actionListUnordered);
    if (showMenuIcons) {
        jmiUList.setIcon(getEkitIcon("UList"));
    }
    jMenuFormat.add(jmiUList);
    JMenuItem jmiOList = new JMenuItem(actionListOrdered);
    if (showMenuIcons) {
        jmiOList.setIcon(getEkitIcon("OList"));
    }
    jMenuFormat.add(jmiOList);
    jMenuFormat.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("ListItem"), HTML.Tag.LI)));
    jMenuFormat.addSeparator();
    jMenuFormat.add(new JMenuItem(
            new FormatAction(this, Translatrix.getTranslationString("FormatBlockquote"), HTML.Tag.BLOCKQUOTE)));
    jMenuFormat.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatPre"), HTML.Tag.PRE)));
    jMenuFormat.add(new JMenuItem(
            new FormatAction(this, Translatrix.getTranslationString("FormatStrong"), HTML.Tag.STRONG)));
    jMenuFormat.add(new JMenuItem(
            new FormatAction(this, Translatrix.getTranslationString("FormatEmphasis"), HTML.Tag.EM)));
    jMenuFormat.add(
            new JMenuItem(new FormatAction(this, Translatrix.getTranslationString("FormatTT"), HTML.Tag.TT)));
    jMenuFormat.add(new JMenuItem(
            new FormatAction(this, Translatrix.getTranslationString("FormatSpan"), HTML.Tag.SPAN)));

    /* INSERT Menu */
    jMenuInsert = new JMenu(Translatrix.getTranslationString("Insert"));
    htMenus.put(KEY_MENU_INSERT, jMenuInsert);
    JMenuItem jmiInsertAnchor = new JMenuItem(actionInsertAnchor);
    if (showMenuIcons) {
        jmiInsertAnchor.setIcon(getEkitIcon("Anchor"));
    }
    ;
    jMenuInsert.add(jmiInsertAnchor);
    JMenuItem jmiBreak = new JMenuItem(Translatrix.getTranslationString("InsertBreak"));
    jmiBreak.setActionCommand(CMD_INSERT_BREAK);
    jmiBreak.addActionListener(this);
    jmiBreak.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK, false));
    jMenuInsert.add(jmiBreak);
    JMenuItem jmiNBSP = new JMenuItem(Translatrix.getTranslationString("InsertNBSP"));
    jmiNBSP.setActionCommand(CMD_INSERT_NBSP);
    jmiNBSP.addActionListener(this);
    jmiNBSP.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.SHIFT_MASK, false));
    jMenuInsert.add(jmiNBSP);
    JMenu jMenuUnicode = new JMenu(Translatrix.getTranslationString("InsertUnicodeCharacter"));
    if (showMenuIcons) {
        jMenuUnicode.setIcon(getEkitIcon("Unicode"));
    }
    ;
    JMenuItem jmiUnicodeAll = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterAll") + menuDialog);
    if (showMenuIcons) {
        jmiUnicodeAll.setIcon(getEkitIcon("Unicode"));
    }
    ;
    jmiUnicodeAll.setActionCommand(CMD_INSERT_UNICODE_CHAR);
    jmiUnicodeAll.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeAll);
    JMenuItem jmiUnicodeMath = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterMath") + menuDialog);
    if (showMenuIcons) {
        jmiUnicodeMath.setIcon(getEkitIcon("Math"));
    }
    ;
    jmiUnicodeMath.setActionCommand(CMD_INSERT_UNICODE_MATH);
    jmiUnicodeMath.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeMath);
    JMenuItem jmiUnicodeDraw = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterDraw") + menuDialog);
    if (showMenuIcons) {
        jmiUnicodeDraw.setIcon(getEkitIcon("Draw"));
    }
    ;
    jmiUnicodeDraw.setActionCommand(CMD_INSERT_UNICODE_DRAW);
    jmiUnicodeDraw.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeDraw);
    JMenuItem jmiUnicodeDing = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterDing") + menuDialog);
    jmiUnicodeDing.setActionCommand(CMD_INSERT_UNICODE_DING);
    jmiUnicodeDing.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeDing);
    JMenuItem jmiUnicodeSigs = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterSigs") + menuDialog);
    jmiUnicodeSigs.setActionCommand(CMD_INSERT_UNICODE_SIGS);
    jmiUnicodeSigs.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeSigs);
    JMenuItem jmiUnicodeSpec = new JMenuItem(
            Translatrix.getTranslationString("InsertUnicodeCharacterSpec") + menuDialog);
    jmiUnicodeSpec.setActionCommand(CMD_INSERT_UNICODE_SPEC);
    jmiUnicodeSpec.addActionListener(this);
    jMenuUnicode.add(jmiUnicodeSpec);
    jMenuInsert.add(jMenuUnicode);
    JMenuItem jmiHRule = new JMenuItem(Translatrix.getTranslationString("InsertHorizontalRule"));
    jmiHRule.setActionCommand(CMD_INSERT_HR);
    jmiHRule.addActionListener(this);
    jMenuInsert.add(jmiHRule);
    jMenuInsert.addSeparator();
    if (!isParentApplet) {
        JMenuItem jmiImageLocal = new JMenuItem(
                Translatrix.getTranslationString("InsertLocalImage") + menuDialog);
        jmiImageLocal.setActionCommand(CMD_INSERT_IMAGE_LOCAL);
        jmiImageLocal.addActionListener(this);
        jMenuInsert.add(jmiImageLocal);
    }
    JMenuItem jmiImageURL = new JMenuItem(Translatrix.getTranslationString("InsertURLImage") + menuDialog);
    jmiImageURL.setActionCommand(CMD_INSERT_IMAGE_URL);
    jmiImageURL.addActionListener(this);
    jMenuInsert.add(jmiImageURL);

    /* TABLE Menu */
    jMenuTable = new JMenu(Translatrix.getTranslationString("Table"));
    htMenus.put(KEY_MENU_TABLE, jMenuTable);
    JMenuItem jmiTable = new JMenuItem(actionTableInsert);
    if (!showMenuIcons) {
        jmiTable.setIcon(null);
    }
    jMenuTable.add(jmiTable);
    jMenuTable.addSeparator();
    Action actionTableEdit = new CommandAction(Translatrix.getTranslationString("TableEdit") + menuDialog,
            getEkitIcon("TableEdit"), CMD_TABLE_EDIT, this);
    JMenuItem jmiEditTable = new JMenuItem(actionTableEdit);
    if (!showMenuIcons) {
        jmiEditTable.setIcon(null);
    }
    jMenuTable.add(jmiEditTable);
    Action actionCellEdit = new CommandAction(Translatrix.getTranslationString("TableCellEdit") + menuDialog,
            getEkitIcon("CellEdit"), CMD_TABLE_CELL_EDIT, this);
    JMenuItem jmiEditCell = new JMenuItem(actionCellEdit);
    if (!showMenuIcons) {
        jmiEditCell.setIcon(null);
    }
    jmiEditCell.setActionCommand(CMD_TABLE_CELL_EDIT);
    jmiEditCell.addActionListener(this);
    jMenuTable.add(jmiEditCell);
    jMenuTable.addSeparator();
    JMenuItem jmiTableRow = new JMenuItem(actionTableRow);
    if (!showMenuIcons) {
        jmiTableRow.setIcon(null);
    }
    jMenuTable.add(jmiTableRow);
    JMenuItem jmiTableCol = new JMenuItem(actionTableCol);
    if (!showMenuIcons) {
        jmiTableCol.setIcon(null);
    }
    jMenuTable.add(jmiTableCol);
    jMenuTable.addSeparator();
    JMenuItem jmiTableRowDel = new JMenuItem(actionTableRowDel);
    if (!showMenuIcons) {
        jmiTableRowDel.setIcon(null);
    }
    jMenuTable.add(jmiTableRowDel);
    JMenuItem jmiTableColDel = new JMenuItem(actionTableColDel);
    if (!showMenuIcons) {
        jmiTableColDel.setIcon(null);
    }
    jMenuTable.add(jmiTableColDel);

    /* FORMS Menu */
    jMenuForms = new JMenu(Translatrix.getTranslationString("Forms"));
    htMenus.put(KEY_MENU_FORMS, jMenuForms);
    JMenuItem jmiFormInsertForm = new JMenuItem(Translatrix.getTranslationString("FormInsertForm"));
    jmiFormInsertForm.setActionCommand(CMD_FORM_INSERT);
    jmiFormInsertForm.addActionListener(this);
    jMenuForms.add(jmiFormInsertForm);
    jMenuForms.addSeparator();
    JMenuItem jmiFormTextfield = new JMenuItem(Translatrix.getTranslationString("FormTextfield"));
    jmiFormTextfield.setActionCommand(CMD_FORM_TEXTFIELD);
    jmiFormTextfield.addActionListener(this);
    jMenuForms.add(jmiFormTextfield);
    JMenuItem jmiFormTextarea = new JMenuItem(Translatrix.getTranslationString("FormTextarea"));
    jmiFormTextarea.setActionCommand(CMD_FORM_TEXTAREA);
    jmiFormTextarea.addActionListener(this);
    jMenuForms.add(jmiFormTextarea);
    JMenuItem jmiFormCheckbox = new JMenuItem(Translatrix.getTranslationString("FormCheckbox"));
    jmiFormCheckbox.setActionCommand(CMD_FORM_CHECKBOX);
    jmiFormCheckbox.addActionListener(this);
    jMenuForms.add(jmiFormCheckbox);
    JMenuItem jmiFormRadio = new JMenuItem(Translatrix.getTranslationString("FormRadio"));
    jmiFormRadio.setActionCommand(CMD_FORM_RADIO);
    jmiFormRadio.addActionListener(this);
    jMenuForms.add(jmiFormRadio);
    JMenuItem jmiFormPassword = new JMenuItem(Translatrix.getTranslationString("FormPassword"));
    jmiFormPassword.setActionCommand(CMD_FORM_PASSWORD);
    jmiFormPassword.addActionListener(this);
    jMenuForms.add(jmiFormPassword);
    jMenuForms.addSeparator();
    JMenuItem jmiFormButton = new JMenuItem(Translatrix.getTranslationString("FormButton"));
    jmiFormButton.setActionCommand(CMD_FORM_BUTTON);
    jmiFormButton.addActionListener(this);
    jMenuForms.add(jmiFormButton);
    JMenuItem jmiFormButtonSubmit = new JMenuItem(Translatrix.getTranslationString("FormButtonSubmit"));
    jmiFormButtonSubmit.setActionCommand(CMD_FORM_SUBMIT);
    jmiFormButtonSubmit.addActionListener(this);
    jMenuForms.add(jmiFormButtonSubmit);
    JMenuItem jmiFormButtonReset = new JMenuItem(Translatrix.getTranslationString("FormButtonReset"));
    jmiFormButtonReset.setActionCommand(CMD_FORM_RESET);
    jmiFormButtonReset.addActionListener(this);
    jMenuForms.add(jmiFormButtonReset);

    /* TOOLS Menu */
    if (hasSpellChecker) {
        jMenuTools = new JMenu(Translatrix.getTranslationString("Tools"));
        htMenus.put(KEY_MENU_TOOLS, jMenuTools);
        JMenuItem jmiSpellcheck = new JMenuItem(Translatrix.getTranslationString("ToolSpellcheck"));
        jmiSpellcheck.setActionCommand(CMD_SPELLCHECK);
        jmiSpellcheck.addActionListener(this);
        jMenuTools.add(jmiSpellcheck);
    }

    /* SEARCH Menu */
    jMenuSearch = new JMenu(Translatrix.getTranslationString("Search"));
    htMenus.put(KEY_MENU_SEARCH, jMenuSearch);
    JMenuItem jmiFind = new JMenuItem(Translatrix.getTranslationString("SearchFind"));
    if (showMenuIcons) {
        jmiFind.setIcon(getEkitIcon("Find"));
    }
    ;
    jmiFind.setActionCommand(CMD_SEARCH_FIND);
    jmiFind.addActionListener(this);
    jmiFind.setAccelerator(KeyStroke.getKeyStroke('F', CTRLKEY, false));
    jMenuSearch.add(jmiFind);
    JMenuItem jmiFindAgain = new JMenuItem(Translatrix.getTranslationString("SearchFindAgain"));
    if (showMenuIcons) {
        jmiFindAgain.setIcon(getEkitIcon("FindAgain"));
    }
    ;
    jmiFindAgain.setActionCommand(CMD_SEARCH_FIND_AGAIN);
    jmiFindAgain.addActionListener(this);
    jmiFindAgain.setAccelerator(KeyStroke.getKeyStroke('G', CTRLKEY, false));
    jMenuSearch.add(jmiFindAgain);
    JMenuItem jmiReplace = new JMenuItem(Translatrix.getTranslationString("SearchReplace"));
    if (showMenuIcons) {
        jmiReplace.setIcon(getEkitIcon("Replace"));
    }
    ;
    jmiReplace.setActionCommand(CMD_SEARCH_REPLACE);
    jmiReplace.addActionListener(this);
    jmiReplace.setAccelerator(KeyStroke.getKeyStroke('R', CTRLKEY, false));
    jMenuSearch.add(jmiReplace);

    /* HELP Menu */
    jMenuHelp = new JMenu(Translatrix.getTranslationString("Help"));
    htMenus.put(KEY_MENU_HELP, jMenuHelp);
    JMenuItem jmiAbout = new JMenuItem(Translatrix.getTranslationString("About"));
    jmiAbout.setActionCommand(CMD_HELP_ABOUT);
    jmiAbout.addActionListener(this);
    jMenuHelp.add(jmiAbout);

    /* DEBUG Menu */
    jMenuDebug = new JMenu(Translatrix.getTranslationString("Debug"));
    htMenus.put(KEY_MENU_DEBUG, jMenuDebug);
    JMenuItem jmiDesc = new JMenuItem(Translatrix.getTranslationString("DescribeDoc"));
    jmiDesc.setActionCommand(CMD_DEBUG_DESCRIBE_DOC);
    jmiDesc.addActionListener(this);
    jMenuDebug.add(jmiDesc);
    JMenuItem jmiDescCSS = new JMenuItem(Translatrix.getTranslationString("DescribeCSS"));
    jmiDescCSS.setActionCommand(CMD_DEBUG_DESCRIBE_CSS);
    jmiDescCSS.addActionListener(this);
    jMenuDebug.add(jmiDescCSS);
    JMenuItem jmiTag = new JMenuItem(Translatrix.getTranslationString("WhatTags"));
    jmiTag.setActionCommand(CMD_DEBUG_CURRENT_TAGS);
    jmiTag.addActionListener(this);
    jMenuDebug.add(jmiTag);

    /* Create menubar and add menus */
    jMenuBar = new JMenuBar();
    jMenuBar.add(jMenuFile);
    jMenuBar.add(jMenuEdit);
    jMenuBar.add(jMenuView);
    jMenuBar.add(jMenuFont);
    jMenuBar.add(jMenuFormat);
    jMenuBar.add(jMenuSearch);
    jMenuBar.add(jMenuInsert);
    jMenuBar.add(jMenuTable);
    jMenuBar.add(jMenuForms);
    if (jMenuTools != null) {
        jMenuBar.add(jMenuTools);
    }
    jMenuBar.add(jMenuHelp);
    if (debugMode) {
        jMenuBar.add(jMenuDebug);
    }

    /* Create toolbar tool objects */
    jbtnNewHTML = new JButtonNoFocus(getEkitIcon("New"));
    jbtnNewHTML.setToolTipText(Translatrix.getTranslationString("NewDocument"));
    jbtnNewHTML.setActionCommand(CMD_DOC_NEW);
    jbtnNewHTML.addActionListener(this);
    htTools.put(KEY_TOOL_NEW, jbtnNewHTML);
    jbtnNewStyledHTML = new JButtonNoFocus(getEkitIcon("NewStyled"));
    jbtnNewStyledHTML.setToolTipText(Translatrix.getTranslationString("NewStyledDocument"));
    jbtnNewStyledHTML.setActionCommand(CMD_DOC_NEW_STYLED);
    jbtnNewStyledHTML.addActionListener(this);
    htTools.put(KEY_TOOL_NEWSTYLED, jbtnNewStyledHTML);
    jbtnOpenHTML = new JButtonNoFocus(getEkitIcon("Open"));
    jbtnOpenHTML.setToolTipText(Translatrix.getTranslationString("OpenDocument"));
    jbtnOpenHTML.setActionCommand(CMD_DOC_OPEN_HTML);
    jbtnOpenHTML.addActionListener(this);
    htTools.put(KEY_TOOL_OPEN, jbtnOpenHTML);
    jbtnSaveHTML = new JButtonNoFocus(getEkitIcon("Save"));
    jbtnSaveHTML.setToolTipText(Translatrix.getTranslationString("SaveDocument"));
    jbtnSaveHTML.setActionCommand(CMD_DOC_SAVE_AS);
    jbtnSaveHTML.addActionListener(this);
    htTools.put(KEY_TOOL_SAVE, jbtnSaveHTML);
    jbtnPrint = new JButtonNoFocus(getEkitIcon("Print"));
    jbtnPrint.setToolTipText(Translatrix.getTranslationString("PrintDocument"));
    jbtnPrint.setActionCommand(CMD_DOC_PRINT);
    jbtnPrint.addActionListener(this);
    htTools.put(KEY_TOOL_PRINT, jbtnPrint);
    // jbtnCut = new JButtonNoFocus(new DefaultEditorKit.CutAction());
    jbtnCut = new JButtonNoFocus();
    jbtnCut.setActionCommand(CMD_CLIP_CUT);
    jbtnCut.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EkitCore.this.actionPerformed(evt);
        }
    });
    jbtnCut.setIcon(getEkitIcon("Cut"));
    jbtnCut.setText(null);
    jbtnCut.setToolTipText(Translatrix.getTranslationString("Cut"));
    htTools.put(KEY_TOOL_CUT, jbtnCut);
    // jbtnCopy = new JButtonNoFocus(new DefaultEditorKit.CopyAction());
    jbtnCopy = new JButtonNoFocus();
    jbtnCopy.setActionCommand(CMD_CLIP_COPY);
    jbtnCopy.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EkitCore.this.actionPerformed(evt);
        }
    });
    jbtnCopy.setIcon(getEkitIcon("Copy"));
    jbtnCopy.setText(null);
    jbtnCopy.setToolTipText(Translatrix.getTranslationString("Copy"));
    htTools.put(KEY_TOOL_COPY, jbtnCopy);
    // jbtnPaste = new JButtonNoFocus(new DefaultEditorKit.PasteAction());
    jbtnPaste = new JButtonNoFocus();
    jbtnPaste.setActionCommand(CMD_CLIP_PASTE);
    jbtnPaste.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EkitCore.this.actionPerformed(evt);
        }
    });
    jbtnPaste.setIcon(getEkitIcon("Paste"));
    jbtnPaste.setText(null);
    jbtnPaste.setToolTipText(Translatrix.getTranslationString("Paste"));
    htTools.put(KEY_TOOL_PASTE, jbtnPaste);
    jbtnPasteX = new JButtonNoFocus();
    jbtnPasteX.setActionCommand(CMD_CLIP_PASTE_PLAIN);
    jbtnPasteX.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EkitCore.this.actionPerformed(evt);
        }
    });
    jbtnPasteX.setIcon(getEkitIcon("PasteUnformatted"));
    jbtnPasteX.setText(null);
    jbtnPasteX.setToolTipText(Translatrix.getTranslationString("PasteUnformatted"));
    htTools.put(KEY_TOOL_PASTEX, jbtnPasteX);
    jbtnUndo = new JButtonNoFocus(undoAction);
    jbtnUndo.setIcon(getEkitIcon("Undo"));
    jbtnUndo.setText(null);
    jbtnUndo.setToolTipText(Translatrix.getTranslationString("Undo"));
    htTools.put(KEY_TOOL_UNDO, jbtnUndo);
    jbtnRedo = new JButtonNoFocus(redoAction);
    jbtnRedo.setIcon(getEkitIcon("Redo"));
    jbtnRedo.setText(null);
    jbtnRedo.setToolTipText(Translatrix.getTranslationString("Redo"));
    htTools.put(KEY_TOOL_REDO, jbtnRedo);
    jbtnBold = new JButtonNoFocus(actionFontBold);
    jbtnBold.setIcon(getEkitIcon("Bold"));
    jbtnBold.setText(null);
    jbtnBold.setToolTipText(Translatrix.getTranslationString("FontBold"));
    htTools.put(KEY_TOOL_BOLD, jbtnBold);
    jbtnItalic = new JButtonNoFocus(actionFontItalic);
    jbtnItalic.setIcon(getEkitIcon("Italic"));
    jbtnItalic.setText(null);
    jbtnItalic.setToolTipText(Translatrix.getTranslationString("FontItalic"));
    htTools.put(KEY_TOOL_ITALIC, jbtnItalic);
    jbtnUnderline = new JButtonNoFocus(actionFontUnderline);
    jbtnUnderline.setIcon(getEkitIcon("Underline"));
    jbtnUnderline.setText(null);
    jbtnUnderline.setToolTipText(Translatrix.getTranslationString("FontUnderline"));
    htTools.put(KEY_TOOL_UNDERLINE, jbtnUnderline);
    jbtnStrike = new JButtonNoFocus(actionFontStrike);
    jbtnStrike.setIcon(getEkitIcon("Strike"));
    jbtnStrike.setText(null);
    jbtnStrike.setToolTipText(Translatrix.getTranslationString("FontStrike"));
    htTools.put(KEY_TOOL_STRIKE, jbtnStrike);
    jbtnSuperscript = new JButtonNoFocus(actionFontSuperscript);
    jbtnSuperscript.setIcon(getEkitIcon("Super"));
    jbtnSuperscript.setText(null);
    jbtnSuperscript.setToolTipText(Translatrix.getTranslationString("FontSuperscript"));
    htTools.put(KEY_TOOL_SUPER, jbtnSuperscript);
    jbtnSubscript = new JButtonNoFocus(actionFontSubscript);
    jbtnSubscript.setIcon(getEkitIcon("Sub"));
    jbtnSubscript.setText(null);
    jbtnSubscript.setToolTipText(Translatrix.getTranslationString("FontSubscript"));
    htTools.put(KEY_TOOL_SUB, jbtnSubscript);
    jbtnUList = new JButtonNoFocus(actionListUnordered);
    jbtnUList.setIcon(getEkitIcon("UList"));
    jbtnUList.setText(null);
    jbtnUList.setToolTipText(Translatrix.getTranslationString("ListUnordered"));
    htTools.put(KEY_TOOL_ULIST, jbtnUList);
    jbtnOList = new JButtonNoFocus(actionListOrdered);
    jbtnOList.setIcon(getEkitIcon("OList"));
    jbtnOList.setText(null);
    jbtnOList.setToolTipText(Translatrix.getTranslationString("ListOrdered"));
    htTools.put(KEY_TOOL_OLIST, jbtnOList);
    jbtnAlignLeft = new JButtonNoFocus(actionAlignLeft);
    jbtnAlignLeft.setIcon(getEkitIcon("AlignLeft"));
    jbtnAlignLeft.setText(null);
    jbtnAlignLeft.setToolTipText(Translatrix.getTranslationString("AlignLeft"));
    htTools.put(KEY_TOOL_ALIGNL, jbtnAlignLeft);
    jbtnAlignCenter = new JButtonNoFocus(actionAlignCenter);
    jbtnAlignCenter.setIcon(getEkitIcon("AlignCenter"));
    jbtnAlignCenter.setText(null);
    jbtnAlignCenter.setToolTipText(Translatrix.getTranslationString("AlignCenter"));
    htTools.put(KEY_TOOL_ALIGNC, jbtnAlignCenter);
    jbtnAlignRight = new JButtonNoFocus(actionAlignRight);
    jbtnAlignRight.setIcon(getEkitIcon("AlignRight"));
    jbtnAlignRight.setText(null);
    jbtnAlignRight.setToolTipText(Translatrix.getTranslationString("AlignRight"));
    htTools.put(KEY_TOOL_ALIGNR, jbtnAlignRight);
    jbtnAlignJustified = new JButtonNoFocus(actionAlignJustified);
    jbtnAlignJustified.setIcon(getEkitIcon("AlignJustified"));
    jbtnAlignJustified.setText(null);
    jbtnAlignJustified.setToolTipText(Translatrix.getTranslationString("AlignJustified"));
    htTools.put(KEY_TOOL_ALIGNJ, jbtnAlignJustified);
    jbtnUnicode = new JButtonNoFocus();
    jbtnUnicode.setActionCommand(CMD_INSERT_UNICODE_CHAR);
    jbtnUnicode.addActionListener(this);
    jbtnUnicode.setIcon(getEkitIcon("Unicode"));
    jbtnUnicode.setText(null);
    jbtnUnicode.setToolTipText(Translatrix.getTranslationString("ToolUnicode"));
    htTools.put(KEY_TOOL_UNICODE, jbtnUnicode);
    jbtnUnicodeMath = new JButtonNoFocus();
    jbtnUnicodeMath.setActionCommand(CMD_INSERT_UNICODE_MATH);
    jbtnUnicodeMath.addActionListener(this);
    jbtnUnicodeMath.setIcon(getEkitIcon("Math"));
    jbtnUnicodeMath.setText(null);
    jbtnUnicodeMath.setToolTipText(Translatrix.getTranslationString("ToolUnicodeMath"));
    htTools.put(KEY_TOOL_UNIMATH, jbtnUnicodeMath);
    jbtnFind = new JButtonNoFocus();
    jbtnFind.setActionCommand(CMD_SEARCH_FIND);
    jbtnFind.addActionListener(this);
    jbtnFind.setIcon(getEkitIcon("Find"));
    jbtnFind.setText(null);
    jbtnFind.setToolTipText(Translatrix.getTranslationString("SearchFind"));
    htTools.put(KEY_TOOL_FIND, jbtnFind);
    jbtnAnchor = new JButtonNoFocus(actionInsertAnchor);
    jbtnAnchor.setIcon(getEkitIcon("Anchor"));
    jbtnAnchor.setText(null);
    jbtnAnchor.setToolTipText(Translatrix.getTranslationString("ToolAnchor"));
    htTools.put(KEY_TOOL_ANCHOR, jbtnAnchor);
    jtbtnViewSource = new JToggleButtonNoFocus(getEkitIcon("Source"));
    jtbtnViewSource.setText(null);
    jtbtnViewSource.setToolTipText(Translatrix.getTranslationString("ViewSource"));
    jtbtnViewSource.setActionCommand(CMD_TOGGLE_SOURCE_VIEW);
    jtbtnViewSource.addActionListener(this);
    jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize());
    jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize());
    jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize());
    htTools.put(KEY_TOOL_SOURCE, jtbtnViewSource);
    jcmbStyleSelector = new JComboBoxNoFocus();
    jcmbStyleSelector.setToolTipText(Translatrix.getTranslationString("PickCSSStyle"));
    jcmbStyleSelector.setAction(new StylesAction(jcmbStyleSelector));
    htTools.put(KEY_TOOL_STYLES, jcmbStyleSelector);
    String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    Vector<String> vcFontnames = new Vector<String>(fonts.length + 1);
    vcFontnames.add(Translatrix.getTranslationString("SelectorToolFontsDefaultFont"));
    for (String fontname : fonts) {
        vcFontnames.add(fontname);
    }
    Collections.sort(vcFontnames);
    jcmbFontSelector = new JComboBoxNoFocus(vcFontnames);
    jcmbFontSelector.setAction(new SetFontFamilyAction(this, "[EKITFONTSELECTOR]"));
    htTools.put(KEY_TOOL_FONTS, jcmbFontSelector);
    jbtnInsertTable = new JButtonNoFocus();
    jbtnInsertTable.setActionCommand(CMD_TABLE_INSERT);
    jbtnInsertTable.addActionListener(this);
    jbtnInsertTable.setIcon(getEkitIcon("TableCreate"));
    jbtnInsertTable.setText(null);
    jbtnInsertTable.setToolTipText(Translatrix.getTranslationString("InsertTable"));
    htTools.put(KEY_TOOL_INSTABLE, jbtnInsertTable);
    jbtnEditTable = new JButtonNoFocus();
    jbtnEditTable.setActionCommand(CMD_TABLE_EDIT);
    jbtnEditTable.addActionListener(this);
    jbtnEditTable.setIcon(getEkitIcon("TableEdit"));
    jbtnEditTable.setText(null);
    jbtnEditTable.setToolTipText(Translatrix.getTranslationString("TableEdit"));
    htTools.put(KEY_TOOL_EDITTABLE, jbtnEditTable);
    jbtnEditCell = new JButtonNoFocus();
    jbtnEditCell.setActionCommand(CMD_TABLE_CELL_EDIT);
    jbtnEditCell.addActionListener(this);
    jbtnEditCell.setIcon(getEkitIcon("CellEdit"));
    jbtnEditCell.setText(null);
    jbtnEditCell.setToolTipText(Translatrix.getTranslationString("TableCellEdit"));
    htTools.put(KEY_TOOL_EDITCELL, jbtnEditCell);
    jbtnInsertRow = new JButtonNoFocus();
    jbtnInsertRow.setActionCommand(CMD_TABLE_ROW_INSERT);
    jbtnInsertRow.addActionListener(this);
    jbtnInsertRow.setIcon(getEkitIcon("InsertRow"));
    jbtnInsertRow.setText(null);
    jbtnInsertRow.setToolTipText(Translatrix.getTranslationString("InsertTableRow"));
    htTools.put(KEY_TOOL_INSERTROW, jbtnInsertRow);
    jbtnInsertColumn = new JButtonNoFocus();
    jbtnInsertColumn.setActionCommand(CMD_TABLE_COLUMN_INSERT);
    jbtnInsertColumn.addActionListener(this);
    jbtnInsertColumn.setIcon(getEkitIcon("InsertColumn"));
    jbtnInsertColumn.setText(null);
    jbtnInsertColumn.setToolTipText(Translatrix.getTranslationString("InsertTableColumn"));
    htTools.put(KEY_TOOL_INSERTCOL, jbtnInsertColumn);
    jbtnDeleteRow = new JButtonNoFocus();
    jbtnDeleteRow.setActionCommand(CMD_TABLE_ROW_DELETE);
    jbtnDeleteRow.addActionListener(this);
    jbtnDeleteRow.setIcon(getEkitIcon("DeleteRow"));
    jbtnDeleteRow.setText(null);
    jbtnDeleteRow.setToolTipText(Translatrix.getTranslationString("DeleteTableRow"));
    htTools.put(KEY_TOOL_DELETEROW, jbtnDeleteRow);
    jbtnDeleteColumn = new JButtonNoFocus();
    jbtnDeleteColumn.setActionCommand(CMD_TABLE_COLUMN_DELETE);
    jbtnDeleteColumn.addActionListener(this);
    jbtnDeleteColumn.setIcon(getEkitIcon("DeleteColumn"));
    jbtnDeleteColumn.setText(null);
    jbtnDeleteColumn.setToolTipText(Translatrix.getTranslationString("DeleteTableColumn"));
    htTools.put(KEY_TOOL_DELETECOL, jbtnDeleteColumn);
    jbtnMaximize = new JButtonNoFocus();
    jbtnMaximize.setActionCommand(CMD_MAXIMIZE);
    jbtnMaximize.addActionListener(this);
    jbtnMaximize.setIcon(getEkitIcon("Maximize"));
    jbtnMaximize.setText(null);
    jbtnMaximize.setToolTipText(Translatrix.getTranslationString("Maximize"));
    htTools.put(KEY_TOOL_MAXIMIZE, jbtnMaximize);
    jbtnClearFormat = new JButtonNoFocus(actionClearFormat);
    jbtnClearFormat.setIcon(getEkitIcon("ClearFormat"));
    jbtnClearFormat.setText(null);
    jbtnClearFormat.setToolTipText(Translatrix.getTranslationString("ClearFormat"));
    htTools.put(KEY_TOOL_CLEAR_FORMAT, jbtnClearFormat);
    jbtnSpecialChar = new JButtonNoFocus(actionSpecialChar);
    jbtnSpecialChar.setIcon(getEkitIcon("SpecialChar"));
    jbtnSpecialChar.setText(null);
    jbtnSpecialChar.setToolTipText(Translatrix.getTranslationString("SpecialChar"));
    htTools.put(KEY_TOOL_SPECIAL_CHAR, jbtnSpecialChar);
    jbtnTableButtonMenu = new JButtonNoFocus(actionTableButtonMenu);
    jbtnTableButtonMenu.setText(null);
    htTools.put(KEY_TOOL_TABLE_MENU, jbtnTableButtonMenu);

    /* Create the toolbar */
    if (multiBar) {
        jToolBarMain = new JToolBar(JToolBar.HORIZONTAL);
        jToolBarMain.setFloatable(false);
        jToolBarFormat = new JToolBar(JToolBar.HORIZONTAL);
        jToolBarFormat.setFloatable(false);
        jToolBarStyles = new JToolBar(JToolBar.HORIZONTAL);
        jToolBarStyles.setFloatable(false);

        initializeMultiToolbars(toolbarSeq);

        // fix the weird size preference of toggle buttons
        jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize());
        jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize());
        jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize());
    } else if (includeToolBar) {
        jToolBar = new JToolBar(JToolBar.HORIZONTAL);
        jToolBar.setFloatable(false);

        initializeSingleToolbar(toolbarSeq);

        // fix the weird size preference of toggle buttons
        jtbtnViewSource.setPreferredSize(jbtnAnchor.getPreferredSize());
        jtbtnViewSource.setMinimumSize(jbtnAnchor.getMinimumSize());
        jtbtnViewSource.setMaximumSize(jbtnAnchor.getMaximumSize());
    }

    /* Create the scroll area for the text pane */
    jspViewport = new JScrollPane(jtpMain);
    jspViewport.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    jspViewport.setPreferredSize(new Dimension(400, 400));
    jspViewport.setMinimumSize(new Dimension(32, 32));

    /* Create the scroll area for the source viewer */
    jspSource = new JScrollPane(jtpSource);
    jspSource.setPreferredSize(new Dimension(400, 100));
    jspSource.setMinimumSize(new Dimension(32, 32));

    displayPanel = new JPanel();
    displayPanel.setLayout(new CardLayout());
    displayPanel.add(jspViewport, PANEL_NAME_MAIN);
    displayPanel.add(jspSource, PANEL_NAME_SOURCE);
    if (showViewSource) {
        toggleSourceWindow();
    }

    registerDocumentStyles();

    tableCtl = new TableController(this);

    htmlDoc.setInlineEdit(inlineEdit);

    htmlDoc.addFilter(new HTMLTableDocumentFilter());

    // Inicializa documento pelos behaviors
    for (HTMLDocumentBehavior b : this.behaviors) {
        b.initializeDocument(jtpMain);
    }
    htmlDoc.getBehaviors().addAll(this.behaviors);

    /* Add the components to the app */
    this.setLayout(new BorderLayout());
    this.add(displayPanel, BorderLayout.CENTER);
}

From source file:swift.selenium.WebHelper.java

@SuppressWarnings("incomplete-switch")
public static String doAction(String imageType, String controlType, String controlId, String controlName,
        String ctrlValue, String logicalName, String action, WebElement webElement, Boolean Results,
        HSSFSheet strucSheet, HSSFSheet valSheet, int rowIndex, int rowcount, String rowNo, String colNo)
        throws Exception {
    List<WebElement> WebElementList = null;
    String currentValue = null;//from w  ww. j  av a2 s . c om
    //HSSFSheet uniqueNumberSheet =null;
    String uniqueNumber = "";
    WebVerification.isFromVerification = false;
    //HashMap<String ,Object> uniqueValuesHashMap = null;
    //HSSFRow uniqueRow = null;
    ControlTypeEnum controlTypeEnum = ControlTypeEnum.valueOf(controlType);
    ControlTypeEnum actionName = ControlTypeEnum.valueOf(action.toString());
    if (controlType.contains("Robot") && !isIntialized) {
        robot = new Robot();
        isIntialized = true;
    }

    if (action.toString().equalsIgnoreCase("I") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("Read") || action.toString().equalsIgnoreCase("Write")
            || action.toString().equalsIgnoreCase("V") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("NC")
            || action.toString().equalsIgnoreCase("T") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("F") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("VA") && !ctrlValue.equalsIgnoreCase("")
            || action.toString().equalsIgnoreCase("O") || action.toString().equalsIgnoreCase("CP")
            || action.toString().equalsIgnoreCase("GV") || action.toString().equalsIgnoreCase("LV")
            || action.toString().equalsIgnoreCase("GB") || action.toString().equalsIgnoreCase("Get")
            || action.toString().equalsIgnoreCase("Post")) {
        try {
            switch (controlTypeEnum) {

            case WebEdit:
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    webElement.clear();
                    webElement.sendKeys(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    if (!ctrlValue.equalsIgnoreCase("null")) {
                        webElement.clear();
                        webElement.sendKeys(ctrlValue);
                    } else {
                        webElement.clear();
                    }
                    break;
                case T:
                    if (!ctrlValue.equalsIgnoreCase("null")) {
                        webElement.clear();
                        webElement.sendKeys(ctrlValue);
                        ((DeviceActionShortcuts) Automation.driver).hideKeyboard();
                    } else {
                        webElement.clear();
                    }
                    break;
                case V:
                    currentValue = webElement.getText();
                    break;
                }
                break;

            case WebButton:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        webElement.click();
                    }
                    break;
                case NC:
                    webElement.click();
                    break;
                case V:
                    if (webElement.isDisplayed()) {
                        if (webElement.isEnabled() == true)
                            currentValue = "True";
                        else
                            currentValue = "False";
                    }
                }
                break;

            case WebElement:
                switch (actionName) {

                case I:
                    webElement = wait.until(ExpectedConditions.elementToBeClickable(webElement));
                    webElement.click();
                    break;

                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    webElement.clear();
                    webElement.sendKeys(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case V:
                    if (WebVerification.isFromVerification == true) {
                        currentValue = webElement.getText();
                        break;
                    }
                    boolean textPresent = false;
                    String ObservedText = webElement.getText();
                    if (StringUtils.isBlank(ObservedText)) {
                        ObservedText = webElement.getAttribute("value");
                    }

                    textPresent = ObservedText.contains(ctrlValue);
                    if (textPresent == false)
                        currentValue = Boolean.toString(textPresent);
                    else
                        currentValue = ctrlValue;
                    break;

                case T:
                    Point p = ((Locatable) webElement).getCoordinates().onPage();
                    ((MobileDriver) Automation.driver).tap(1, p.getX(), p.getY(), 1);
                    break;
                }
                break;

            case JSScript:
                ((JavascriptExecutor) Automation.driver).executeScript(controlName, ctrlValue);
                break;

            case Wait:
                Thread.sleep(Integer.parseInt(controlName) * 1000);
                break;

            case CheckBox:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        webElement.click();
                    }
                    break;
                case NC:
                    webElement.click();
                    break;
                }
                break;

            case Radio:
                switch (actionName) {
                case I:
                    if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                        if (!webElement.isSelected()) {
                            webElement.click();
                        }
                    }
                    break;
                case NC:
                    if (!webElement.isSelected()) {
                        webElement.click();
                    }
                    break;
                case V:
                    if (webElement.isSelected()) {
                        currentValue = webElement.getAttribute(controlName.toString());
                    }
                    break;
                case F:
                    if (webElement != null) {
                        currentValue = "Y";
                    }
                    break;
                }
                break;

            case WebLink:
                //case CloseWindow://added this Case to bypass page loading after clicking the event
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    WebElementList = getElementsByType(controlId, controlName, controlType, imageType,
                            uniqueNumber);
                    webElement = GetControlByIndex("", WebElementList, controlId, controlName, controlType,
                            uniqueNumber);
                    webElement.click();
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    if (controlId.equalsIgnoreCase("LinkValue")) {
                        webElement.click();
                    } else {
                        if (ctrlValue.equalsIgnoreCase("Y") || ctrlValue.equalsIgnoreCase("Yes")) {
                            webElement.click();
                        }
                    }
                    break;
                case NC:
                    webElement.click();
                    break;
                }
                break;

            case CloseWindow: //TM-09/09/2015: This case is written to help in closing any specific windows
                switch (actionName) {
                case I: //This case helps in closing a specific window on the basis on the given title            
                    Set<String> handlers = null;
                    handlers = Automation.driver.getWindowHandles();
                    for (String handler : handlers) {
                        Automation.driver = Automation.driver.switchTo().window(handler);

                        //TM-19/01/2015: Changed following comparison from equalsIgnoreCase to contains
                        if (Automation.driver.getTitle().contains(ctrlValue)) {
                            System.out.println("Closing required window :-" + Automation.driver.getTitle());
                            Automation.driver.close();
                            break;
                        }
                    }
                    break;
                case NC://This case helps in closing the window with current focus
                    Automation.driver.close();
                    break;
                }
                break;
            case WaitForJS:
                waitForCondition();
                break;

            case ListBox:
            case WebList:
                switch (actionName) {
                case Read:
                    uniqueNumber = ReadFromExcel(ctrlValue);
                    new Select(webElement).selectByVisibleText(uniqueNumber);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case I:
                    ExpectedCondition<Boolean> isTextPresent = CommonExpectedConditions
                            .textToBePresentInElement(webElement, ctrlValue);
                    if (isTextPresent != null) {
                        if (webElement != null) {
                            new Select(webElement).selectByVisibleText(ctrlValue);
                        }
                    }
                    break;
                case V:
                    if (!ctrlValue.contains(",")) {
                        currentValue = new Select(webElement).getFirstSelectedOption().getText();
                        if (currentValue.isEmpty()) {
                            currentValue = new Select(webElement).getFirstSelectedOption()
                                    .getAttribute("value");
                        }

                        break;
                    } else {
                        currentValue = new String();
                        List<WebElement> currentValues = new ArrayList<WebElement>();
                        currentValues = new Select(webElement).getOptions();

                        for (int j = 0; j < currentValues.size(); j++) {
                            if (j + 1 == currentValues.size())
                                currentValue = currentValue.concat(currentValues.get(j).getText());
                            else {
                                currentValue = currentValue.concat(currentValues.get(j).getText() + ",");
                            }
                        }
                        break;
                    }
                }
                break;

            //New code for AJAX Dropdown with dojo
            case AjaxWebList:
                switch (actionName) {
                case I:
                    webElement.click();
                    break;
                case VA:
                    Thread.sleep(20000);
                    currentValue = new String();
                    List<WebElement> currentValues = new ArrayList<WebElement>();
                    currentValues = Automation.driver.findElements(By.xpath(controlName));

                    for (int j = 0; j < currentValues.size(); j++) {
                        if (j + 1 == currentValues.size())
                            currentValue = currentValue.concat(currentValues.get(j).getText());
                        else {
                            currentValue = currentValue.concat(currentValues.get(j).getText() + ",");
                        }
                    }
                    break;
                }
                break;
            case IFrame:
                Automation.driver = Automation.driver.switchTo().frame(controlName);
                break;

            case Browser:
                Set<String> handlers = null;
                handlers = Automation.driver.getWindowHandles();
                for (String handler : handlers) {
                    Automation.driver = Automation.driver.switchTo().window(handler);
                    if (Automation.driver.getTitle().contains(controlName)) {
                        System.out.println("Focus on window with title: " + Automation.driver.getTitle());
                        break;
                    }
                }
                break;

            case BrowserControl:
                Set<String> winHandles = Automation.driver.getWindowHandles();
                boolean controlfound = false;
                winHandles = Automation.driver.getWindowHandles();
                for (String handler : winHandles) {
                    Automation.driver = Automation.driver.switchTo().window(handler);

                    try {
                        Automation.driver.findElement(By.xpath(controlName));
                        System.out.println("Focus on window with Control: " + controlName);
                        controlfound = true;
                        break;

                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                }

                if (!controlfound)
                    System.out.println("Unable to find control with : " + controlName);
                break;

            case BrowserType:
                switch (actionName) {
                case I:
                    if (StringUtils.isNotBlank(ctrlValue)) {
                        Automation.browser = Automation.configHashMap.get("BROWSERTYPE").toString();
                        if (StringUtils.equalsIgnoreCase("none", Automation.browser)) {
                            Automation.browser = ctrlValue.toString();
                            Automation.browserType = Automation.browserTypeEnum.valueOf(Automation.browser);
                            Automation.setUp();
                            wait = new WebDriverWait(Automation.driver,
                                    Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));
                            //Thread.sleep(5000);
                        }
                    }
                    break;
                case NC:
                    if (StringUtils.isNotBlank(controlName)) {
                        Automation.browser = Automation.configHashMap.get("BROWSERTYPE").toString();
                        if (StringUtils.equalsIgnoreCase("none", Automation.browser)) {
                            Automation.browser = controlName.toString();
                            Automation.browserType = Automation.browserTypeEnum.valueOf(Automation.browser);
                            Automation.setUp();
                            wait = new WebDriverWait(Automation.driver,
                                    Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));
                            //Thread.sleep(5000);
                        }
                    }
                    break;
                }
                break;
            case BrowserAuth:
                final String details[] = ctrlValue.split(",");
                Runnable thread2 = new Runnable() {
                    public void run() {
                        try {
                            smartRobot = new SmartRobot();
                            Thread.sleep(5000);
                            smartRobot.type(details[0].toString());// Enter username      
                            Thread.sleep(2000);
                            smartRobot.pressTab();// Click Keyboard Tab                              
                            smartRobot.type(details[1].toString());// Enter password      
                            Thread.sleep(2000);
                            smartRobot.pressEnter();// Click Enter button
                            Thread.sleep(5000);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                };
                Thread thr2 = new Thread(thread2);
                thr2.start();
                break;

            case URL:
                final String url = ctrlValue;
                if (!StringUtils.isBlank(ctrlValue)) {
                    if (Automation.browser.equals("InternetExplorer")) {
                        Automation.driver.navigate().to(url);
                        Thread.sleep(5000);
                    } else {
                        Runnable thread1 = new Runnable() {
                            public void run() {
                                try {
                                    Automation.driver.navigate().to(url);
                                    Thread.sleep(5000);
                                } catch (InterruptedException e) {
                                    e.printStackTrace();
                                }
                            }
                        };
                        Thread thr1 = new Thread(thread1);
                        thr1.start();
                    }
                }
                break;

            case Menu:
                webElement.click();
                break;

            case Alert:
                switch (actionName) {
                case V:
                    Alert alert = wait.until(ExpectedConditions.alertIsPresent());
                    if (alert != null) {
                        Automation.driver.switchTo().alert();
                        currentValue = alert.getText();
                        System.out.println(currentValue);
                        alert.accept();
                    }
                    break;
                }
                break;

            case WebImage:
                webElement.sendKeys(Keys.TAB);
                webElement.click();
                Thread.sleep(5000);
                for (int Seconds = 0; Seconds <= Integer
                        .parseInt(Automation.configHashMap.get("TIMEOUT").toString()); Seconds++) {
                    if (!((Automation.driver.getWindowHandles().size()) > 1)) {
                        webElement.click();
                        Thread.sleep(5000);
                    } else {
                        break;
                    }
                }
                break;

            case ActionClick:
                Actions builderClick = new Actions(Automation.driver);
                Action clickAction = builderClick.moveToElement(webElement).clickAndHold().release().build();
                clickAction.perform();
                break;

            case ActionDoubleClick:
                Actions builderdoubleClick = new Actions(Automation.driver);
                builderdoubleClick.doubleClick(webElement).perform();//TM-27/01/2015 :- commented following code and used this code for simultaneous clicks
                //Action doubleClickAction = builderdoubleClick.moveToElement(webElement).click().build();
                //doubleClickAction.perform();
                //doubleClickAction.perform();                  
                break;

            case ActionClickandEsc:
                Actions clickandEsc = new Actions(Automation.driver);
                Action clickEscAction = clickandEsc.moveToElement(webElement).click()
                        .sendKeys(Keys.ENTER, Keys.ESCAPE).build();
                clickEscAction.perform();
                break;

            case ActionMouseOver:
                Actions builderMouserOver = new Actions(Automation.driver);
                Action mouseOverAction = builderMouserOver.moveToElement(webElement).build();
                mouseOverAction.perform();
                break;

            case Calendar:
                //   Thread.sleep(5000);
                Boolean isCalendarDisplayed = Automation.driver.switchTo().activeElement().isDisplayed();
                System.out.println(isCalendarDisplayed);
                if (isCalendarDisplayed == true) {
                    String[] dtMthYr = ctrlValue.split("/");
                    WebElement Year = WaitTool.waitForElement(Automation.driver, By.name("year"),
                            Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));//Automation.driver.findElement(By.name("year"));
                    while (!Year.getAttribute("value").equalsIgnoreCase(dtMthYr[2])) {
                        if (Integer.parseInt(Year.getAttribute("value")) > Integer.parseInt(dtMthYr[2])) {
                            WebElement yearButton = WaitTool.waitForElement(Automation.driver, By.id("button1"),
                                    Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));//Automation.driver.findElement(By.id("button1"));
                            yearButton.click();
                        } else if (Integer.parseInt(Year.getAttribute("value")) < Integer
                                .parseInt(dtMthYr[2])) {
                            WebElement yearButton = WaitTool.waitForElement(Automation.driver, By.id("Button5"),
                                    Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));//Automation.driver.findElement(By.id("Button5"));
                            yearButton.click();
                        }
                    }
                    Select date = new Select(WaitTool.waitForElement(Automation.driver, By.name("month"),
                            Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString())));
                    month = CalendarSnippet.getMonthForInt(Integer.parseInt(dtMthYr[1]));
                    date.selectByVisibleText(month);
                    WebElement Day = WaitTool.waitForElement(Automation.driver, By.id("Button6"),
                            Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));//Automation.driver.findElement(By.id("Button6"));
                    int day = 6;
                    while (Day.getAttribute("value") != null) {
                        Day = WaitTool.waitForElement(Automation.driver, By.id("Button" + day),
                                Integer.parseInt(Automation.configHashMap.get("TIMEOUT").toString()));//Automation.driver.findElement(By.id("Button"+day));
                        if (Day.getAttribute("value").toString().equalsIgnoreCase(dtMthYr[0])) {
                            Day.click();
                            break;
                        }
                        day++;
                    }
                } else {
                    System.out.println("Calendar not Diplayed");
                }
                //Automation.selenium.click(controlName);
                break;

            case CalendarNew:
                isCalendarDisplayed = Automation.driver.switchTo().activeElement().isDisplayed();
                System.out.println(isCalendarDisplayed);
                if (isCalendarDisplayed == true) {

                    String[] dtMthYr = ctrlValue.split("/");
                    Thread.sleep(2000);
                    //String[] CurrentDate = dtFormat.format(frmDate).split("/");
                    WebElement Monthyear = Automation.driver.findElement(By.xpath("//table/thead/tr/td[2]"));
                    String Monthyear1 = Monthyear.getText();
                    String[] Monthyear2 = Monthyear1.split(",");
                    Monthyear2[1] = Monthyear2[1].trim();

                    month = CalendarSnippet.getMonthForString(Monthyear2[0]);

                    while (!Monthyear2[1].equalsIgnoreCase(dtMthYr[2])) {
                        if (Integer.parseInt(Monthyear2[1]) > Integer.parseInt(dtMthYr[2])) {
                            WebElement yearButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            yearButton.click();
                            Monthyear2[1] = Integer.toString(Integer.parseInt(Monthyear2[1]) - 1);
                        } else if (Integer.parseInt(Monthyear2[1]) < Integer.parseInt(dtMthYr[2])) {
                            WebElement yearButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            yearButton.click();
                            Monthyear2[1] = Integer.toString(Integer.parseInt(Monthyear2[1]) + 1);
                        }
                    }

                    while (!month.equalsIgnoreCase(dtMthYr[1])) {
                        if (Integer.parseInt(month) > Integer.parseInt(dtMthYr[1])) {
                            WebElement monthButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            monthButton.click();
                            if (Integer.parseInt(month) < 11) {
                                month = "0" + Integer.toString(Integer.parseInt(month) - 1);
                            } else {
                                month = Integer.toString(Integer.parseInt(month) - 1);
                            }

                        } else if (Integer.parseInt(month) < Integer.parseInt(dtMthYr[1])) {
                            WebElement monthButton = Automation.driver
                                    .findElement(By.cssSelector("td:contains('')"));
                            monthButton.click();
                            if (Integer.parseInt(month) < 9) {
                                month = "0" + Integer.toString(Integer.parseInt(month) + 1);
                            } else {
                                month = Integer.toString(Integer.parseInt(month) + 1);
                            }
                        }
                    }

                    WebElement dateButton = Automation.driver
                            .findElement(By.cssSelector("td.day:contains('" + dtMthYr[0] + "')"));
                    System.out.println(dateButton);
                    dateButton.click();

                } else {
                    System.out.println("Calendar not Diplayed");
                }
                break;

            case CalendarIPF:
                String[] dtMthYr = ctrlValue.split("/");
                Thread.sleep(2000);
                String year = dtMthYr[2];
                String monthNum = dtMthYr[1];
                String day = dtMthYr[0];

                //Xpath for Year, mMnth & Days
                String xpathYear = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-years']";
                String xpathMonth = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-months']";
                String xpathDay = "//div[@class='datepicker datepicker-dropdown dropdown-menu datepicker-orient-left datepicker-orient-bottom']/div[@class='datepicker-days']";

                //Selecting year in 3 steps
                Automation.driver.findElement(By.xpath(xpathDay + "/table/thead/tr[1]/th[2]")).click();
                Automation.driver.findElement(By.xpath(xpathMonth + "/table/thead/tr/th[2]")).click();
                Automation.driver
                        .findElement(By.xpath(xpathYear
                                + "/table/tbody/tr/td/span[@class='year'][contains(text()," + year + ")]"))
                        .click();

                //Selecting month in 1 step   
                Automation.driver
                        .findElement(By.xpath(xpathMonth + "/table/tbody/tr/td/span[" + monthNum + "]"))
                        .click();

                //Selecting day in 1 step
                Automation.driver
                        .findElement(By.xpath(
                                xpathDay + "/table/tbody/tr/td[@class='day'][contains(text()," + day + ")]"))
                        .click();

            case CalendarEBP:
                String[] dtMthYrEBP = ctrlValue.split("/");
                Thread.sleep(500);
                String yearEBP = dtMthYrEBP[2];
                String monthNumEBP = CalendarSnippet.getMonthForInt(Integer.parseInt(dtMthYrEBP[1]))
                        .substring(0, 3);
                String dayEBP = dtMthYrEBP[0];

                //common path used for most of the elements
                String pathToVisibleCalendar = "//div[@class='ajax__calendar'][contains(@style, 'visibility: visible;')]/div";

                //following is to click the title once to reach the year page
                wait.until(ExpectedConditions.elementToBeClickable(
                        By.xpath(pathToVisibleCalendar + "/div[@class='ajax__calendar_header']/div[3]/div")))
                        .click();
                //check if 'Dec' is visibly clickable after refreshing
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(
                        pathToVisibleCalendar + "/div/div/table/tbody/tr/td/div[contains(text(), 'Dec')]")));
                Thread.sleep(5000);
                //following is to click the title once again to reach the year page
                wait.until(ExpectedConditions.elementToBeClickable(
                        (By.xpath(pathToVisibleCalendar + "/div[@class='ajax__calendar_header']/div[3]/div"))))
                        .click();
                //common path used for most of the elements while selection of year, month and date
                pathToVisibleCalendar = "//div[@class='ajax__calendar'][contains(@style, 'visibility: visible;')]/div/div/div/table/tbody/tr/td";
                Thread.sleep(2000);
                //each of the following line selects the year, month and date
                wait.until(ExpectedConditions.elementToBeClickable(
                        By.xpath(pathToVisibleCalendar + "/div[contains(text()," + yearEBP + ")]"))).click();
                Thread.sleep(2000);
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(pathToVisibleCalendar
                        + "/div[@class='ajax__calendar_month'][contains(text(),'" + monthNumEBP + "')]")))
                        .click();
                Thread.sleep(2000);
                wait.until(ExpectedConditions.elementToBeClickable(By.xpath(pathToVisibleCalendar
                        + "/div[@class='ajax__calendar_day'][contains(text()," + dayEBP + ")]"))).click();

                break;

            /**Code for window popups**/
            case Window:
                switch (actionName) {
                case O:
                    String parentHandle = Automation.driver.getWindowHandle();
                    for (String winHandle : Automation.driver.getWindowHandles()) {
                        Automation.driver.switchTo().window(winHandle);
                        if (Automation.driver.getTitle().contains(controlName)) {
                            ((JavascriptExecutor) Automation.driver)
                                    .executeScript("window.onbeforeunload = function(e){};");//By Tripti: 16/02/2015
                            Automation.driver.close();
                        } else {
                            parentHandle = winHandle;
                        }

                    }
                    Automation.driver.switchTo().window(parentHandle);
                    break;
                }
                break;

            case WebTable:
                switch (actionName) {
                case Read:
                    ReadFromExcel(ctrlValue);
                    break;
                case Write:
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                case NC:
                    WebElement table = webElement;
                    List<WebElement> tableRows = table.findElements(By.tagName("tr"));
                    int tableRowIndex = 0;
                    //int tableColumnIndex = 0;
                    boolean matchFound = false;
                    for (WebElement tableRow : tableRows) {
                        tableRowIndex += 1;
                        List<WebElement> tableColumns = tableRow.findElements(By.tagName("td"));
                        if (tableColumns.size() > 0) {
                            for (WebElement tableColumn : tableColumns)
                                if (tableColumn.getText().equals(ctrlValue)) {
                                    matchFound = true;
                                    System.out.println(tableRowIndex);
                                    List<Object> elementProperties = getPropertiesOfWebElement(
                                            tableColumns.get(Integer.parseInt(colNo)), imageType);
                                    controlName = elementProperties.get(0).toString();
                                    if (controlName.equals("")) {
                                        controlName = elementProperties.get(1).toString();
                                    }
                                    controlType = elementProperties.get(2).toString();
                                    webElement = (WebElement) elementProperties.get(3);
                                    doAction(imageType, controlType, controlId, controlName, ctrlValue,
                                            logicalName, action, webElement, Results, strucSheet, valSheet,
                                            tableRowIndex, rowcount, rowNo, colNo);
                                    break;
                                }
                            if (matchFound) {
                                break;
                            }
                        }

                    }
                    break;
                case V:
                    WriteToDetailResults(ctrlValue, "", logicalName);
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    break;

                case GB:
                    WebVerification.GroupBy = ctrlValue;
                    break;
                }
                break;

            case Robot:

                if (controlName.equalsIgnoreCase("SetFilePath")) {
                    StringSelection stringSelection = new StringSelection(ctrlValue);
                    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);

                    robot.delay(5000);
                    robot.keyPress(KeyEvent.VK_CONTROL);
                    robot.keyPress(KeyEvent.VK_V);
                    robot.keyRelease(KeyEvent.VK_V);
                    robot.keyRelease(KeyEvent.VK_CONTROL);

                } else if (controlName.equalsIgnoreCase("Type")) {
                    robot.keyPress(KeyEvent.VK_M);
                    robot.keyRelease(KeyEvent.VK_TAB);
                } else if (controlName.equalsIgnoreCase("TAB")) {
                    robot.keyPress(KeyEvent.VK_TAB);
                    robot.keyRelease(KeyEvent.VK_TAB);
                } else if (controlName.equalsIgnoreCase("SPACE")) {
                    robot.keyPress(KeyEvent.VK_SPACE);
                    robot.keyRelease(KeyEvent.VK_SPACE);
                } else if (controlName.equalsIgnoreCase("ENTER")) {
                    robot.keyPress(KeyEvent.VK_ENTER);
                    robot.keyRelease(KeyEvent.VK_ENTER);
                }

                break;

            case DB:
                switch (actionName) {
                case Write:
                    ResultSet rs = JDBCConnection.establishDBConn("", ctrlValue);
                    rs.next();
                    ctrlValue = String.valueOf(rs.getLong("COL_1"));
                    rs.close();
                    writeToExcel(ctrlValue, webElement, controlId, controlType, controlName, rowNo, colNo);
                    break;
                }
                break;
            //Kinjal 9/6/2015 Added for DB Approach   
            case DBV:
                switch (actionName) {
                case CP:
                    currentValue = webElement.getText();
                    if (StringUtils.isBlank(currentValue)) {
                        currentValue = webElement.getAttribute("value");
                    }
                    ctrlValue = JDBCConnection.getFirstColumnName(ctrlValue);
                    System.out.println("Database value fetched from DB is " + ctrlValue);
                    break;

                case V:

                    List<WebElement> rowElements = WebHelper.getElementsByType(controlId, controlName, "", "",
                            "");
                    if (rowElements != null) {
                        currentValue = Integer.toString(rowElements.size());
                    } else {
                        currentValue = "0";
                    }

                    ctrlValue = JDBCConnection.getFirstColumnName(ctrlValue);
                    break;
                }
                break;

            case WaitForEC:
                wait.until(CommonExpectedConditions.elementToBeClickable(webElement));
                break;

            case SikuliType:
                sikuliScreen.type(controlName, ctrlValue);
                break;

            case SikuliButton:
                sikuliScreen.click(controlName);
                System.out.println("Done");
                break;

            case Date:
                Calendar cal = new GregorianCalendar();
                int i = cal.get(Calendar.DAY_OF_MONTH);
                if (i >= 31) {
                    i = i - 10;
                }
                break;

            case FileUpload:
                webElement.sendKeys(ctrlValue);
                break;

            case ScrollTo:
                //Locatable element = (Locatable) webElement; //TM:04/03/2015-commented as incorrect
                //Point p= element.getCoordinates().onScreen();//TM:04/03/2015-commented as incorrect
                Point p = webElement.getLocation();//TM:04/03/2015-New correct code
                System.out.println("X,Y co-ordinates of textbox is:- " + p);//TM:04/03/2015-New correct code
                JavascriptExecutor js = (JavascriptExecutor) Automation.driver; //TM:04/03/2015-New correct code
                js.executeScript("window.scrollTo(" + p.getX() + "," + (p.getY() + 150) + ");");
                break;

            case SwitchContext:
                Thread.sleep(3000);
                Set<String> contexts = ((AppiumDriver) Automation.driver).getContextHandles();
                for (String s : contexts) {
                    System.out.println("Count of contexts : " + contexts.size());
                    System.out.println("Context Name : " + s);
                    if (s.contains(ctrlValue)) {
                        System.out.println("Mobile Web View found");
                        ((AppiumDriver) Automation.driver).context(s);
                        break;
                    }
                }
                Thread.sleep(2000);

                break;
            case SwipeDown:
                //((AppiumDriver)(Automation.driver)).swipe(0, 0, 0, 1500, 2000);
                ((AppiumDriver) (Automation.driver)).scrollTo(ctrlValue);
                break;

            case CaptureScreen:
                Date toDate = new Date();
                TransactionMapping.report.setFromDate(Automation.dtFormat.format(frmDate));
                TransactionMapping.report
                        .setStrIteration(Automation.configHashMap.get("CYCLENUMBER").toString());
                TransactionMapping.report.setStrTestcaseId(MainController.controllerTestCaseID.toString());
                TransactionMapping.report.setStrGroupName(MainController.controllerGroupName.toString());
                TransactionMapping.report
                        .setStrTrasactionType(MainController.controllerTransactionType.toString());
                TransactionMapping.report.setStrTestDescription(MainController.testDesciption);
                TransactionMapping.report.setStrMessage(
                        "Screenshot of Test Case Id:" + MainController.controllerTestCaseID.toString()
                                + " & Transaction Type:" + MainController.controllerTransactionType.toString());
                TransactionMapping.report.setToDate(Automation.dtFormat.format(toDate));
                saveScreenShot(TransactionMapping.report, logicalName);
                break;
            case WebService:
                switch (actionName) {
                case I:
                    if (logicalName.equalsIgnoreCase("WSDL_URL"))
                        wsdl_url = ctrlValue;
                    else if (logicalName.equalsIgnoreCase("REQUEST_URL"))
                        request_url = ctrlValue;
                    else if (logicalName.equalsIgnoreCase("REQUEST_XML"))
                        request_xml = ctrlValue;
                    break;

                case T:
                    WebService.callWebService();
                    break;

                case V:
                    currentValue = WebService.getXMLTagValue(controlName);
                    break;
                }
                break;

            case WebService_REST:
                switch (actionName) {
                case I:
                    if (logicalName.equalsIgnoreCase("REQUEST_URL"))
                        request_url = ctrlValue;
                    else if (logicalName.equalsIgnoreCase("REQUEST_XML")) {
                        request_xml = ctrlValue;
                    }
                    break;
                case Get:
                    WebService.callRESTWebService("Get", controlId);
                    break;

                case Post:
                    WebService.callRESTWebService("Post", controlId);
                    break;

                case V:
                    if (controlId.equalsIgnoreCase("JSON")) {
                        currentValue = WebService.getJSONTagValue(controlName);
                    } else {
                        currentValue = WebService.getXMLTagValue(controlName);
                    }
                    break;
                }
                break;

            case JSONResp:
                switch (actionName) {
                case I:
                    if (logicalName.equalsIgnoreCase("JSON_URL")) {
                        response_url = controlName;
                        response_fileName = ctrlValue;
                        WebService.downloadAndStoreJson(response_url, response_fileName);
                    }
                    break;
                }
                break;

            case DonutChart:
                switch (actionName) {
                case GV:

                    DonutChart donut = new DonutChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(), donut.getDonutColumnNames(),
                            donut.getDonutChartData());
                    break;

                case LV:

                    DonutChart donutLegend = new DonutChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(),
                            donutLegend.getDonutLegendColumnNames(), donutLegend.getDonutLegendData());
                    break;
                }
                break;

            case BarChart:
                switch (actionName) {
                case GV:

                    String[] series = ctrlValue.split("!");
                    List<String> seriesList = Arrays.asList(series);
                    BarChart barChart = new BarChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(), barChart.getColumnNames(),
                            barChart.getChartData(seriesList));
                    break;

                case LV:

                    BarChart barchartLegend = new BarChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(),
                            barchartLegend.getLegendColumnNames(), barchartLegend.getLegendData());
                    break;
                }
                break;
            case BasicLineChart:
                switch (actionName) {
                case GV:

                    BasicLineChart lineChart = new BasicLineChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(), lineChart.getColumnNames(),
                            lineChart.getChartData());
                    break;

                case LV:

                    BasicLineChart linechartLegend = new BasicLineChart(Automation.driver, webElement);
                    WebVerification.verifyTabularData(testcaseID.toString(),
                            MainController.controllerTransactionType.toString(),
                            linechartLegend.getLegendColumnNames(), linechartLegend.getLegendData());
                    break;
                }
                break;
            default:
                System.out.println("U r in Default");
                break;
            }

        } catch (WebDriverException we) {
            throw new Exception("Error Occurred from Do Action " + controlName + we.getMessage());
        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }
    }
    //TM-02/02/2015: Radio button found ("F") & AJAX control ("VA")
    if ((action.toString().equalsIgnoreCase("V") || action.toString().equalsIgnoreCase("CP")
            || action.toString().equalsIgnoreCase("F") || action.toString().equalsIgnoreCase("VA"))
            && !ctrlValue.equalsIgnoreCase("")) {
        if (Results == true) {
            TransactionMapping.report = WriteToDetailResults(ctrlValue, currentValue, logicalName);
        }
    }

    return currentValue;

}