Пример #1
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is StructureElementTreeNode)
            {
                StructureElementTreeNode structureElementTreeNode = SourceNode as StructureElementTreeNode;
                DataDictionary.Types.StructureElement element     = structureElementTreeNode.Item;

                structureElementTreeNode.Delete();
                AddElement(element);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.StructureElement element = (DataDictionary.Types.StructureElement)DataDictionary.Generated.acceptor.getFactory().createStructureElement();
                element.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                element.appendRequirements(reqRef);
                AddElement(element);
            }
        }
        /// <summary>
        ///     Builds the subnodes of this node
        /// </summary>
        /// <param name="subNodes"></param>
        /// <param name="recursive">Indicates whether the subnodes of the nodes should also be built</param>
        public override void BuildSubNodes(List <BaseTreeNode> subNodes, bool recursive)
        {
            // Do not use the base version
            SubNodesBuilt = true;

            foreach (StructureElement structureElement in Item.Elements)
            {
                StructureElementTreeNode aNode = new StructureElementTreeNode(structureElement, recursive);
                if (Item.StructureElementIsInherited(structureElement))
                {
                    aNode.NodeFont = new Font("Arial", 8, FontStyle.Italic);
                }
                subNodes.Add(aNode);
            }
            subNodes.Sort();
        }
        /// <summary>
        ///     Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is StructureElementTreeNode)
            {
                StructureElementTreeNode structureElementTreeNode = sourceNode as StructureElementTreeNode;
                StructureElement         element = structureElementTreeNode.Item;

                structureElementTreeNode.Delete();
                Item.appendElements(element);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                StructureElement element = StructureElement.CreateDefault(Item.Elements);
                Item.appendElements(element);
                element.FindOrCreateReqRef(paragraph);
            }
        }