소스 검색

2002-05-17 Duncan Mak <[email protected]>

	* System.Web.build: Added new arguments: "/noconfig",
	"/r:System.Drawing.dll" and "/r:System.Xml.dll".

	* AttributeCollection.cs:
	* ControlCollection.cs:
	* CssStyleCollection.cs:
	* DataBindingCollection.cs:
	* EmptyControlCollection.cs: Added missing Collection classes.

	* BaseParser.cs:
	* TemplateParser.cs:  Implemented. BaseParser is weird because
	there is no documentation on what it does.

	* ControlBuilder.cs:

	* DataBinder.cs:
	* DataBinding.cs: Added.

	* DataBoundLiteralControl.cs:
	* Triplet.cs: Added.

	* RenderMethod.cs: Added this delegate for Control.cs

svn path=/trunk/mcs/; revision=4726
Duncan Mak 23 년 전
부모
커밋
b3976280ad

+ 5 - 0
mcs/class/System.Web/ChangeLog

@@ -1,3 +1,8 @@
+2002-05-17  Duncan Mak  <[email protected]>
+
+	* System.Web.build: Added new arguments: "/noconfig",
+	"/r:System.Drawing.dll" and "/r:System.Xml.dll".
+
 2002-05-10  Duncan Mak  <[email protected]>
 
 	* System.Web.build: Include the System.Web.UI.HtmlControls namespace.

+ 76 - 0
mcs/class/System.Web/System.Web.UI/AttributeCollection.cs

@@ -0,0 +1,76 @@
+//
+// System.Web.UI.AttributeCollection.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+	public sealed class AttributeCollection
+	{
+		StateBag bag;
+		Hashtable list;
+		
+		public AttributeCollection (StateBag bag)
+		{
+			this.bag = bag;
+			list = new Hashtable ();
+		}
+
+		public int Count {
+			get { return list.Count; }
+		}
+
+		[MonoTODO]
+		public CssStyleCollection CssStyle {
+			get { return null; }
+		}
+
+		public string this [string key] {
+			get { return list [key] as string; }
+
+			set { list [key] = value; }
+		}
+
+		public ICollection Keys {
+			get { return list.Keys; }
+		}
+
+		public void Add (string key, string value)
+		{
+			list.Add (key, value);
+		}
+
+		public void AddAttributes (HtmlTextWriter writer)
+		{
+			foreach (object key in list.Keys) {
+
+				object value = list [key];
+				writer.AddAttribute ((string) key, (string) value);
+			}
+		}
+
+		public void Clear ()
+		{
+			list.Clear ();
+		}
+
+		public void Remove (string key)
+		{
+			list.Remove (key);
+		}
+
+		public void Render (HtmlTextWriter writer)
+		{
+			foreach (object key in list.Keys) {
+				object value = list [key];
+				writer.WriteAttribute ((string) key, (string) value);
+			}
+		}
+	}
+}

+ 14 - 0
mcs/class/System.Web/System.Web.UI/BaseParser.cs

@@ -0,0 +1,14 @@
+//
+// System.Web.UI.BaseParser.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Web.UI {
+	public class BaseParser
+	{
+		// LAMESPEC: We know nothing about this class from the docs.
+	}
+}

+ 24 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,27 @@
+2002-05-17  Duncan Mak  <[email protected]>
+
+	* AttributeCollection.cs: 
+	* ControlCollection.cs: 
+	* CssStyleCollection.cs: 
+	* DataBindingCollection.cs: 
+	* EmptyControlCollection.cs: Added missing Collection classes.
+
+2002-05-17  Duncan Mak  <[email protected]>
+
+	* BaseParser.cs:
+	* TemplateParser.cs:  Implemented. BaseParser is weird because
+	there is no documentation on what it does.
+
+	* ControlBuilder.cs:
+	
+	* DataBinder.cs: 
+	* DataBinding.cs: Added. 
+
+	* DataBoundLiteralControl.cs: 
+	* Triplet.cs: Added.
+
+	* RenderMethod.cs: Added this delegate for Control.cs
+
 2002-05-15  Gonzalo Paniagua Javier <[email protected]>
 
 	* ValidationPropertyAttribute.cs: a couple of fixes to make it compile.

