Author: toshok
Date: 2005-09-27 22:32:22 -0400 (Tue, 27 Sep 2005)
New Revision: 50910

Added:
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/GenericScriptComponent.cs
   
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponentContainer.cs
   
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentCollection.cs
Modified:
   trunk/mcs/class/Microsoft.Web.Atlas/ChangeLog
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs
   trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs
Log:
2005-09-27  Chris Toshok  <[EMAIL PROTECTED]>

        * Microsoft.Web/ScriptEvent.cs (RenderActions): remove the
        WriteWhitespace calls - the writer takes care of formatting for
        us.

        * Microsoft.Web/ScriptControl.cs (AddAttributesToElement): add
        cssClass and targetElement.
        (InitializeTypeDescriptor): flesh out the type descriptor.
        (RenderScriptTagContents): call the base class method, then render
        our behaviors.
        (Behaviors): implement.
        (CssClass): implement.

        * Microsoft.Web/Behavior.cs (RenderBehavior): new.
        (RenderScript): new.

        * Microsoft.Web/ScriptComponent.cs (AddAttributesToRender): write
        the ID.
        (InitializeTypeDescriptor): implement.
        (OnInit): register ourselves with the script manager.
        (RenderScriptTagContents): render our bindings.
        (Bindings): implement.
        (PropertyChanged): implement.
        (IScriptOwner.Owner): return null instead of NIE.

        * Microsoft.Web/ScriptComponentBase.cs (RenderScript): add new
        non-iface virtual method, and have the explicit interface impl
        call it.
        (RenderScriptTagContents): write out the bindings.

        * Microsoft.Web/ScriptTextWriter.cs (.ctor): set Formatting to
        Formatting.Indented.

        * Microsoft.Web/IScriptComponentContainer.cs: new interface.

        * Microsoft.Web/ScriptComponentCollection.cs: new implementation.

        * Microsoft.Web/GenericScriptComponent.cs: new implementation.



Modified: trunk/mcs/class/Microsoft.Web.Atlas/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/ChangeLog       2005-09-28 02:23:46 UTC 
(rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/ChangeLog       2005-09-28 02:32:22 UTC 
(rev 50910)
@@ -1,5 +1,45 @@
 2005-09-27  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * Microsoft.Web/ScriptEvent.cs (RenderActions): remove the
+       WriteWhitespace calls - the writer takes care of formatting for
+       us.
+
+       * Microsoft.Web/ScriptControl.cs (AddAttributesToElement): add
+       cssClass and targetElement.
+       (InitializeTypeDescriptor): flesh out the type descriptor.
+       (RenderScriptTagContents): call the base class method, then render
+       our behaviors.
+       (Behaviors): implement.
+       (CssClass): implement.
+
+       * Microsoft.Web/Behavior.cs (RenderBehavior): new.
+       (RenderScript): new.
+
+       * Microsoft.Web/ScriptComponent.cs (AddAttributesToRender): write
+       the ID.
+       (InitializeTypeDescriptor): implement.
+       (OnInit): register ourselves with the script manager.
+       (RenderScriptTagContents): render our bindings.
+       (Bindings): implement.
+       (PropertyChanged): implement.
+       (IScriptOwner.Owner): return null instead of NIE.
+
+       * Microsoft.Web/ScriptComponentBase.cs (RenderScript): add new
+       non-iface virtual method, and have the explicit interface impl
+       call it.
+       (RenderScriptTagContents): write out the bindings.
+
+       * Microsoft.Web/ScriptTextWriter.cs (.ctor): set Formatting to
+       Formatting.Indented.
+
+       * Microsoft.Web/IScriptComponentContainer.cs: new interface.
+
+       * Microsoft.Web/ScriptComponentCollection.cs: new implementation.
+
+       * Microsoft.Web/GenericScriptComponent.cs: new implementation.
+
+2005-09-27  Chris Toshok  <[EMAIL PROTECTED]>
+
        * Microsoft.Web.UI/ScriptManager.cs: implement things such that
        things kinda work.
 

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs       
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Behavior.cs       
2005-09-28 02:32:22 UTC (rev 50910)
@@ -38,6 +38,21 @@
                protected Behavior ()
                {
                }
+
+               protected internal virtual void RenderBehavior 
(ScriptTextWriter writer)
+               {
+                       RenderScriptBeginTag (writer);
+                       AddAttributesToElement (writer);
+                       // XXX toshok: just a hunch, but we probably
+                       // don't have bindings in behaviors..  so
+                       // let's leave out the contents?
+                       RenderScriptEndTag (writer);
+               }
+
+               protected internal sealed override void RenderScript 
(ScriptTextWriter writer)
+               {
+                       RenderBehavior (writer);
+               }
        }
 }
 

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs        
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/Binding.cs        
2005-09-28 02:32:22 UTC (rev 50910)
@@ -30,9 +30,11 @@
 #if NET_2_0
 
 using System;
