Example #1
0
        private void addDiagrams(IComposite leaf)
        {
            DiagramCreationContext context = new DiagramCreationContext();

            foreach (String i in utiliti.fm.GetFiles(leaf.GetPath()))
            {
                leaf.Add((IComposite)context.CreateDiagram(i));
            }
        }
 /// <summary>
 /// Changes the owner of any IComponent
 /// </summary>
 public static void ChangeOwner( IComponent component, ref IComposite currentOwner, IComposite newOwner )
 {
     if ( currentOwner == newOwner )
     {
         return;
     }
     IComposite oldOwner = currentOwner;
     currentOwner = null;
     if ( oldOwner != null )
     {
         oldOwner.Remove( component );
     }
     if ( newOwner != null )
     {
         currentOwner = newOwner;
         newOwner.Add( component );
     }
 }
        /// <summary>
        /// Creates an instance of this type, and any dependencies
        /// </summary>
        public virtual void Create( IComposite composite )
        {
            Arguments.CheckNotNull( composite, "composite" );

            //	Remove existing model component in category
            //IModelTemplate existingTemplate = component.GetModelTemplate( m_Category.BaseType );
            //if ( existingTemplate != null )
            //{
            //    composite.Remove( existingTemplate );
            //}
            if ( CompositeUtils.GetComponent( composite, m_Type ) != null )
            {
                //	This type of component already exists in the composite
                return;
            }
            composite.Add( Activator.CreateInstance( m_Type ) );
            CreateDependencies( composite );
        }