+ 167 - 0
mcs/class/System.Web/System.Web.UI/ControlBuilder.cs

@@ -0,0 +1,167 @@
+//
+// System.Web.UI.ControlBuilder.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+	public class ControlBuilder
+	{
+		TemplateParser parser;
+		ControlBuilder parentBuilder;
+		Type type;	       
+		string tagName;
+		string id;
+		IDictionary attribs;
+		int line;
+		string fileName;
+
+		public ControlBuilder ()
+		{
+		}
+
+
+		internal ControlBuilder (
+			TemplateParser parser, ControlBuilder parentBuilder,
+			Type type, string tagName, string id,
+			IDictionary attribs, int line, string sourceFileName)
+
+		{
+			this.parser = parser;
+			this.parentBuilder = parentBuilder;
+			this.type = type;
+			this.tagName = tagName;
+			this.id = id;
+			this.attribs = attribs;
+			this.line = line;
+			this.fileName = sourceFileName;
+		}
+
+		public Type ControlType {
+			get { return type; }
+		}
+
+		[MonoTODO]
+		public bool FChildrenAsProperties {
+			get { return false; }
+		}
+
+		[MonoTODO]
+		public bool FIsNonParserAccessor {
+			get { return false; }
+		}
+
+		[MonoTODO]
+		public bool HasAspCode {
+			get { return false; }
+		}
+
+		public string ID {
+			get { return id; }
+
+			set { id = value; }
+		}
+
+		[MonoTODO]
+		public bool InDesigner {
+			get { return false; }
+		}
+
+		[MonoTODO]
+		public Type NamingContainerType {
+			get { return null; }
+		}
+
+		protected TemplateParser Parser {
+			get { return parser; }
+		}
+
+		public string TagName {
+			get { return tagName; }
+		}
+
+		[MonoTODO]
+		public virtual bool AllowWhitespaceLiterals ()
+		{
+			return false;
+		}
+
+		[MonoTODO]
+		public virtual void AppendLiteralString (string s)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public virtual void AppendSubBuilder (ControlBuilder subBuilder)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public virtual void CloseControl ()
+		{
+		}
+
+		[MonoTODO]
+		public static ControlBuilder CreateBuilderFromType (
+			TemplateParser parser, ControlBuilder parentBuilder,
+			Type type, string tagName, string id,
+			IDictionary attribs, int line, string sourceFileName)
+		{
+			return new ControlBuilder (parser, parentBuilder, type,
+						   tagName, id, attribs, line, sourceFileName);
+		}
+
+		[MonoTODO]
+		public virtual Type GetChildControlType (string tagName, IDictionary attribs)
+		{
+			return attribs [tagName] as Type;
+		}
+
+		[MonoTODO]
+		public virtual bool HasBody ()
+		{
+			return false;
+		}
+
+		[MonoTODO]
+		public virtual bool HtmlDecodeLiterals ()
+		{
+			return false;
+		}
+
+		[MonoTODO]
+		public virtual void Init (
+			TemplateParser parser, ControlBuilder parentBuilder,
+			Type type, string tagName, string id, IDictionary attribs)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public virtual bool NeedsTagInnerText ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public virtual void OnAppendToParentBuilder ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public virtual void SetTagInnerText (string text)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+}
+

+ 113 - 0
mcs/class/System.Web/System.Web.UI/ControlCollection.cs

