internal static ITreeViewItem GetTreeViewItemFor(ElementInfo CI)
        {
            // TODO verify if pl.Name = ElementInfo

            JavaElementInfo JEI = (JavaElementInfo)CI;

            switch (JEI.ElementType)
            {
            case "javax.swing.JTextField":
            case "javax.swing.JTextPane":
                JavaTextBoxTreeItem JTBTI = new JavaTextBoxTreeItem();
                JTBTI.JavaElementInfo = JEI;
                return(JTBTI);

            case "javax.swing.JButton":
                JavaButtonTreeItem JBTI = new JavaButtonTreeItem();
                JBTI.JavaElementInfo = JEI;
                return(JBTI);

            case "javax.swing.JLabel":
                JavaLabelTreeItem JLTI = new JavaLabelTreeItem();
                JLTI.JavaElementInfo = JEI;
                return(JLTI);

            case "com.amdocs.uif.widgets.browser.JxBrowserBrowserComponent":    //  added to support live spy in JxBrowserBrowserComponent
            case "com.amdocs.uif.widgets.browser.JExplorerBrowserComponent":    // "com.jniwrapper.win32.ie.aw" :
                JavaBrowserTreeItem JBRTI = new JavaBrowserTreeItem();
                JBRTI.JavaElementInfo = JEI;
                return(JBRTI);

            case "javax.swing.JCheckBox":
                JavaCheckBoxTreeItem JCBTI = new JavaCheckBoxTreeItem();
                JCBTI.JavaElementInfo = JEI;
                return(JCBTI);

            case "javax.swing.JRadioButton":
                JavaRadioButtonTreeItem JRBTI = new JavaRadioButtonTreeItem();
                JRBTI.JavaElementInfo = JEI;
                return(JRBTI);

            case "com.amdocs.uif.widgets.CalendarComponent":
            case "com.amdocs.uif.widgets.DateTimeNative$2":
                JavaDatePickerTreeItem JDP = new JavaDatePickerTreeItem();
                JDP.JavaElementInfo = JEI;
                return(JDP);

            case "javax.swing.JComboBox":
            case "com.amdocs.uif.widgets.ComboBoxNative$1":
                JavaComboBoxTreeItem JCoBTI = new JavaComboBoxTreeItem();
                JCoBTI.JavaElementInfo = JEI;
                return(JCoBTI);

            case "javax.swing.JList":
                JavaListTreeItem JLiTI = new JavaListTreeItem();
                JLiTI.JavaElementInfo = JEI;
                return(JLiTI);

            case "javax.swing.JTable":
            case "com.amdocs.uif.widgets.search.SearchJTable":
                JavaTableTreeItem JTiTI = new JavaTableTreeItem();
                JTiTI.JavaElementInfo = JEI;
                return(JTiTI);

            case "javax.swing.JScrollPane":
            case "javax.swing.JScrollPane$ScrollBar":
                JavaScrollTreeItem JSTI = new JavaScrollTreeItem();
                JSTI.JavaElementInfo = JEI;
                return(JSTI);

            case "javax.swing.JTree":
            case "com.amdocs.uif.widgets.TreeNative$SmartJTree":
                JavaTreeTreeItem JTRTI = new JavaTreeTreeItem();
                JTRTI.JavaElementInfo = JEI;
                return(JTRTI);

            case "javax.swing.JMenu":
                JavaMenuTreeItem JMTI = new JavaMenuTreeItem();
                JMTI.JavaElementInfo = JEI;
                return(JMTI);

            case "javax.swing.JTabbedPane":
            case "com.amdocs.uif.widgets.JXTabbedPane":
                JavaTabTreeItem JTTI = new JavaTabTreeItem();
                JTTI.JavaElementInfo = JEI;
                return(JTTI);

            case "javax.swing.JInternalFrame":
            case "com.amdocs.uif.workspace.MDIWorkspace$27":
                JavaInternalFrameTitleTreeItem JIFTTI = new JavaInternalFrameTitleTreeItem();
                JIFTTI.JavaElementInfo = JEI;
                return(JIFTTI);

            default:
                JavaElementTreeItem JETI = new JavaElementTreeItem();
                JETI.JavaElementInfo = JEI;
                return(JETI);
            }
        }
        private void WindowsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AppWindow AW = (AppWindow)WindowsComboBox.SelectedItem;

            if (AW == null)
            {
                return;
            }
            mWindowExplorerDriver.SwitchWindow(AW.Title);

            switch (AW.WindowType)
            {
            case AppWindow.eWindowType.Windows:
                WindowsWindowTreeItem WWTI = new WindowsWindowTreeItem();
                UIAElementInfo        WEI  = (UIAElementInfo)AW.RefObject;
                WEI.WindowExplorer  = mWindowExplorerDriver;
                WWTI.UIAElementInfo = WEI;
                WWTI.UIAElementInfo.ElementObject = WEI.ElementObject;
                break;

            case AppWindow.eWindowType.PowerBuilder:
                PBWindowTreeItem WTI  = new PBWindowTreeItem();
                UIAElementInfo   PBEI = (UIAElementInfo)AW.RefObject;
                PBEI.WindowExplorer = mWindowExplorerDriver;
                WTI.UIAElementInfo  = PBEI;
                break;

            case AppWindow.eWindowType.ASCFForm:
                ASCFFormTreeItem AFTI = new ASCFFormTreeItem();
                AFTI.Name = AW.Title;
                AFTI.Path = AW.Path;
                break;

            case AppWindow.eWindowType.SeleniumWebPage:
                HTMLPageTreeItem HPTI = new HTMLPageTreeItem();
                HTMLElementInfo  EI   = new HTMLElementInfo();
                EI.ElementTitle   = AW.Title;
                EI.XPath          = "html";
                EI.WindowExplorer = mWindowExplorerDriver;
                HPTI.ElementInfo  = EI;
                break;

            case AppWindow.eWindowType.JFrmae:
                JavaWindowTreeItem JWTI = new JavaWindowTreeItem();
                JavaElementInfo    JEI  = new JavaElementInfo();
                JEI.ElementTitle     = AW.Title;
                JEI.Path             = AW.Title;
                JEI.XPath            = "/";
                JEI.IsExpandable     = true;
                JWTI.JavaElementInfo = JEI;
                JEI.WindowExplorer   = mWindowExplorerDriver;
                break;

            case AppWindow.eWindowType.Appium:
                AppiumWindowTreeItem AWTI = new AppiumWindowTreeItem();

                AppiumElementInfo AEI = new AppiumElementInfo();
                AEI.WindowExplorer = mWindowExplorerDriver;
                AEI.XPath          = "/";
                string      pageSourceString = ((SeleniumAppiumDriver)mWindowExplorerDriver).GetPageSource();
                XmlDocument pageSourceXml    = new XmlDocument();
                pageSourceXml.LoadXml(pageSourceString);
                AEI.XmlDoc  = pageSourceXml;
                AEI.XmlNode = pageSourceXml.SelectSingleNode("/");

                AWTI.AppiumElementInfo = AEI;
                break;

            case AppWindow.eWindowType.AndroidDevice:
                AndroidWindowTreeItem ADTI = new AndroidWindowTreeItem();

                AndroidElementInfo AWI = new AndroidElementInfo();
                AWI.WindowExplorer = mWindowExplorerDriver;
                AWI.XPath          = "/";
                string      pageSourceString2 = ((AndroidADBDriver)mWindowExplorerDriver).GetPageSource();
                XmlDocument pageSourceXml2    = new XmlDocument();
                pageSourceXml2.LoadXml(pageSourceString2);
                AWI.XmlDoc  = pageSourceXml2;
                AWI.XmlNode = pageSourceXml2.SelectSingleNode("/hierarchy");

                ADTI.AndroidElementInfo = AWI;
                break;

            case AppWindow.eWindowType.Mainframe:
                MainframeTreeItemBase MFTI = new MainframeTreeItemBase();
                MFTI.Name = AW.Title;
                MFTI.Path = AW.Path;
                break;

            default:
                MessageBox.Show("Unknown Window type:" + AW.WindowType);
                break;
            }
        }
        internal static ITreeViewItem GetTreeViewItemFor(ElementInfo CI)
        {
            JavaElementInfo JEI = (JavaElementInfo)CI;

            switch (JEI.ElementTypeEnum)
            {
            case eElementType.TextBox:
                JavaTextBoxTreeItem JTBTI = new JavaTextBoxTreeItem();
                JTBTI.JavaElementInfo = JEI;
                return(JTBTI);

            case eElementType.Button:
                JavaButtonTreeItem JBTI = new JavaButtonTreeItem();
                JBTI.JavaElementInfo = JEI;
                return(JBTI);

            case eElementType.Label:
                JavaLabelTreeItem JLTI = new JavaLabelTreeItem();
                JLTI.JavaElementInfo = JEI;
                return(JLTI);

            case eElementType.Browser:
                JavaBrowserTreeItem JBRTI = new JavaBrowserTreeItem();
                JBRTI.JavaElementInfo = JEI;
                return(JBRTI);

            case eElementType.CheckBox:
                JavaCheckBoxTreeItem JCBTI = new JavaCheckBoxTreeItem();
                JCBTI.JavaElementInfo = JEI;
                return(JCBTI);

            case eElementType.RadioButton:
                JavaRadioButtonTreeItem JRBTI = new JavaRadioButtonTreeItem();
                JRBTI.JavaElementInfo = JEI;
                return(JRBTI);

            case eElementType.DatePicker:
                JavaDatePickerTreeItem JDP = new JavaDatePickerTreeItem();
                JDP.JavaElementInfo = JEI;
                return(JDP);

            case eElementType.ComboBox:
                JavaComboBoxTreeItem JCoBTI = new JavaComboBoxTreeItem();
                JCoBTI.JavaElementInfo = JEI;
                return(JCoBTI);

            case eElementType.List:
                JavaListTreeItem JLiTI = new JavaListTreeItem();
                JLiTI.JavaElementInfo = JEI;
                return(JLiTI);

            case eElementType.Table:
                JavaTableTreeItem JTiTI = new JavaTableTreeItem();
                JTiTI.JavaElementInfo = JEI;
                return(JTiTI);

            case eElementType.ScrollBar:
                JavaScrollTreeItem JSTI = new JavaScrollTreeItem();
                JSTI.JavaElementInfo = JEI;
                return(JSTI);

            case eElementType.TreeView:
                JavaTreeTreeItem JTRTI = new JavaTreeTreeItem();
                JTRTI.JavaElementInfo = JEI;
                return(JTRTI);

            case eElementType.MenuItem:
                JavaMenuTreeItem JMTI = new JavaMenuTreeItem();
                JMTI.JavaElementInfo = JEI;
                return(JMTI);

            case eElementType.Tab:
                JavaTabTreeItem JTTI = new JavaTabTreeItem();
                JTTI.JavaElementInfo = JEI;
                return(JTTI);

            case eElementType.Iframe:
                JavaInternalFrameTitleTreeItem JIFTTI = new JavaInternalFrameTitleTreeItem();
                JIFTTI.JavaElementInfo = JEI;
                return(JIFTTI);

            default:
                JavaElementTreeItem JETI = new JavaElementTreeItem();
                JETI.JavaElementInfo = JEI;
                return(JETI);
            }
        }