Exemplo n.º 1
0
        public bool AdoptChild(Node ChildNode)
        {
            if (!((type_ != null) && (ChildNode.type_ != null)))
            {
                return(false);
            }
            Node node = lastChild;

            ChildNode.level = level + 1;
            if (node != null)
            {
                ChildNode.childIndex  = node.childIndex + 1;
                ChildNode.prevSibling = node;
                ChildNode.nextSibling = null;
                ChildNode.parent_     = this;
                lastChild             = ChildNode;
                node.nextSibling      = ChildNode;
            }
            else
            {
                ChildNode.childIndex  = 0;
                ChildNode.prevSibling = null;
                ChildNode.nextSibling = null;
                ChildNode.parent_     = this;
                firstChild            = ChildNode;
                lastChild             = ChildNode;
            }
            numChildren++;
            ChildNode.EmbraceParent();
            return(true);
        }
Exemplo n.º 2
0
        public bool PrependNode(Node node)
        {
            if (!(((parent_ != null) && (parent_.type_ != null)) && (node.type_ != null)))
            {
                return(false);
            }
            Node nextSibling = this.nextSibling;
            Node prevSibling = this.prevSibling;

            Node parent = this.parent_;

            node.level = parent.level + 1;

            if (prevSibling == null)
            {
                node.childIndex   = 0;
                node.prevSibling  = null;
                node.nextSibling  = this;
                node.parent_      = parent;
                parent.firstChild = node;
                this.prevSibling  = node;
                childIndex++;
                while (nextSibling != null)
                {
                    nextSibling.childIndex++;
                    nextSibling = nextSibling.nextSibling;
                }
            }
            else
            {
                node.childIndex         = prevSibling.childIndex + 1;
                node.prevSibling        = prevSibling;
                node.nextSibling        = this;
                node.parent_            = parent;
                prevSibling.nextSibling = node;
                this.prevSibling        = node;
                childIndex++;
                while (nextSibling != null)
                {
                    nextSibling.childIndex++;
                    nextSibling = nextSibling.nextSibling;
                }
            }
            if (((prevSibling != null) && prevSibling.HasStyleClass()) && (prevSibling.StyleClass.Length > 0))
            {
                node.StyleClass = prevSibling.StyleClass;
            }
            node.EmbraceParent();
            parent.numChildren++;
            return(true);
        }
Exemplo n.º 3
0
 public void EmbraceParent()
 {
     if (firstChild != null)
     {
         NodesList list = GetChildrenNodes();
         for (Node n = list.Next(); n != null; n = list.Next())
         {
             n.parent_ = this;
             if (n.firstChild != null)
             {
                 n.EmbraceParent();
             }
         }
     }
 }
Exemplo n.º 4
0
        public void ReplaceChild(Node oldChild, Node newChild)
        {
            newChild.prevSibling = oldChild.prevSibling;
            newChild.nextSibling = oldChild.nextSibling;
            newChild.lowerNode   = oldChild.lowerNode;
            newChild.upperNode   = oldChild.upperNode;
            if (oldChild.prevSibling != null)
            {
                oldChild.prevSibling.nextSibling = newChild;
            }
            if (oldChild.nextSibling != null)
            {
                oldChild.nextSibling.prevSibling = newChild;
            }
            if (oldChild.upperNode != null)
            {
                oldChild.upperNode.lowerNode = newChild;
            }
            if (oldChild.lowerNode != null)
            {
                oldChild.lowerNode.upperNode = newChild;
            }
            if (firstChild == oldChild)
            {
                firstChild = newChild;
            }
            if (lastChild == oldChild)
            {
                lastChild = newChild;
            }
            newChild.level        = oldChild.level;
            newChild.childIndex   = oldChild.childIndex;
            newChild.displayStyle = displayStyle;

            newChild.glyph = glyph;

            newChild.scriptLevel_ = scriptLevel_;

            newChild.parent_ = this;
            newChild.EmbraceParent();
        }
Exemplo n.º 5
0
        public void ReplaceChild(Node oldChild, Node newChild)
        {
            newChild.prevSibling = oldChild.prevSibling;
            newChild.nextSibling = oldChild.nextSibling;
            newChild.lowerNode = oldChild.lowerNode;
            newChild.upperNode = oldChild.upperNode;
            if (oldChild.prevSibling != null)
            {
                oldChild.prevSibling.nextSibling = newChild;
            }
            if (oldChild.nextSibling != null)
            {
                oldChild.nextSibling.prevSibling = newChild;
            }
            if (oldChild.upperNode != null)
            {
                oldChild.upperNode.lowerNode = newChild;
            }
            if (oldChild.lowerNode != null)
            {
                oldChild.lowerNode.upperNode = newChild;
            }
            if (firstChild == oldChild)
            {
                firstChild = newChild;
            }
            if (lastChild == oldChild)
            {
                lastChild = newChild;
            }
            newChild.level = oldChild.level;
            newChild.childIndex = oldChild.childIndex;
            newChild.displayStyle = displayStyle;

            newChild.glyph = glyph;

            newChild.scriptLevel_ = scriptLevel_;

            newChild.parent_ = this;
            newChild.EmbraceParent();
        }
Exemplo n.º 6
0
 public bool AppendNode(Node node)
 {
     if (! (((parent_ != null) && (parent_.type_ != null)) && (node.type_ != null)))
     {
         return false;
     }
     Node nextSibling = this.nextSibling;
     Node parent = this.parent_;
     node.level = parent.level + 1;
     if (nextSibling == null)
     {
         node.childIndex = childIndex + 1;
         node.prevSibling = this;
         node.nextSibling = null;
         node.parent_ = parent;
         parent.lastChild = node;
         this.nextSibling = node;
     }
     else
     {
         node.childIndex = childIndex + 1;
         node.prevSibling = this;
         nextSibling.prevSibling = node;
         node.nextSibling = nextSibling;
         node.parent_ = parent;
         this.nextSibling = node;
         while (nextSibling != null)
         {
             nextSibling.childIndex++;
             nextSibling = nextSibling.nextSibling;
         }
     }
     if (HasStyleClass() && (StyleClass.Length > 0))
     {
         node.StyleClass = StyleClass;
     }
     node.EmbraceParent();
     parent.numChildren++;
     return true;
 }
Exemplo n.º 7
0
 public bool AdoptChild(Node ChildNode)
 {
     if (! ((type_ != null) && (ChildNode.type_ != null)))
     {
         return false;
     }
     Node node = lastChild;
     ChildNode.level = level + 1;
     if (node != null)
     {
         ChildNode.childIndex = node.childIndex + 1;
         ChildNode.prevSibling = node;
         ChildNode.nextSibling = null;
         ChildNode.parent_ = this;
         lastChild = ChildNode;
         node.nextSibling = ChildNode;
     }
     else
     {
         ChildNode.childIndex = 0;
         ChildNode.prevSibling = null;
         ChildNode.nextSibling = null;
         ChildNode.parent_ = this;
         firstChild = ChildNode;
         lastChild = ChildNode;
     }
     numChildren++;
     ChildNode.EmbraceParent();
     return true;
 }