コード例 #1
0
ファイル: UTree.cs プロジェクト: YummyChiu/ModelView
 private void ResetItemsByNodeData(UTreeNodeData data, UTreeBranch branch)
 {
     if (data.Children != null)
     {
         foreach (UTreeNodeData child in data.Children)
         {
             if (child.IsBranch)
             {
                 UTreeBranch grandBranch = GetOneBranch();
                 grandBranch.Data = child;
                 branch.SetChild(grandBranch.tran);
                 foreach (UTreeNodeData grandChild in child.Children)
                 {
                     ResetItemsByNodeData(grandChild, grandBranch);
                 }
             }
             else
             {
                 UTreeLeaf leaf = GetOneLeaf();
                 //leaf.Data = data;
                 leaf.Data = child;
                 branch.SetChild(leaf.tran);
             }
         }
     }
     else
     {
         UTreeLeaf leaf = GetOneLeaf();
         //leaf.Data = data;
         leaf.Data = data;
         branch.SetChild(leaf.tran);
     }
 }
コード例 #2
0
        private void SetBranchData(UTreeNodeData data, UTreeBranch pBranch)
        {
            UTreeBranch branch = GetOneBranch();

            branch.Data = data;
            if (pBranch != null)
            {
                pBranch.SetChild(branch.tran);
            }
            else
            {
                branch.SetParent(content);
            }
            foreach (UTreeNodeData childData in data.Children)
            {
                if (childData.IsBranch)
                {
                    SetBranchData(childData, branch);
                }
                else
                {
                    SetLeafData(childData, branch);
                }
            }
        }
コード例 #3
0
        private void SetLeafData(UTreeNodeData data, UTreeBranch branch)
        {
            UTreeLeaf leaf = GetOneLeaf();

            leaf.Data = data;
            if (branch != null)
            {
                branch.SetChild(leaf.tran);
            }
            else
            {
                leaf.SetParent(content);
            }
        }
コード例 #4
0
ファイル: UTree.cs プロジェクト: YummyChiu/ModelView
 private void ResetTreeItem()
 {
     branchUsingIndex = 0;
     leafUsingIndex   = 0;
     foreach (UTreeNodeData data in nodeData)
     {
         if (data.IsBranch)
         {
             UTreeBranch branch = GetOneBranch();
             branch.Data = data;
             branch.SetParent(content);
             ResetItemsByNodeData(data, branch);
         }
         else
         {
             UTreeLeaf leaf = GetOneLeaf();
             leaf.Data = data;
             leaf.SetParent(content);
         }
     }
 }