Esempio n. 1
0
        /// <summary>
        /// Removes the given node from the nodemap.
        /// </summary>
        /// <param name="node">Node to be removed.</param>
        public void removeNodeFromMap(goog.ui.tree.BaseNode node)
        {
            var labelText = node.getText();

            if (labelText != null &&
                !String.IsNullOrWhiteSpace(/*goog.string.makeSafe*/ (labelText)))
            {
                labelText = labelText.ToLowerCase();

                if (this.nodeMap_.TryGetValue(labelText, out var nodeList))
                {
                    // Remove the node's descendants from the nodemap.
                    var count = node.getChildCount();
                    for (var i = 0; i < count; i++)
                    {
                        this.removeNodeFromMap((BaseNode)node.getChildAt(i));
                    }
                    // Remove the node from the array.
                    nodeList.Remove(node);
                    if (nodeList.Length == 0)
                    {
                        this.nodeMap_.Remove(labelText);
                    }
                }
            }
        }