+using System.Web.UI;
 
 namespace Microsoft.Web
 {
+       [ControlBuilder (typeof (BindingBuilder))]
        public class Binding : IScriptObject
        {
                public Binding ()
@@ -189,6 +191,14 @@
                        return d;
                }
        }
+
+       class BindingBuilder : ControlBuilder
+       {
+               public override bool HasBody ()
+               {
+                       return false;
+               }
+       }
 }
 
 #endif

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs      
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/BindingCollection.cs      
2005-09-28 02:32:22 UTC (rev 50910)
@@ -30,10 +30,13 @@
 #if NET_2_0
 
 using System;
+using System.Collections;
 using System.Collections.ObjectModel;
+using System.Web.UI;
 
 namespace Microsoft.Web
 {
+       [ControlBuilder (typeof (BindingCollectionBuilder))]
        public class BindingCollection : Collection<Binding>, IScriptObject
        {
                IScriptObject owner;
@@ -86,6 +89,23 @@
                        throw new NotImplementedException ();
                }
        }
+
+       class BindingCollectionBuilder : ControlBuilder
+       {
+               public override bool AllowWhitespaceLiterals () 
+               {
+                       return false;
+               }
+
+               public override Type GetChildControlType (string tagName, 
IDictionary attribs) 
+               {
+                       if (System.String.Compare (tagName, "binding", true) != 
0)
+                               return null;
+
+                       return typeof (Binding);
+               }
+       }
+
 }
 
 #endif

Added: 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/GenericScriptComponent.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/GenericScriptComponent.cs 
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/GenericScriptComponent.cs 
2005-09-28 02:32:22 UTC (rev 50910)
@@ -0,0 +1,112 @@
+//
+// Microsoft.Web.GenericScriptComponent
+//
+// Author:
+//   Chris Toshok ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Web.UI;
+using Microsoft.Web.UI;
+
+namespace Microsoft.Web
+{
+
+       public sealed class GenericScriptComponent : ScriptComponent
+       {
+               public GenericScriptComponent (string tagName)
+               {
+                       this.tagName = tagName;
+
+                       valueProperties = new Hashtable ();
+                       collections = new Hashtable ();
+               }
+
+               protected override void AddAttributesToElement 
(ScriptTextWriter writer)
+               {
+                       base.AddAttributesToElement (writer);
+
+                       foreach (string prop in valueProperties.Keys)
+                               writer.WriteAttributeString (prop, 
(string)valueProperties[prop]);
+               }
+
+               public void AddCollectionItem (string collectionName, 
IScriptComponent item)
+               {
+                       ScriptComponentCollection col = 
(ScriptComponentCollection)collections[collectionName];
+                       if (col == null) {
+                               col = new ScriptComponentCollection ();
+                               collections [collectionName] = col;
+                       }
+
+                       col.Add (item);
+               }
+
+               public void AddComponentProperty (string propertyName, 
IScriptComponent component)
+               {
+               }
+
+               public void AddValueProperty (string propertyName, string 
propertyValue)
+               {
+                       valueProperties [propertyName] = propertyValue;
+               }
+
+               protected override void RenderScriptTagContents 
(ScriptTextWriter writer)
+               {
+                       base.RenderScriptTagContents (writer);
+
+                       foreach (string colName in collections.Keys) {
+                               ScriptComponentCollection col = 
(ScriptComponentCollection)collections[colName];
+                               writer.WriteStartElement (colName);
+                               foreach (IScriptComponent c in col)
+                                       c.RenderScript (writer);
+                               writer.WriteEndElement (); // colName
+                       }
+               }
+
+               ScriptEventCollection scriptEvents;
+               public new ScriptEventCollection ScriptEvents {
+                       get {
+                               return base.ScriptEvents;
+                       }
+               }
+
+               public override string TagName {
+                       get {
+                               return tagName;
+                       }
+               }
+
+               Hashtable valueProperties;
+               Hashtable collections;
+               string tagName;
+       }
+}
+
+#endif

Added: 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponentContainer.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponentContainer.cs  
    2005-09-28 02:23:46 UTC (rev 50909)
+++ 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/IScriptComponentContainer.cs  
    2005-09-28 02:32:22 UTC (rev 50910)
@@ -0,0 +1,44 @@
+//
+// Microsoft.Web.IScriptComponentContainer
+//
+// Author:
+//   Chris Toshok ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Web.UI;
+
+namespace Microsoft.Web
+{
+
+       public interface IScriptComponentContainer : INamingContainer
+       {
+               void RegisterComponent (IScriptComponent component);
+       }
+
+}
+
+#endif

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs        
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponent.cs        
2005-09-28 02:32:22 UTC (rev 50910)
@@ -30,12 +30,15 @@
 #if NET_2_0
 
 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
 using System.Web.UI;
