Author: lluis
Date: 2005-04-15 16:41:11 -0400 (Fri, 15 Apr 2005)
New Revision: 43073
Added:
trunk/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
trunk/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
Log:
2005-04-15 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* ControlBuilder.cs: The BindingContainerType property happens
to exist in 2.0, so I made it public. Added ParentTemplateBuilder,
which is used to get the binding container that is managing
the current two-way binding context.
* TemplateBuilder.cs: Added some methods and an internal class
to support two-way bindings.
* CompiledBindableTemplateBuilder.cs: Implemented.
* IBindableTemplate.cs: This interface inherits from ITemplate.
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2005-04-15 20:30:11 UTC
(rev 43072)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2005-04-15 20:41:11 UTC
(rev 43073)
@@ -1,3 +1,14 @@
+2005-04-15 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * ControlBuilder.cs: The BindingContainerType property happens
+ to exist in 2.0, so I made it public. Added ParentTemplateBuilder,
+ which is used to get the binding container that is managing
+ the current two-way binding context.
+ * TemplateBuilder.cs: Added some methods and an internal class
+ to support two-way bindings.
+ * CompiledBindableTemplateBuilder.cs: Implemented.
+ * IBindableTemplate.cs: This interface inherits from ITemplate.
+
2005-04-14 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* ControlBuilder.cs: Added BindingContainerType property,
Added:
trunk/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
2005-04-15 20:30:11 UTC (rev 43072)
+++ trunk/mcs/class/System.Web/System.Web.UI/CompiledBindableTemplateBuilder.cs
2005-04-15 20:41:11 UTC (rev 43073)
@@ -0,0 +1,59 @@
+//
+// System.Web.UI.CompiledBindableTemplateBuilder.cs
+//
+// Authors:
+// Lluis Sanchez Gual ([EMAIL PROTECTED])
+//
+// (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.Specialized;
+
+namespace System.Web.UI
+{
+ public sealed class CompiledBindableTemplateBuilder : IBindableTemplate
+ {
+ private BuildTemplateMethod templateMethod;
+ private ExtractTemplateValuesMethod extractMethod;
+
+ public CompiledBindableTemplateBuilder (BuildTemplateMethod
buildTemplateMethod, ExtractTemplateValuesMethod extractTemplateValuesMethod)
+ {
+ this.templateMethod = buildTemplateMethod;
+ this.extractMethod = extractTemplateValuesMethod;
+ }
+
+ public void InstantiateIn (Control container)
+ {
+ templateMethod (container);
+ }
+
+ public IOrderedDictionary ExtractValues (Control container)
+ {
+ if (extractMethod == null) return null;
+ return extractMethod (container);
+ }
+ }
+}
+
+#endif
Modified: trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs 2005-04-15
20:30:11 UTC (rev 43072)
+++ trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs 2005-04-15
20:41:11 UTC (rev 43073)
@@ -152,7 +152,12 @@
}
}
- internal Type BindingContainerType {
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ Type BindingContainerType {
get {
if (parentBuilder == null)
return typeof (Control);
@@ -171,6 +176,17 @@
}
}
+ internal TemplateBuilder ParentTemplateBuilder {
+ get {
+ if (parentBuilder == null)
+ return null;
+ else if (parentBuilder is TemplateBuilder)
+ return (TemplateBuilder) parentBuilder;
+ else
+ return
parentBuilder.ParentTemplateBuilder;
+ }
+ }
+
protected TemplateParser Parser {
get { return parser; }
}
Modified: trunk/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
2005-04-15 20:30:11 UTC (rev 43072)
+++ trunk/mcs/class/System.Web/System.Web.UI/IBindableTemplate.cs
2005-04-15 20:41:11 UTC (rev 43073)
@@ -34,7 +34,7 @@
namespace System.Web.UI
{
- public interface IBindableTemplate
+ public interface IBindableTemplate: ITemplate
{
IOrderedDictionary ExtractValues (Control control);
}
Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs 2005-04-15
20:30:11 UTC (rev 43072)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateBuilder.cs 2005-04-15
20:41:11 UTC (rev 43073)
@@ -31,6 +31,9 @@
using System;
using System.Collections;
using System.Reflection;
+#if NET_2_0
+using System.ComponentModel;
+#endif
namespace System.Web.UI
{
@@ -38,6 +41,9 @@
{
string text;
TemplateContainerAttribute containerAttribute;
+#if NET_2_0
+ ArrayList bindings;
+#endif
public TemplateBuilder ()
{
@@ -59,6 +65,22 @@
internal Type ContainerType {
get { return containerAttribute != null ?
containerAttribute.ContainerType : null; }
}
+
+#if NET_2_0
+ internal BindingDirection BindingDirection {
+ get { return containerAttribute != null ?
containerAttribute.BindingDirection : BindingDirection.OneWay; }
+ }
+
+ internal void RegisterBoundProperty (Type controlType, string
controlProperty, string controlId, string fieldName)
+ {
+ if (bindings == null) bindings = new ArrayList ();
+ bindings.Add (new TemplateBinding (controlType,
controlProperty, controlId, fieldName));
+ }
+
+ internal ICollection Bindings {
+ get { return bindings; }
+ }
+#endif
public override void Init (TemplateParser parser,
ControlBuilder parentBuilder,
@@ -86,5 +108,23 @@
this.text = text;
}
}
+
+#if NET_2_0
+ internal class TemplateBinding
+ {
+ public Type ControlType;
+ public string ControlProperty;
+ public string ControlId;
+ public string FieldName;
+
+ public TemplateBinding (Type controlType, string
controlProperty, string controlId, string fieldName)
+ {
+ ControlType = controlType;
+ ControlProperty = controlProperty;
+ ControlId = controlId;
+ FieldName = fieldName;
+ }
+ }
+#endif
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches