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); } }
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); } }
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; } }
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; } }
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; } }
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; } }