+using Microsoft.Web.UI;
 
 namespace Microsoft.Web
 {
 
+       [ParseChildren (true, "Bindings")]
        public abstract class ScriptComponent :  Control, IScriptComponent, 
IScriptObject
        {
                protected ScriptComponent ()
@@ -44,6 +47,8 @@
 
                protected virtual void AddAttributesToElement (ScriptTextWriter 
writer)
                {
+                       if (ID != null && ID != "")
+                               writer.WriteAttributeString ("id", ID);
                }
 
                ScriptTypeDescriptor IScriptObject.GetTypeDescriptor ()
@@ -56,6 +61,11 @@
 
                protected virtual void InitializeTypeDescriptor 
(ScriptTypeDescriptor typeDescriptor)
                {
+                       foreach (ScriptEvent ev in 
((IEnumerable<ScriptEvent>)ScriptEvents))
+                               typeDescriptor.AddEvent (new 
ScriptEventDescriptor (ev.Name, ev.SupportsActions));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("bindings", ScriptType.Array, true, "Bindings"));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("dataContext", ScriptType.Object));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("id", ScriptType.String, "ID"));
                }
 
                public ScriptTypeDescriptor GetTypeDescriptor ()
@@ -69,6 +79,12 @@
                protected override void OnInit (EventArgs e)
                {
                        base.OnInit (e);
+
+                       ScriptManager mgr = 
ScriptManager.GetCurrentScriptManager (Page);
+                       if (mgr == null)
+                               throw new InvalidOperationException ("The page 
must contain a ScriptManager or the control must be placed inside a container");
+
+                       mgr.RegisterComponent (this);
                }
 
                void IScriptComponent.RenderScript (ScriptTextWriter writer)
@@ -91,11 +107,21 @@
 
                protected virtual void RenderScriptTagContents 
(ScriptTextWriter writer)
                {
+                       if (bindings != null && bindings.Count > 0) {
+                               writer.WriteStartElement ("bindings");
+                               foreach (Binding b in bindings) {
+                                       b.RenderScript (writer);
+                               }
+                               writer.WriteEndElement (); // bindings
+                       }
                }
 
+               BindingCollection bindings;
                public BindingCollection Bindings {
                        get {
-                               throw new NotImplementedException ();
+                               if (bindings == null)
+                                       bindings = new BindingCollection(this);
+                               return bindings;
                        }
                }
 
@@ -107,15 +133,24 @@
                }
 #endif
 
+               ScriptEvent propertyChanged = null;
                public ScriptEvent PropertyChanged {
                        get {
-                               throw new NotImplementedException ();
+                               if (propertyChanged == null)
+                                       propertyChanged = new ScriptEvent 
(this, "propertyChanged", true);
+                               return propertyChanged;
                        }
                }
 
-               public ScriptEventCollection ScriptEvents {
+               ScriptEventCollection scriptEvents;
+               protected ScriptEventCollection ScriptEvents {
                        get {
-                               throw new NotImplementedException ();
+                               if (scriptEvents == null) {
+                                       scriptEvents = new 
ScriptEventCollection (this);
+                                       scriptEvents.Add (PropertyChanged);
+                               }
+
+                               return scriptEvents;
                        }
                }
 
@@ -129,7 +164,7 @@
 
                IScriptObject IScriptObject.Owner {
                        get {
-                               throw new NotImplementedException ();
+                               return null;
                        }
                }
        }

Modified: 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs    
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentBase.cs    
2005-09-28 02:32:22 UTC (rev 50910)
@@ -114,7 +114,7 @@
                        typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("id", ScriptType.String, "ID"));
                }
 
-               void IScriptComponent.RenderScript (ScriptTextWriter writer)
+               protected internal virtual void RenderScript (ScriptTextWriter 
writer)
                {
                        RenderScriptBeginTag (writer);
                        AddAttributesToElement (writer);
@@ -122,6 +122,11 @@
                        RenderScriptEndTag (writer);
                }
 