@@ -0,0 +1,113 @@
+//
+// System.Web.UI.ControlCollection.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+	public class ControlCollection : ICollection, IEnumerable
+	{
+		ArrayList list = new ArrayList ();
+		Control owner;
+		
+		public ControlCollection (Control owner)
+		{
+			if (owner == null)
+				throw new ArgumentException ();
+
+			this.owner = owner;
+		}
+
+		public int Count {
+			get { return list.Count; }
+		}
+
+		public bool IsReadOnly {
+			get { return list.IsReadOnly; }
+		}
+
+		public bool  IsSynchronized {
+			get { return list.IsSynchronized; }
+		}
+
+		public virtual Control this [int index] {
+			get { return list [index] as Control; }
+		}
+
+		protected Control Owner {
+			get { return owner; }
+		}
+
+		public object SyncRoot {
+			get { return list.SyncRoot; }
+		}
+
+		public virtual void Add (Control child)
+		{
+			if (child == null)
+				throw new ArgumentNullException ();
+			if (IsReadOnly)
+				throw new HttpException ();
+
+			list.Add (child);
+		}
+
+		public virtual void AddAt (int index, Control child)
+		{
+			if (child == null) // maybe we should check for ! (child is Control)?
+				throw new ArgumentNullException ();
+			
+			if ((index < 0) || (index > Count))
+				throw new ArgumentOutOfRangeException ();
+
+			if (IsReadOnly)
+				throw new HttpException ();
+
+			list [index] = child;
+		}
+
+		public virtual void Clear ()
+		{
+			list.Clear ();
+		}
+
+		public virtual bool Contains (Control c)
+		{
+			return list.Contains (c as object);
+		}
+
+		public void CopyTo (Array array, int index)
+		{
+			list.CopyTo (array, index);
+		}
+
+		public IEnumerator GetEnumerator ()
+		{
+			return list.GetEnumerator ();
+		}
+
+		public virtual int IndexOf (Control c)
+		{
+			return list.IndexOf (c as object);
+		}
+
+		public virtual void Remove (Control value)
+		{
+			list.Remove (value as object);
+		}
+
+		public virtual void RemoveAt (int index)
+		{
+			if (IsReadOnly)
+				throw new HttpException ();
+
+			list.RemoveAt (index);
+		}
+	}
+}

+ 48 - 0
mcs/class/System.Web/System.Web.UI/CssStyleCollection.cs

@@ -0,0 +1,48 @@
+//
+// System.Web.UI.CssStyleCollection.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+	public sealed class CssStyleCollection
+	{
+		Hashtable list = new Hashtable ();
+
+		public int Count {
+			get { return list.Count; }
+		}
+
+		public string this [string key] {
+
+			get { return list [key] as string; }
+
+			set { list [key] = value; }
+		}
+
+		public ICollection Keys {
+			get { return list.Keys; }
+		}
+
+		public void Add (string key, string value)
+		{
+			list.Add (key, value);
+		}
+
+		public void Clear ()
+		{
+			list.Clear ();
+		}
+
+		public void Remove (string key)
+		{
+			list.Remove (key);
+		}
+	}
+}

+ 55 - 0
mcs/class/System.Web/System.Web.UI/DataBinder.cs

@@ -0,0 +1,55 @@
+//
+// System.Web.UI.DataBinder.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public sealed class DataBinder
+	{
+		public DataBinder ()
+		{
+		}
+
+		[MonoTODO]
+		public static object Eval (object container, string expression)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static object Eval (object container, string expression, string format)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static object GetIndexedPropertyValue (object container, string expr)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static object GetIndexedPropertyValue (object container, string expr, string format)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static string GetPropertyValue (object container, string propName)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static string GetPropertyValue (object container, string propName, string format)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+}

+ 52 - 0
mcs/class/System.Web/System.Web.UI/DataBinding.cs

@@ -0,0 +1,52 @@
+//
+// System.Web.UI.DataBinding.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public sealed class DataBinding
+	{
+		string propertyName;
+		string propertyType;
+		string expression;
+
+		public DataBinding (string propertyName, string propertyType,
+				    string expression)
+		{
+			this.propertyName = propertyName;
+			this.propertyType = propertyType;
+			this.expression = expression;
+		}
+
+		public string Expression {
+			get { return expression; }
+		}
+
+		public string PropertyName {
+			get { return propertyName; }
+		}
+
+		public string PropertyType {
+			get { return propertyType; }
+		}
+
+		public override bool Equals (object obj)
+		{
+			if (((DataBinding) obj).PropertyName == this.PropertyName)
+				return true;
+			else
+				return false;
+		}
+
+		public override int GetHashCode ()
+		{
+			return propertyName.GetHashCode ();
+		}
+	}
+}

