Exemplo n.º 1
0
        public FilterTagsTreeNode(FilterTagsTreeNode InParent, FAllocationTagHierarchy.INode InAllocTagNode)
        {
            Parent = InParent;
            if (Parent != null)
            {
                Parent.Children.Add(this);
            }

            AllocTagNode = InAllocTagNode;
        }
Exemplo n.º 2
0
        private bool BuildInternalTree(string[] InFilterTerms, FAllocationTagHierarchy.INode InParentAllocTagNode, FilterTagsTreeNode InParentInternalNode)
        {
            bool bIsFiltering = InFilterTerms != null && InFilterTerms.Length > 0;

            foreach (var ChildAllocTagNode in InParentAllocTagNode.GetChildNodes())
            {
                var ChildInternalNode = new FilterTagsTreeNode(null, ChildAllocTagNode);                 // Don't set the parent yet as we might not add it to the tree
                if (BuildInternalTree(InFilterTerms, ChildAllocTagNode, ChildInternalNode))
                {
                    // Link the node now
                    ChildInternalNode.Parent = InParentInternalNode;
                    InParentInternalNode.Children.Add(ChildInternalNode);
                }
            }

            foreach (var ChildAllocTag in InParentAllocTagNode.GetChildTags())
            {
                var  AllocTag = ChildAllocTag.GetTag().Value;
                bool bChildTagNamePassesFilter = true;

                if (bIsFiltering)
                {
                    var FullTagName = AllocTag.Name.ToLower();
                    foreach (var FilterTerm in InFilterTerms)
                    {
                        if (!FullTagName.Contains(FilterTerm))
                        {
                            bChildTagNamePassesFilter = false;
                            break;
                        }
                    }
                }

                if (bChildTagNamePassesFilter)
                {
                    var ChildInternalNode = new FilterTagsTreeNode(InParentInternalNode, ChildAllocTag);
                }
            }

            return(InParentInternalNode.Children.Count > 0);
        }
Exemplo n.º 3
0
        private void PopulateTagFilterHierarchy(string[] InFilterTerms)
        {
            UseWaitCursor = true;

            // Build the internal tree
            {
                InternalTreeRoot = new FilterTagsTreeNode(null);

                var RootNode = FStreamInfo.GlobalInstance.TagHierarchy.GetRootNode();
                BuildInternalTree(InFilterTerms, RootNode, InternalTreeRoot);
            }

            // Build the WinForm tree
            if (FilterTagsTreeView.Handle != null)             // This if statement exists to force the native tree view handle to be created
            {
                bool bIsFiltering = InFilterTerms != null && InFilterTerms.Length > 0;

                FilterTagsTreeView.BeginUpdate();

                FilterTagsTreeView.AfterCheck   -= FilterTagsTreeView_AfterCheck;
                FilterTagsTreeView.BeforeExpand -= FilterTagsTreeView_BeforeExpand;

                FilterTagsTreeView.Nodes.Clear();
                BuildFilterTagsTree(InternalTreeRoot, FilterTagsTreeView.Nodes, bIsFiltering);
                UpdateCheckboxState(FilterTagsTreeView.Nodes);

                if (bIsFiltering)
                {
                    FilterTagsTreeView.ExpandAll();
                }

                FilterTagsTreeView.AfterCheck   += FilterTagsTreeView_AfterCheck;
                FilterTagsTreeView.BeforeExpand += FilterTagsTreeView_BeforeExpand;

                FilterTagsTreeView.EndUpdate();
            }

            UseWaitCursor = false;
        }
Exemplo n.º 4
0
        private void BuildFilterTagsTree(FilterTagsTreeNode InParentInternalNode, TreeNodeCollection InTreeNodesList, bool bRecursive)
        {
            foreach (var ChildInternalNode in InParentInternalNode.Children)
            {
                var ChildTreeNode = new TreeNode(ChildInternalNode.AllocTagNode.GetNodeName());
                ChildTreeNode.Tag = ChildInternalNode;

                if (bRecursive)
                {
                    BuildFilterTagsTree(ChildInternalNode, ChildTreeNode.Nodes, bRecursive);
                }
                else
                {
                    // Add a dummy child node if needed so that we still get an expansion arrow
                    if (ChildInternalNode.Children.Count > 0)
                    {
                        ChildTreeNode.Nodes.Add(new TreeNode());
                    }
                }

                InTreeNodesList.Add(ChildTreeNode);
            }
        }