Files
mono/mcs/class/System.Web/System.Web.UI/CollectionBuilder.cs
T
Gonzalo Paniagua Javier a0a0d602bc 2003-04-30 Gonzalo Paniagua Javier <[email protected]>
* ApplicationFileParser.cs: it works now. Prior to these changes, we
	were using the compiler directly.

	* BaseParser.cs: added some useful properties and methods.

	* CodeBuilder.cs: use ILocation.
	* CodeRenderBuilder.cs: use ILocation.
	* CollectionBuilder.cs: use the RootBuilder to map tag names into Types.

	* ControlBuilder.cs: made it useful.

	* DataBindingBuilder.cs: the control type for data bound text is
	DataBoundLiteralControl now.

	* ObjectTagBuilder.cs: store some object tag attributes.

	* PageParser.cs: handle page-only directives.

	* RootBuilder.cs: bah.
	* SimpleWebHandlerParser.cs: made it dummy.
	* TemplateControl.cs: Modified file.

	* TemplateControlParser.cs: handle directives that are common to pages
	and user controls.

	* TemplateParser.cs: utility methods and handling of directives that
	are common to app, page and user controls.

	* UserControl.cs: added ControlBuilderAttribute.

	* UserControlControlBuilder.cs: builder for user controls.
	* UserControlParser.cs: use the new interfaces.

svn path=/trunk/mcs/; revision=14142
2003-04-30 05:02:54 +00:00

57 lines
1.3 KiB
C#

//
// System.Web.UI.CollectionBuilder.cs
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// (c) 2003 Ximian, Inc. (http://www.ximian.com)
//
using System;
using System.Collections;
using System.Reflection;
namespace System.Web.UI
{
class CollectionBuilder : ControlBuilder
{
Type elementType;
internal CollectionBuilder ()
{
}
public override void AppendLiteralString (string s)
{
if (s != null && s.Trim () != "")
throw new HttpException ("Literal content not allowed for " + ControlType);
}
public override Type GetChildControlType (string tagName, IDictionary attribs)
{
Type t = Root.GetChildControlType (tagName, attribs);
if (elementType != null && !elementType.IsAssignableFrom (t))
throw new HttpException ("Cannot add a " + t + " to " + elementType);
return t;
}
public override void Init (TemplateParser parser,
ControlBuilder parentBuilder,
Type type,
string tagName,
string id,
IDictionary attribs)
{
base.Init (parser, parentBuilder, type, tagName, id, attribs);
PropertyInfo prop = parentBuilder.ControlType.GetProperty (tagName, flagsNoCase);
SetControlType (prop.PropertyType);
prop = ControlType.GetProperty ("Item", flagsNoCase & ~BindingFlags.IgnoreCase);
elementType = prop.PropertyType;
}
}
}