+ 92 - 0
mcs/class/System.Web/System.Web.UI/DataBindingCollection.cs

@@ -0,0 +1,92 @@
+//
+// System.Web.UI.DataBindingCollection.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Web.UI {
+
+	public sealed class DataBindingCollection : ICollection, IEnumerable
+	{
+		Hashtable list;
+		ArrayList removed;
+		
+		public DataBindingCollection ()
+		{
+			list = new Hashtable ();
+			removed = new ArrayList ();
+		}
+
+		public int Count {
+			get { return list.Count; }
+		}
+
+		public bool IsReadOnly {
+			get { return list.IsReadOnly; }
+		}
+
+		public bool IsSynchronized {
+			get { return list.IsSynchronized; }
+		}
+
+		public DataBinding this [string propertyName] {
+			get { return list [propertyName] as DataBinding; }
+		}
+
+		public string [] RemovedBindings {
+			get { return (string []) removed.ToArray (typeof (string)); }
+		}
+
+		public object SyncRoot {
+			get { return list.SyncRoot; }
+		}
+
+		public void Add (DataBinding binding)
+		{
+			list.Add (binding.PropertyName, binding);
+		}
+
+		public void Clear ()
+		{
+			list.Clear ();
+		}
+
+		public void CopyTo (Array array, int index)
+		{
+			list.CopyTo (array, index);
+		}
+
+		public IEnumerator GetEnumerator ()
+		{
+			return list.GetEnumerator ();
+		}
+
+		public void Remove (DataBinding binding)
+		{
+			string key = binding.PropertyName;
+			Remove (key);
+		}
+
+		public void Remove (string propertyName)
+		{
+			removed.Add (propertyName);
+			list.Remove (propertyName);
+		}
+
+		public void Remove (string propertyName,
+				    bool addToRemovedList)
+		{
+			if (addToRemovedList)
+				removed.Add (String.Empty); // LAMESPEC
+			else
+				removed.Add (propertyName);
+
+			list.Remove (propertyName);
+		}
+	}
+}

+ 57 - 0
mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs

@@ -0,0 +1,57 @@
+//
+// System.Web.UI.DataBoundLiteralCOntrol.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI {
+
+	public sealed class DataBoundLiteralControl : Control
+	{
+		public DataBoundLiteralControl (int staticLiteralsCount,
+						int dataBOundLiteralCount)
+		{
+		}
+
+		[MonoTODO]
+		public string Text {
+			get { return String.Empty; }
+		}
+
+		[MonoTODO]
+		protected override ControlCollection CreateControlCollection ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override void LoadViewState (object savedState)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override void Render (HtmlTextWriter output)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override object SaveViewState ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		public void SetDataBoundString (int index, string s)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public void SetStaticString (int index, string s)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+}

+ 30 - 0
mcs/class/System.Web/System.Web.UI/EmptyControlCollection.cs

@@ -0,0 +1,30 @@
+//
+// System.Web.UI.EmptyControlCollection.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public class EmptyControlCollection : ControlCollection
+	{
+		public EmptyControlCollection (Control owner)
+			: base (owner)
+		{
+		}
+		
+		public override void Add (Control child)
+		{
+			throw new HttpException ();
+		}
+
+		public override void AddAt (int index, Control child)
+		{
+			throw new HttpException ();
+		}
+	}
+}

+ 13 - 0
mcs/class/System.Web/System.Web.UI/RenderMethod.cs

@@ -0,0 +1,13 @@
+//
+//
+// System.Web.UI.RenderMethod.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Web.UI {
+
+	public delegate void RenderMethod (HtmlTextWriter output, Control container);
+}