+               void IScriptComponent.RenderScript (ScriptTextWriter writer)
+               {
+                       RenderScript (writer);
+               }
+
                protected virtual void RenderScriptBeginTag (ScriptTextWriter 
writer)
                {
                        writer.WriteStartElement (TagName);
@@ -134,6 +139,13 @@
 
                protected virtual void RenderScriptTagContents 
(ScriptTextWriter writer)
                {
+                       if (bindings != null && bindings.Count > 0) {
+                               writer.WriteStartElement ("bindings");
+                               foreach (Binding b in bindings) {
+                                       b.RenderScript (writer);
+                               }
+                               writer.WriteEndElement (); // bindings
+                       }
                }
 
                public void SetOwner (IScriptObject owner)

Added: 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentCollection.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentCollection.cs  
    2005-09-28 02:23:46 UTC (rev 50909)
+++ 
trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptComponentCollection.cs  
    2005-09-28 02:32:22 UTC (rev 50910)
@@ -0,0 +1,42 @@
+//
+// Microsoft.Web.UI.ScriptComponentCollection
+//
+// Author:
+//   Chris Toshok ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Collections.Generic;
+
+namespace Microsoft.Web {
+
+       public class ScriptComponentCollection : List<IScriptComponent>
+       {
+       }
+
+}
+
+#endif

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs  
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptControl.cs  
2005-09-28 02:32:22 UTC (rev 50910)
@@ -44,29 +44,68 @@
                protected override void AddAttributesToElement 
(ScriptTextWriter writer)
                {
                        base.AddAttributesToElement (writer);
+
+                       if (CssClass != "")
+                               writer.WriteAttributeString ("cssClass", 
CssClass);
+
+                       if (ClientID != null && ClientID != "")
+                               writer.WriteAttributeString ("targetElement", 
ClientID);
                }
 
                protected override void InitializeTypeDescriptor 
(ScriptTypeDescriptor typeDescriptor)
                {
                        base.InitializeTypeDescriptor (typeDescriptor);
+
+                       string[] args = new string[1];
+                       args[0] = "className";
+
+                       typeDescriptor.AddMethod (new ScriptMethodDescriptor 
("addCssClass", args));
+                       typeDescriptor.AddMethod (new ScriptMethodDescriptor 
("focus"));
+                       typeDescriptor.AddMethod (new ScriptMethodDescriptor 
("scrollIntoView"));
+                       typeDescriptor.AddMethod (new ScriptMethodDescriptor 
("removeCssClass", args));
+                       typeDescriptor.AddMethod (new ScriptMethodDescriptor 
("toggleCssClass", args));
+
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("associatedElement", ScriptType.Object, true, ""));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("behaviors", ScriptType.Array, true, "Behaviors"));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("cssClass", ScriptType.String, false, "CssClass"));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("enabled", ScriptType.Boolean, false, "Enabled"));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("style", ScriptType.Object, true, ""));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("visible", ScriptType.Boolean, false, "Visible"));
+                       typeDescriptor.AddProperty (new 
ScriptPropertyDescriptor ("visibilityMode", ScriptType.Enum, false, 
"VisibilityMode"));
                }
 
                protected override void RenderScriptTagContents 
(ScriptTextWriter writer)
                {
+                       base.RenderScriptTagContents (writer);
+
+                       if (behaviors != null && behaviors.Count > 0) {
+                               writer.WriteStartElement ("behaviors");
+                               foreach (Behavior b in behaviors) {
+                                       b.RenderScript (writer);
+                               }
+                               writer.WriteEndElement (); // behaviors
+                       }
                }
 
+               BehaviorCollection behaviors;
                public BehaviorCollection Behaviors {
                        get {
-                               throw new NotImplementedException ();
+                               if (behaviors == null)
+                                       behaviors = new BehaviorCollection 
(this);
+
+                               return behaviors;
                        }
                }
 
                public string CssClass {
                        get {
-                               throw new NotImplementedException ();
+                               object o = ViewState["CssClass"];
+                               if (o == null)
+                                       return "";
+                               return (string)o;
                        }
                        set {
-                               throw new NotImplementedException ();
+                               ViewState["CssClass"] = value;
                        }
                }
 

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs    
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptEvent.cs    
2005-09-28 02:32:22 UTC (rev 50910)
@@ -82,12 +82,9 @@
                                return;
 
                        writer.WriteStartElement (Name);
-                       writer.WriteWhitespace ("\r\n");
 
                        foreach (Action a in Actions) {
-                               writer.WriteWhitespace ("  ");
                                a.RenderAction (writer);
-                               writer.WriteWhitespace ("\r\n");
                        }
 
                        writer.WriteEndElement ();

Modified: trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs
===================================================================
--- trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs       
2005-09-28 02:23:46 UTC (rev 50909)
+++ trunk/mcs/class/Microsoft.Web.Atlas/Microsoft.Web/ScriptTextWriter.cs       
2005-09-28 02:32:22 UTC (rev 50910)
@@ -39,6 +39,7 @@
                public ScriptTextWriter (TextWriter writer)
                        : base (writer)
                {
+                       Formatting = Formatting.Indented;
                }
        }
 }

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

Reply via email to