Author: mhutch
Date: 2005-11-28 07:29:14 -0500 (Mon, 28 Nov 2005)
New Revision: 53549

Added:
   trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/ChangeLog
   trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ChangeLog
Modified:
   trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/DesignerHost.cs
   trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/Document.cs
   trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ParsingObject.cs
   
trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ServerControlParsingObject.cs
Log:
In AspNetEdit.Editor.ComponentModel:
2005-11-28 Michael Hutchinson <[EMAIL PROTECTED]>

        * Document.cs, DesignerHost.cs: avoid duplicating controls in container 
when loading and unloading
In AspNetEdit.Editor.Persistence:
2005-11-28 Michael Hutchinson <[EMAIL PROTECTED]>

        * ServerControlParsingObject.cs: Add child collection objects to parent 
control


Added: trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/ChangeLog
===================================================================
--- trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/ChangeLog       
2005-11-28 12:25:41 UTC (rev 53548)
+++ trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/ChangeLog       
2005-11-28 12:29:14 UTC (rev 53549)
@@ -0,0 +1,3 @@
+2005-11-28 Michael Hutchinson <[EMAIL PROTECTED]>
+
+       * Document.cs, DesignerHost.cs: avoid duplicating controls in container 
when loading and unloading

Modified: 
trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/DesignerHost.cs
===================================================================
--- trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/DesignerHost.cs 
2005-11-28 12:25:41 UTC (rev 53548)
+++ trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/DesignerHost.cs 
2005-11-28 12:29:14 UTC (rev 53549)
@@ -76,7 +76,8 @@
                }
 
                public IComponent CreateComponent (Type componentClass, string 
name)
-               {
+               {
+                       Console.WriteLine("Attempting to create component 
"+name);
                        //check arguments
                        if (componentClass == null)
                                throw new ArgumentNullException 
("componentClass");
@@ -92,10 +93,11 @@
                        //and add to container
                        container.Add (component, name);
 
-                       //add to document, unless loading
-                       ((Control)RootComponent).Controls.Add ((Control) 
component);
-                       if (RootDocument != null)
+                       //add to document, unless loading
+                       if (RootDocument != null) {
+                               ((Control)RootComponent).Controls.Add 
((Control) component);
                                RootDocument.AddControl ((Control)component);
+                       }
                        
                        //select it
                        ISelectionService sel = this.GetService (typeof 
(ISelectionService)) as ISelectionService;
@@ -126,16 +128,16 @@
                        if (found) sel.SetSelectedComponents (null);
                                                
                        if (component != RootComponent) {
-                               //remove from component and dcument
+                               //remove from component and document
                                ((Control) RootComponent).Controls.Remove 
((Control) component);
                                RootDocument.RemoveControl ((Control)component);
                        }
 
-                       //remove from container
-                       container.Remove (component);
-                       component.Dispose ();
-                       
+                       //remove from container if still sited
+                       if (component.Site != null)
+                               container.Remove (component);
                        
+                       component.Dispose ();
                }
 
                public IDesigner GetDesigner (IComponent component)

Modified: 
trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/Document.cs
===================================================================
--- trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/Document.cs     
2005-11-28 12:25:41 UTC (rev 53548)
+++ trunk/aspeditor/src/editor/AspNetEdit.Editor.ComponentModel/Document.cs     
2005-11-28 12:29:14 UTC (rev 53549)
@@ -261,8 +261,7 @@
                        aspParser.ParseDocument (aspFragment, out controls, out 
document);
                        
                        foreach (Control c in controls) {
-                               OnInitMethodInfo.Invoke (c, new object[] 
{EventArgs.Empty});
-                               host.Container.Add (c);
+                               OnInitMethodInfo.Invoke (c, new object[] 
{EventArgs.Empty});
                        }
                        
                        return document;

Added: trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ChangeLog
===================================================================
--- trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ChangeLog  
2005-11-28 12:25:41 UTC (rev 53548)
+++ trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ChangeLog  
2005-11-28 12:29:14 UTC (rev 53549)
@@ -0,0 +1,3 @@
+2005-11-28 Michael Hutchinson <[EMAIL PROTECTED]>
+
+       * ServerControlParsingObject.cs: Add child collection objects to parent 
control

Modified: 
trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ParsingObject.cs
===================================================================
--- trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ParsingObject.cs   
2005-11-28 12:25:41 UTC (rev 53548)
+++ trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ParsingObject.cs   
2005-11-28 12:29:14 UTC (rev 53549)
@@ -62,7 +62,7 @@
                }
 
                /// <summary>
-               /// Adds control to collection. Default implementation passes 
it up the tree.
+               /// Adds control to collection. Default implementation passes 
it up the tree towards RootParsingObject.
                /// </summary>
                protected virtual void AddControl (object control)
                {

Modified: 
trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ServerControlParsingObject.cs
===================================================================
--- 
trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ServerControlParsingObject.cs
      2005-11-28 12:25:41 UTC (rev 53548)
+++ 
trunk/aspeditor/src/editor/AspNetEdit.Editor.Persistence/ServerControlParsingObject.cs
      2005-11-28 12:29:14 UTC (rev 53549)
@@ -50,9 +50,12 @@
 
                public ServerObjectParsingObject(Type type, Hashtable 
attributes, string tagid, ParsingObject parent)
                        : base (tagid, parent)
-               {
+               {
                        //create the object
                        if (type.GetInterface 
("System.ComponentModel.IComponent") != null)
+                               //note: this automatically adds to parent's 
container, as some controls
+                               //need to be sited e.g. if they use site 
dictionaries
+                               //TODO: should this action be passed up the 
tree so controls can intercept?
                                obj = base.DesignerHost.CreateComponent (type, 
attributes["ID"] as string);
                        else
                                obj = Activator.CreateInstance (type);
@@ -194,13 +197,12 @@
                        //FIME: what if it isn't?
                        if (obj is Control)
                                base.AddText ( Document.RenderDesignerControl 
((Control)obj));
-                       //base.AddControl (obj);
+                       base.AddControl (obj);
                        return base.CloseObject (closingTagText);
                }
 
                public override ParsingObject CreateChildParsingObject 
(ILocation location, string tagid, TagAttributes attributes)
                {
-                       
                        switch (mode) {
                                case ParseChildrenMode.DefaultProperty:
                                        //oops, we didn't need to tokenise this.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to