Esempio n. 1
0
        internal static IEnumerable <ITreeNode> SelectData(TableSelector selector, ITreeNodeCreator creator,
                                                           Action action, string stateId)
        {
            DataTable table = selector.HostTable;
            int       start = table == null ? 0 : table.Rows.Count;

            action();
            if (table == null)
            {
                table = selector.HostTable;
            }
            int end = table.Rows.Count;

            for (int i = start; i < end; i++)
            {
                DataRow         row  = table.Rows[i];
                DataRowTreeNode node = creator.CreateNode(row);
                if (node.Id == stateId)
                {
                    node.State = new TreeNodeState {
                        Opened = true, Selected = true
                    };
                }
                yield return(node);
            }
        }
Esempio n. 2
0
 private IEnumerable <ITreeNode> GetRootNodes(DataTable table, int start, int end)
 {
     for (int i = start; i < end; i++)
     {
         DataRow         row  = table.Rows[i];
         DataRowTreeNode node = CreateNode(row);
         yield return(node);
     }
 }
Esempio n. 3
0
        internal static IEnumerable <ITreeNode> GetDisplayTreeNodes(IEnumerable <ITreeNode> data, string id)
        {
            RegNameList <DataRowTreeNode> list = new RegNameList <DataRowTreeNode>();

            foreach (DataRowTreeNode item in data)
            {
                list.Add(item);
            }

            DataRowTreeNode newNode = list[id];

            while (newNode != null)
            {
                newNode = list[newNode.ParentId];
                if (newNode != null)
                {
                    newNode.HasChild = null;
                }
            }

            return(list);
        }