示例#1
0
        private TreeNode AddClassTreeNode2(TreeNode rootNode, ObjectClassDescriptor objDescriptor)
        {
            TreeNodeCollection parentNodes;

            if (objDescriptor == null)
            {
                TreeNode parentNode = FindNode(rootNode.Nodes, "HLAobjectRoot");
                if (parentNode == null)
                {
                    //tv.ImageList = imageList1;

                    parentNode                    = new TreeNode("HLAobjectRoot");
                    parentNode.Name               = "HLAobjectRoot";
                    parentNode.ImageIndex         = 0;
                    parentNode.SelectedImageIndex = 0;

                    //tv.Nodes.Add(parentNode);
                    rootNode.Nodes.Add(parentNode);
                }
                return(parentNode);
            }
            else if (objDescriptor.ParentDescriptors.Count != 0)
            {
                TreeNode parentNode = AddClassTreeNode2(rootNode, objDescriptor.ParentDescriptors[0]);
                parentNodes = parentNode.Nodes;
            }
            else
            {
                //parentNodes = tv.Nodes;
                parentNodes = rootNode.Nodes;
            }

            TreeNode tmpNode = FindNode(parentNodes, objDescriptor.Name);

            if (tmpNode != null)
            {
                return(tmpNode);
            }
            else
            {
                TreeNode node = new TreeNode(objDescriptor.Name);
                node.ImageIndex         = 0;
                node.SelectedImageIndex = 0;
                HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(objDescriptor.objectDescription, null);
                node.Tag = nodeInfo;

                foreach (AttributeDescriptor attributeDescriptor in objDescriptor.AttributeDescriptors)
                {
                    TreeNode nodeAttr = new TreeNode(attributeDescriptor.Name);
                    HLAAttributePropertiesInformation nodeAttrInfo = new HLAAttributePropertiesInformation(attributeDescriptor.attribute, null);
                    nodeAttr.ImageIndex         = 2;
                    nodeAttr.SelectedImageIndex = 2;
                    nodeAttr.Tag = nodeAttrInfo;
                    node.Nodes.Add(nodeAttr);
                }
                parentNodes.Add(node);

                return(node);
            }
        }
示例#2
0
        private TreeNode AddClassTreeNode2(TreeNode rootNode, ObjectClassDescriptor objDescriptor)
        {
            TreeNodeCollection parentNodes;
            if (objDescriptor == null)
            {
                TreeNode parentNode = FindNode(rootNode.Nodes, "HLAobjectRoot");
                if (parentNode == null)
                {
                    //tv.ImageList = imageList1;

                    parentNode = new TreeNode("HLAobjectRoot");
                    parentNode.Name = "HLAobjectRoot";
                    parentNode.ImageIndex = 0;
                    parentNode.SelectedImageIndex = 0;

                    //tv.Nodes.Add(parentNode);
                    rootNode.Nodes.Add(parentNode);
                }
                return parentNode;
            }
            else if (objDescriptor.ParentDescriptors.Count != 0)
            {
                TreeNode parentNode = AddClassTreeNode2(rootNode, objDescriptor.ParentDescriptors[0]);
                parentNodes = parentNode.Nodes;
            }
            else
                //parentNodes = tv.Nodes;
                parentNodes = rootNode.Nodes;

            TreeNode tmpNode = FindNode(parentNodes, objDescriptor.Name);
            if (tmpNode != null)
                return tmpNode;
            else
            {
                TreeNode node = new TreeNode(objDescriptor.Name);
                node.ImageIndex = 0;
                node.SelectedImageIndex = 0;
                HLAObjectClassPropertiesInformation nodeInfo = new HLAObjectClassPropertiesInformation(objDescriptor.objectDescription, null);
                node.Tag = nodeInfo;

                foreach (AttributeDescriptor attributeDescriptor in objDescriptor.AttributeDescriptors)
                {
                    TreeNode nodeAttr = new TreeNode(attributeDescriptor.Name);
                    HLAAttributePropertiesInformation nodeAttrInfo = new HLAAttributePropertiesInformation(attributeDescriptor.attribute, null);
                    nodeAttr.ImageIndex = 2;
                    nodeAttr.SelectedImageIndex = 2;
                    nodeAttr.Tag = nodeAttrInfo;
                    node.Nodes.Add(nodeAttr);
                }
                parentNodes.Add(node);

                return node;
            }
        }