Exemplo n.º 1
0
        public void AddAfterSelf(object content)
        {
            if (Owner == null)
            {
                throw new InvalidOperationException();
            }
            XNode here    = this;
            XNode orgNext = next;

            foreach (object o in XUtil.ExpandArray(content))
            {
                if (o == null || Owner.OnAddingObject(o, true, here, false))
                {
                    continue;
                }
                XNode n = XUtil.ToNode(o);
                Owner.OnAddingObject(n);
                n = (XNode)XUtil.GetDetachedObject(n);
                n.SetOwner(Owner);
                n.previous = here;
                here.next  = n;
                n.next     = orgNext;
                if (orgNext != null)
                {
                    orgNext.previous = n;
                }
                else
                {
                    Owner.LastNode = n;
                }
                here = n;
                Owner.OnAddedObject(n);
            }
        }
Exemplo n.º 2
0
        public void AddBeforeSelf(object content)
        {
            if (Owner == null)
            {
                throw new InvalidOperationException();
            }
            foreach (object o in XUtil.ExpandArray(content))
            {
                if (o == null || Owner.OnAddingObject(o, true, previous, true))
                {
                    continue;
                }

                XNode n = XUtil.ToNode(o);
                Owner.OnAddingObject(n);
                n = (XNode)XUtil.GetDetachedObject(n);
                n.SetOwner(Owner);
                n.previous = previous;
                n.next     = this;
                if (previous != null)
                {
                    previous.next = n;
                }
                previous = n;
                if (Owner.FirstNode == this)
                {
                    Owner.FirstNode = n;
                }
                Owner.OnAddedObject(n);
            }
        }
Exemplo n.º 3
0
		void AddNode (XNode n)
		{
			CheckChildType (n, false);
			n = (XNode) XUtil.GetDetachedObject (n);
			n.SetOwner (this);
			if (first == null)
				last = first = n;
			else {
				last.NextNode = n;
				n.PreviousNode = last;
				last = n;
			}
		}
Exemplo n.º 4
0
 void AddNode(XNode n)
 {
     CheckChildType(n, false);
     n = (XNode)XUtil.GetDetachedObject(n);
     n.SetOwner(this);
     if (first == null)
     {
         last = first = n;
     }
     else
     {
         last.NextNode  = n;
         n.PreviousNode = last;
         last           = n;
     }
 }
Exemplo n.º 5
0
		public void AddBeforeSelf (object content)
		{
			if (Parent == null)
				throw new InvalidOperationException ();
			foreach (object o in XUtil.ExpandArray (content)) {
				if (Owner.OnAddingObject (o, true, previous, true))
					continue;
				XNode n = XUtil.ToNode (o);
				n = (XNode) XUtil.GetDetachedObject (n);
				n.SetOwner (Parent);
				n.previous = previous;
				n.next = this;
				if (previous != null)
					previous.next = n;
				previous = n;
				if (Parent.FirstNode == this)
					Parent.FirstNode = n;
			}
		}
Exemplo n.º 6
0
        public void ReplaceWith(object content)
        {
            if (Owner == null)
            {
                throw new InvalidOperationException();
            }

            XNode      here     = previous;
            XNode      orgNext  = next;
            XContainer orgOwner = Owner;

            Remove();
            foreach (object o in XUtil.ExpandArray(content))
            {
                if (o == null || orgOwner.OnAddingObject(o, true, here, false))
                {
                    continue;
                }
                XNode n = XUtil.ToNode(o);
                n = (XNode)XUtil.GetDetachedObject(n);
                n.SetOwner(orgOwner);
                n.previous = here;
                if (here != null)
                {
                    here.next = n;
                }
                else
                {
                    orgOwner.FirstNode = n;
                }
                n.next = orgNext;
                if (orgNext != null)
                {
                    orgNext.previous = n;
                }
                else
                {
                    orgOwner.LastNode = n;
                }
                here = n;
            }
        }