コード例 #1
0
ファイル: Topic.cs プロジェクト: FubuMvcArchive/FubuDocs
        public void RemoveChild(Topic child)
        {
            List <Topic> children = ChildNodes.ToList();

            children.Remove(child);

            child._parent   = null;
            child._previous = null;
            child._next     = null;


            if (!children.Any())
            {
                _firstChild = null;
                return;
            }

            _firstChild           = children.First();
            _firstChild._parent   = this;
            _firstChild._previous = null;

            children.Last()._next = null;

            for (int i = 1; i < children.Count; i++)
            {
                children[i]._previous = children[i - 1];
            }

            for (int i = 0; i < children.Count - 1; i++)
            {
                children[i]._next = children[i + 1];
            }
        }
コード例 #2
0
ファイル: DomElement.cs プロジェクト: Carbonfrost/f-web-dom
        protected override DomObject SetNameCore(DomName name)
        {
            var newElement = OwnerDocument.CreateElement(name);

            newElement.Append(ChildNodes.ToList());
            newElement.Attributes.AddRange(Attributes.ToList());
            newElement.CopyAnnotationsFrom(AnnotationList);
            return(ReplaceWith(newElement));
        }
コード例 #3
0
        internal IEnumerable <DomNode> UnwrapCore()
        {
            AssertCanUnwrap();

            if (ChildNodes.Count == 0)
            {
                RemoveSelf();
                return(Enumerable.Empty <DomNode>());
            }

            var items = ChildNodes.ToList();

            ReplaceWith(items);
            return(items);
        }
コード例 #4
0
ファイル: RealignMap.cs プロジェクト: chris-tomich/Glyma
        // Find the left most node(s) -- parent nodes. Perpare all the child nodes for finding the relationships between them
        private void Initialise(RealignStyle realignStyle = RealignStyle.Horizontal)
        {
            foreach (var nodeControl in _nodeControls)
            {
                var realignNode = new RealignNode(nodeControl);

                if (nodeControl.ParentNodes.Count == 0)
                {
                    AddChild(realignNode);
                }
                else
                {
                    _nodesNeedToBePlaced.Add(realignNode);
                }
            }

            //If no parent can be found, set the top left node to parent
            if (ChildNodes.Count == 0)
            {
                AddTopLeftNodeToParentNode();
            }
            PlaceNodesToMap(realignStyle);
            ReCheckForIncorrectDepth(realignStyle);

            if (_isPartlyRealign)
            {
                var nodesToLoop = ChildNodes.ToList();
                foreach (var realignNode in nodesToLoop)
                {
                    if (!realignNode.HasChild)
                    {
                        ChildNodes.Remove(realignNode);
                    }
                }
            }
        }