Esempio n. 1
0
        private void build( TreeNodeCollection from , TreeNodeCollection to , TreeNode parent )
        {
            TreeNodeCollection childNodes = from.SearchByParentId( parent.Id ) ;

            foreach( TreeNode n in childNodes )
            {
                to.Add(n);
                this.build( from , n.ChildNodes , n ) ;
            }
        }
Esempio n. 2
0
        private TreeNodeCollection GetRootNodes( TreeNodeCollection nodes )
        {
            TreeNodeCollection tempnodes = new TreeNodeCollection ();

            foreach( TreeNode n in nodes )
            {
                if( nodes.ExistByParentId( n.Id ) )
                    tempnodes.Add(n);
            }

            return tempnodes ;
        }
Esempio n. 3
0
        public void BuildNodes( TreeNodeCollection nodes  , System.Collections.IEnumerable list )
        {
            TreeNodeCollection tempnodes = new TreeNodeCollection ();

            System.Collections.IEnumerator lt = list.GetEnumerator();

            while( lt.MoveNext() )
            {
                object o = lt.Current ;

                tempnodes.Add( _c.ToTreeNode( o ) );
            }

            TreeNodeCollection roots = this.GetRootNodes( tempnodes ) ;

            foreach( TreeNode n in roots )
            {
                nodes.Add( n );
                this.build( tempnodes , n.ChildNodes , n ) ;
            }
        }
Esempio n. 4
0
        public TreeNodeCollection SearchByParentId( string parentId )
        {
            TreeNodeCollection nodes = new TreeNodeCollection ();

            foreach( TreeNode n in this )
            {
                if( n.ParentId == parentId )
                    nodes.Add( n ) ;
            }

            return nodes ;
        }