public static void ExpandAll(this GuiTree tree)
        {
            var root     = tree.TopNode;
            var rootPath = tree.GetNodePathByKey(root);

            expandNode(tree, rootPath);
        }
        public bool TreeView_Select(string strControlID, string strKey)
        {
            GuiSession SapSession  = getCurrentSession();
            GuiTree    treeControl = (GuiTree)SapSession.ActiveWindow.FindById(strControlID, "GuiTree");

            treeControl.SetFocus();
            treeControl.SelectNode(strKey);
            return(true);
        }
 public static T FindDescendantByProperty <T>(this GuiTree Tree, Func <T, bool> Property = null)
     where T : class
 {
     if (Property == null)
     {
         Property = new Func <T, bool>(t => true);
     }
     return(findDescendantByPropertyTemplate <T>(Tree.Children, Property));
 }
        /// <summary>
        /// Select Tree Node Path Name, split the path name by "->"
        /// </summary>
        /// <param name="tree"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string ChooseNode(this GuiTree tree, string path)
        {
            var paths        = path.Split(new string[] { "->" }, StringSplitOptions.None);
            var initialLevel = 0;
            var myKey        = "";

            foreach (var key in tree.GetAllNodeKeys())
            {
                var level = tree.GetHierarchyLevel(key);
                if (level == initialLevel)
                {
                    var node = tree.GetNodeTextByKey(key);
                    if (node.ToLower().Trim().Contains(paths[initialLevel].ToLower().Trim()))
                    {
                        initialLevel++;
                        if (initialLevel == paths.Count())
                        {
                            myKey = key;
                            break;
                        }
                    }
                }
            }
            if (myKey != "")
            {
                List <string> keyList   = new List <string>();
                var           parentKey = tree.GetParent(myKey);
                while (parentKey.Trim() != "")
                {
                    keyList.Add(parentKey);
                    parentKey = tree.GetParent(parentKey);
                }
                var count = keyList.Count();
                if (count > 0)
                {
                    for (int i = count - 1; i >= 0; i--)
                    {
                        tree.ExpandNode(keyList[i]);
                    }
                }
                tree.SelectNode(myKey);
            }

            return(myKey);
        }
        private static void expandNode(GuiTree tree, string path)
        {
            string key = tree.GetNodeKeyByPath(path);

            if (tree.IsFolderExpandable(key) && tree.IsFolderExpanded(key) == false)
            {
                tree.ExpandNode(key);
            }
            var childCount = tree.GetNodeChildrenCount(key);

            if (childCount > 0)
            {
                var tempPath = path;
                for (int i = 1; i <= childCount; i++)
                {
                    path += @"\" + i.ToString();
                    expandNode(tree, path);
                    path = tempPath;
                }
            }
        }
Exemple #6
0
        private void GetUIElements(List <SAPEventElement> list, SAPEventElement msg, GuiTree tree, string path, string SystemName)
        {
            GuiCollection keys = null;

            if (string.IsNullOrEmpty(path))
            {
                keys = tree.GetNodesCol() as GuiCollection;
            }
            else
            {
                keys = tree.GetSubNodesCol(path) as GuiCollection;
            }
            if (keys != null)
            {
                foreach (string key in keys)
                {
                    var _msg = new SAPEventElement(msg, tree, msg.Path, key, SystemName);
                    _msg.type = "GuiTreeNode";
                    list.Add(_msg);
                    System.Diagnostics.Trace.WriteLine(_msg.ToString());
                    GetUIElements(list, msg, tree, key, SystemName);
                }
            }
        }
 public static IEnumerable <T> FindAllByName <T>(this GuiTree Tree, string Name)
     where T : class
 {
     return(findAllByNameTemplate <T>(Name, Tree.FindAllByName));
 }
Exemple #8
0
 public static T FindById <T>(this GuiTree Tree, string Id)
     where T : class
 {
     return(findByIdTemplate <T>(Id, Tree.FindById));
 }
Exemple #9
0
 public static T FindByName <T>(this GuiTree Tree, string Name)
     where T : class
 {
     return(findByNameTemplate <T>(Name, Tree.FindByName));
 }
Exemple #10
0
 public static T FindChildByProperty <T>(this GuiTree Tree, Func <T, bool> Property = null)
     where T : class
 {
     return(findChildByPropertyTemplate <T>(Tree.Children, Property));
 }
 public static T FindByNameEx <T>(this GuiTree Tree, string Name, int TypeId)
     where T : class
 {
     return(findByNameExTemplate <T>(Name, TypeId, Tree.FindByNameEx));
 }
 public SC_4002_Texts()
 {
     _tree = SAPTestHelper.Current.MainWindow.FindByName<GuiContainerShell>("shellcont[0]").FindByName<GuiTree>("shell");
 }
Exemple #13
0
 public static IEnumerable <T> FindDescendantsByProperty <T>(this GuiTree Tree, Func <T, bool> Property = null)
     where T : class
 {
     return(findDescendantsByPropertyTemplate <T>(Tree.Children, Property));
 }
 public SC_4002_Texts()
 {
     _tree = SAPTestHelper.Current.MainWindow.FindByName <GuiContainerShell>("shellcont[0]").FindByName <GuiTree>("shell");
 }