Beispiel #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="factoryHelper">Factory helper.</param>
 /// <param name="deletionHelper">Deletion helper.</param>
 protected RolePlayerChangeHelper(ModelLinkAddRuleForRSShapes.RSShapesFactoryHelper factoryHelper, ModelElementDeletingRuleForRSShapes.ShapeDeletionHelper deletionHelper)
 {
     this.factoryHelper  = factoryHelper;
     this.deletionHelper = deletionHelper;
 }
Beispiel #2
0
        /// <summary>
        /// Creates missing links for the added shape.
        /// </summary>
        /// <param name="shapeAdded">Shape added.</param>
        public virtual void FixUpMissingLinkShapes(NodeShape shapeAdded)
        {
            DiagramDomainDataDirectory data = this.Store.DomainDataAdvDirectory.ResolveExtensionDirectory <DiagramDomainDataDirectory>();

            if (data == null)
            {
                throw new ArgumentNullException("DiagramDomainDataDirectory can not be null");
            }

            ShapeClassInfo info;

            data.ShapeClassInfos.TryGetValue(shapeAdded.GetDomainClass().Id, out info);
            if (info == null)
            {
                return;
            }

            ModelLinkAddRuleForRSShapes.RSShapesFactoryHelper        factory        = this.GetRSShapesFactoryHelper();
            ModelLinkAddRuleForMappingRSShapes.RSShapesFactoryHelper factoryMapping = this.GetMappingRSShapesFactoryHelper();

            if (factory != null)
            {
                if (info.RelationshipSourceRoleTypes.Count > 0)
                {
                    foreach (Guid rel in info.RelationshipSourceRoleTypes)
                    {
                        ReadOnlyCollection <DomainModelLink> links = DomainRoleInfo.GetElementLinks <DomainModelLink>(shapeAdded.Element, rel);
                        foreach (DomainModelLink link in links)
                        {
                            factory.AddRSShapesForElement(link);
                        }
                    }
                }

                if (info.RelationshipTargetRoleTypes.Count > 0)
                {
                    foreach (Guid rel in info.RelationshipTargetRoleTypes)
                    {
                        ReadOnlyCollection <DomainModelLink> links = DomainRoleInfo.GetElementLinks <DomainModelLink>(shapeAdded.Element, rel);
                        foreach (DomainModelLink link in links)
                        {
                            factory.AddRSShapesForElement(link);
                        }
                    }
                }
            }

            if (factoryMapping != null)
            {
                if (info.MappingRelationshipSourceRoleTypes.Count > 0)
                {
                    foreach (Guid rel in info.MappingRelationshipSourceRoleTypes)
                    {
                        ReadOnlyCollection <DomainModelLink> links = DomainRoleInfo.GetElementLinks <DomainModelLink>(shapeAdded.Element, rel);
                        foreach (DomainModelLink link in links)
                        {
                            factoryMapping.AddRSShapesForElement(link);
                        }
                    }
                }

                if (info.MappingRelationshipTargetRoleTypes.Count > 0)
                {
                    foreach (Guid rel in info.MappingRelationshipTargetRoleTypes)
                    {
                        ReadOnlyCollection <DomainModelLink> links = DomainRoleInfo.GetElementLinks <DomainModelLink>(shapeAdded.Element, rel);
                        foreach (DomainModelLink link in links)
                        {
                            factoryMapping.AddRSShapesForElement(link);
                        }
                    }
                }
            }

            foreach (Diagram d in this.IncludedDiagrams)
            {
                d.FixUpMissingLinkShapes(shapeAdded);
            }

            foreach (NodeShape s in shapeAdded.Children)
            {
                s.FixUpMissingLinkShapes();
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="factoryHelper">Factory helper.</param>
 /// <param name="deletionHelper">Deletion helper.</param>
 protected RolePlayerChangeHelper(ModelLinkAddRuleForRSShapes.RSShapesFactoryHelper factoryHelper, ModelElementDeletingRuleForRSShapes.ShapeDeletionHelper deletionHelper)
 {
     this.factoryHelper = factoryHelper;
     this.deletionHelper = deletionHelper;
 }