Ejemplo n.º 1
0
        internal JetListViewNode Add(object item, JetListViewNode parentNode)
        {
            lock (this)
            {
                _lastUpdatedNode = null;
                if (parentNode == null)
                {
                    parentNode = _rootNode;
                }

                if (parentNode != _rootNode)
                {
                    _flatList = false;
                }

                CollapseState oldCollapseState = parentNode.CollapseState;

                JetListViewNode node = new JetListViewNode(this, item);
                parentNode.AddChild(node);
                _nodeMap.Add(item, node);
                if (_filters != null)
                {
                    filtersAccept = _filters.AcceptNode(node);
                    node.SetFiltersAccept(filtersAccept);
                    if (!filtersAccept)
                    {
                        parentNode.UpdateUnacceptedChildCount();
                    }
                }
                OnNodeAdded(node);
                if (IsNodeVisible(node))
                {
                    OnVisibleNodeAdded(node);
                }
                if (parentNode != _rootNode && IsNodeVisible(parentNode) &&
                    oldCollapseState != parentNode.CollapseState)
                {
                    OnNodeChanged(parentNode);
                }
                return(node);
            }
        }
Ejemplo n.º 2
0
        internal void SetNodeParent(JetListViewNode childNode, JetListViewNode parentNode)
        {
            lock (this)
            {
                if (parentNode == null)
                {
                    parentNode = _rootNode;
                }
                if (parentNode != _rootNode)
                {
                    _flatList = false;
                }

                if (parentNode != childNode.Parent)
                {
                    childNode.Parent.RemoveChild(childNode);
                    parentNode.AddChild(childNode);
                    OnMultipleNodesChanged();
                }
            }
        }