+ 115 - 0
mcs/class/System.Web/System.Web.UI/TemplateControl.cs

@@ -0,0 +1,115 @@
+//
+// System.Web.UI.TemplateControl.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public abstract class TemplateControl : Control, INamingContainer
+	{
+		#region Constructor
+		protected TemplateControl ()
+		{
+		}
+
+		#endregion
+
+		#region Properties
+
+		[MonoTODO]
+		protected virtual int AutoHandlers {
+			get { return 1; }
+			set { }
+		}
+
+		[MonoTODO]
+		protected virtual bool SupportAutoEvents {
+			get { return false; }
+		}
+
+		#endregion
+
+		#region Methods
+
+		protected virtual void Construct ()
+		{
+		}
+
+		[MonoTODO]
+		protected virtual LiteralControl CreateResourceBasedLiteralControl (
+			int offset, int size, bool fAsciiOnly)
+		{
+			return null;
+		}
+
+		[MonoTODO]
+		protected virtual void FrameworkInitialize ()
+		{
+		}
+
+		[MonoTODO]
+		public Control LoadControl (string virtualPath)
+		{
+			return null;
+		}
+
+		[MonoTODO]
+		public ITemplate LoadTemplate (string virtualPath)
+		{
+			return null;
+		}
+
+		[MonoTODO]
+		protected virtual void OnAbortTransaction (EventArgs e)
+		{
+		}
+
+		[MonoTODO]
+		protected virtual void OnCommitTransaction (EventArgs e)
+		{
+		}
+
+		[MonoTODO]
+		protected virtual void OnError (EventArgs e)
+		{
+		}
+
+		[MonoTODO]
+		public Control ParseControl (string content)
+		{
+			return null;
+		}
+
+		[MonoTODO]
+		public static object ReadStringResource (Type t)
+		{
+			return null;
+		}
+
+		[MonoTODO]
+		protected void SetStringresourcePointer (object stringResourcePointer,
+							 int maxResourceOffset)
+		{
+		}
+
+		[MonoTODO]
+		protected void WriteUTF8ResourceString (HtmlTextWriter output, int offset,
+							int size, bool fAsciiOnly)
+		{
+		}
+
+		#endregion
+
+		#region Events
+
+		public event EventHandler AbortTransaction;
+		public event EventHandler CommitTransaction;
+		public event EventHandler Error;
+		#endregion
+	}
+}

+ 17 - 0
mcs/class/System.Web/System.Web.UI/TemplateParser.cs

@@ -0,0 +1,17 @@
+//
+// System.Web.UI.TemplateParser.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public abstract class TemplateParser : BaseParser
+	{
+		protected abstract Type CompileIntoType ();
+	}
+}

+ 36 - 0
mcs/class/System.Web/System.Web.UI/Triplet.cs

@@ -0,0 +1,36 @@
+//
+// System.Web.UI.Triplet.cs
+//
+// Duncan Mak  ([email protected])
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Web.UI {
+
+	public class Triplet
+	{
+		public object First;
+		public object Second;
+		public object Third;
+
+		public Triplet ()
+		{
+		}
+
+		public Triplet (object x, object y)
+		{
+			First = x;
+			Second = y;
+		}
+
+		public Triplet (object x, object y, object z)
+		{
+			First = x;
+			Second = y;
+			Third = z;
+		}
+	}
+}

+ 3 - 0
mcs/class/System.Web/System.Web.build

@@ -14,7 +14,10 @@
 			<arg value="/nowarn:0168"/> <!-- never used variable -->
 			<arg value="/nowarn:0162"/> <!-- unreachable code -->
 			<arg value="/unsafe"/>
+			<arg value="/noconfig"/>
 			<arg value="/r:System.dll"/>
+			<arg value="/r:System.Drawing.dll"/>
+			<arg value="/r:System.Xml.dll"/>
 			<sources>
 				<includes name="**/*.cs"/> 
 				<excludes name="Test/**"/>