Ejemplo n.º 1
0
        public void RemoveAt(int index)
        {
            TreeNode node = this._list[index];

            if (this._updateParent)
            {
                TreeView owner = node.Owner;
                if (owner != null)
                {
                    if (owner.CheckedNodes.Count != 0)
                    {
                        UnCheckUnSelectRecursive(node);
                    }
                    else
                    {
                        for (TreeNode node2 = owner.SelectedNode; node2 != null; node2 = node2.Parent)
                        {
                            if (node2 == node)
                            {
                                owner.SetSelectedNode(null);
                                break;
                            }
                        }
                    }
                }
                node.SetParent(null);
            }
            this._list.RemoveAt(index);
            this._version++;
            this.Log.Add(new LogItem(LogItemType.Remove, index, this._isTrackingViewState));
        }
Ejemplo n.º 2
0
 public void AddAt(int index, TreeNode child)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child");
     }
     if (this._updateParent)
     {
         if ((child.Owner != null) && (child.Parent == null))
         {
             child.Owner.Nodes.Remove(child);
         }
         if (child.Parent != null)
         {
             child.Parent.ChildNodes.Remove(child);
         }
         if (this._owner != null)
         {
             child.SetParent(this._owner);
             child.SetOwner(this._owner.Owner);
         }
     }
     this._list.Insert(index, child);
     this._version++;
     if (this._isTrackingViewState)
     {
         ((IStateManager)child).TrackViewState();
         child.SetDirty();
     }
     this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState));
 }
 public void AddAt(int index, TreeNode child)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child");
     }
     if (this._updateParent)
     {
         if ((child.Owner != null) && (child.Parent == null))
         {
             child.Owner.Nodes.Remove(child);
         }
         if (child.Parent != null)
         {
             child.Parent.ChildNodes.Remove(child);
         }
         if (this._owner != null)
         {
             child.SetParent(this._owner);
             child.SetOwner(this._owner.Owner);
         }
     }
     this._list.Insert(index, child);
     this._version++;
     if (this._isTrackingViewState)
     {
         ((IStateManager) child).TrackViewState();
         child.SetDirty();
     }
     this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState));
 }
		public void Add (TreeNode child)
		{
			child.Index = items.Add (child);
			child.Tree = tree;
			child.SetParent (parent);
			if (marked) {
				child.TrackViewState ();
				child.SetDirty ();
				dirty = true;
			}
		}
Ejemplo n.º 5
0
 public void AddAt(int index, TreeNode child)
 {
     items.Insert(index, child);
     child.Index = index;
     child.SetParent(parent);
     child.Tree = tree;
     for (int n = index + 1; n < items.Count; n++)
     {
         ((TreeNode)items[n]).Index = n;
     }
     if (marked)
     {
         ((IStateManager)child).TrackViewState();
         SetDirty();
     }
 }
Ejemplo n.º 6
0
        public void RemoveAt(int index)
        {
            TreeNode node = _list[index];

            if (_updateParent)
            {
                TreeView owner = node.Owner;
                if (owner != null)
                {
                    if (owner.CheckedNodes.Count != 0)
                    {
                        // We have to scan the whole tree of subnodes to remove any checked nodes
                        // (and unselect the selected node if it is a descendant).
                        // That could badly hurt performance, except that removing a node is a pretty
                        // exceptional event.
                        UnCheckUnSelectRecursive(node);
                    }
                    else
                    {
                        // otherwise, we can just climb the tree up from the selected node
                        // to see if it is a descendant of the removed node.
                        TreeNode current = owner.SelectedNode;
                        // Check if the selected item is under this collection
                        while (current != null)
                        {
                            if (current == node)
                            {
                                owner.SetSelectedNode(null);
                                break;
                            }
                            current = current.Parent;
                        }
                    }
                }
                node.SetParent(null);
            }

            _list.RemoveAt(index);
            _version++;
            Log.Add(new LogItem(LogItemType.Remove, index, _isTrackingViewState));
        }
Ejemplo n.º 7
0
        internal void Add(TreeNode child, bool updateParent)
        {
            int index = items.Add(child);

            if (parent != null)
            {
                parent.HadChildrenBeforePopulating = true;
            }

            if (!updateParent)
            {
                return;
            }

            child.Index = index;
            child.SetParent(parent);
            child.Tree = tree;
            if (marked)
            {
                ((IStateManager)child).TrackViewState();
                SetDirty();
            }
        }
Ejemplo n.º 8
0
		public void AddAt (int index, TreeNode child)
		{
			items.Insert (index, child);
			child.Index = index;
			child.SetParent (parent);
			child.Tree = tree;
			for (int n=index+1; n<items.Count; n++)
				((TreeNode)items[n]).Index = n;
			if (marked) {
				((IStateManager)child).TrackViewState ();
				SetDirty ();
			}
		}
Ejemplo n.º 9
0
		internal void Add (TreeNode child, bool updateParent)
		{
			int index = items.Add (child);

			if (parent != null)
				parent.HadChildrenBeforePopulating = true;
			
			if (!updateParent)
				return;

			child.Index = index;
			child.SetParent (parent);
			child.Tree = tree;
			if (marked) {
				((IStateManager)child).TrackViewState ();
				SetDirty ();
			}
		}