Esempio n. 1
0
        /// <summary>
        /// Correct children.
        /// </summary>
        public virtual bool CorrectChildren()
        {
            bool bRet = false;

            for (int i = this.Children.Count - 1; i >= 0; i--)
            {
                NodeShape shape = this.Children[i];
                if (!this.CanHostShape(shape.GetDomainClassId()))
                {
                    shape.Delete();
                    bRet = true;
                }
                else if (shape.CorrectChildren())
                {
                    bRet = true;
                }
            }

            foreach (Diagram d in this.IncludedDiagrams)
            {
                if (d.CorrectChildren())
                {
                    bRet = true;
                }
            }

            return(bRet);
        }
 public void DeleteShapesForElement(DomainModelElement modelElement)
 {
     if (modelElement != null)
     {
         List <Guid> shapes = DiagramsShapeStore.GetFromStore(modelElement.Id);
         if (shapes != null)
         {
             for (int i = shapes.Count - 1; i >= 0; i--)
             {
                 NodeShape shape = modelElement.Store.ElementDirectory.FindElement(shapes[i]) as NodeShape;
                 if (shape != null)
                 {
                     shape.Delete();
                 }
             }
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Correct the children elements.
        /// </summary>
        public virtual bool CorrectChildren()
        {
            bool bRet = false;

            for (int i = this.Children.Count - 1; i >= 0; i--)
            {
                NodeShape shape = this.Children[i];
                if (!this.CanHostShape(shape.GetDomainClassId()))
                {
                    shape.Delete();
                    bRet = true;
                }
                else
                {
                    if (shape.IsRelativeChildShape && !this.RelativeChildren.Contains(shape))
                    {
                        if (this.NestedChildren.Contains(shape))
                        {
                            this.NestedChildren.Remove(shape);
                        }
                        this.RelativeChildren.Add(shape);
                    }
                    else if (!shape.IsRelativeChildShape && !this.NestedChildren.Contains(shape))
                    {
                        if (this.RelativeChildren.Contains(shape))
                        {
                            this.RelativeChildren.Remove(shape);
                        }
                        this.NestedChildren.Add(shape);
                    }

                    shape.CorrectChildren();
                }
            }
            return(bRet);
        }