コード例 #1
0
        private bool FilterTags(object item)
        {
            bool       show = false;
            CLVTagNode node = item as CLVTagNode;

            if (node != null)
            {
                show = true;
                if (!string.IsNullOrWhiteSpace(m_lowercaseTagFilter))
                {
                    show = node.Label.ToLower().Contains(m_lowercaseTagFilter);
                }

                // One last chance to change whether this tag is shown - if there are any children nodes..
                if (show == false && node.Children.IsEmpty == false)
                {
                    show = true;
                }

                if (show == false)
                {
                    node.IsSelected = false;
                }
            }

            return(show);
        }
コード例 #2
0
        public CLVBaseNode GetNode(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentException("Node path cannot be empty.", "path");
            }

            CLVBaseNode foundNode = null;

            string[] splitPath = path.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

            // Get the starting parent:
            if (splitPath.Length > 0)
            {
                foundNode = FindTopLevelTag(splitPath[0]);
                if (foundNode == null)
                {
                    foundNode = new CLVTagNode(splitPath[0]);
                    m_tagNodeCollection.Add(foundNode);

                    QueueRefilter();
                }

                foundNode = GetChildNode(splitPath, foundNode);
            }

            return(foundNode);
        }
コード例 #3
0
        private bool ShouldFilterNode(CLVBaseNode node, string filter)
        {
            bool             shouldFilter  = false;
            CLVTagNode       tagNode       = node as CLVTagNode;
            CLVComponentNode componentNode = node as CLVComponentNode;

            if (tagNode != null)
            {
                if (FilterBy == FilterType.Component)
                {
                    tagNode.Children.Filter = ApplyFilter;
                    if (tagNode.Children.IsEmpty)
                    {
                        shouldFilter = true;
                    }
                }
                else
                {
                    shouldFilter = !MatchLabel(tagNode, filter);
                }
            }
            else if (componentNode != null)
            {
                if (FilterBy == FilterType.Component)
                {
                    shouldFilter = !MatchLabel(componentNode, filter);
                }
            }

            return(shouldFilter);
        }
コード例 #4
0
        private CLVBaseNode GetChildNode(string[] splitPath, CLVBaseNode parent)
        {
            for (int i = 1; i < splitPath.Length; ++i)
            {
                var found = parent.AllChildren.FirstOrDefault(o => { return(o.Label.Equals(splitPath[i], StringComparison.CurrentCultureIgnoreCase)); });
                if (found == null)
                {
                    found = new CLVTagNode(splitPath[i]);
                    parent.AddChild(found);
                }

                parent = found;
            }

            return(parent);
        }
コード例 #5
0
        private CLVBaseNode GetChildNode(string[] splitPath, CLVBaseNode parent)
        {
            for (int i = 1; i < splitPath.Length; ++i)
            {
                var found = parent.AllChildren.FirstOrDefault(o => { return o.Label.Equals(splitPath[i], StringComparison.CurrentCultureIgnoreCase); });
                if (found == null)
                {
                    found = new CLVTagNode(splitPath[i]);
                    //m_tagNodeCollection.Add(found);
                    parent.AddChild(found);

                    QueueRefilter();
                }

                parent = found;
            }

            return parent;
        }
コード例 #6
0
        public CLVBaseNode GetNode(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
                throw new ArgumentException("Node path cannot be empty.", "path");

            CLVBaseNode foundNode = null;
            string[] splitPath = path.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

            // Get the starting parent:
            if (splitPath.Length > 0)
            {
                foundNode = FindTopLevelTag(splitPath[0]);
                if (foundNode == null)
                {
                    foundNode = new CLVTagNode(splitPath[0]);
                    m_tagNodeCollection.Add(foundNode);

                    QueueRefilter();
                }

                foundNode = GetChildNode(splitPath, foundNode);
            }

            return foundNode;
        }