diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-06-04 20:49:33 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2002-06-04 20:49:33 +0400 |
commit | f1b29831f994a09249fb041c9894d5caabe1fdf5 (patch) | |
tree | 2f6b402a765b9850e7b5d4fb7601c7b249c5b36e /mcs/class | |
parent | 22f23b9995e6170eeadd6bfce4278ebc22651119 (diff) |
2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* System.Web.UI/Control.cs: don't throw exception in ControlID. By now,
it returns ID.
* System.Web.UI/Page.cs:
(ProcessRequest): implemented.
* System.Web.UI.HtmlControls/HtmlAnchor.cs:
(RenderAttributes): new -> override and fixed little bug that made
it cause an stack overflow.
* System.Web.UI.HtmlControls/HtmlContainerControl.cs: reformatted and
added tag and its attributes rendering.
* System.Web.UI.HtmlControls/HtmlGenericControl.cs: removed TagName,
which is already in HtmlControl.
* System.Web.UI.HtmlControls/HtmlTable.cs:
(RenderEndTag): new -> override.
svn path=/trunk/mcs/; revision=5117
Diffstat (limited to 'mcs/class')
8 files changed, 122 insertions, 98 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog index df1e190fbcf..237b9ca1571 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog @@ -1,3 +1,18 @@ +2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HtmlAnchor.cs: + (RenderAttributes): new -> override and fixed little bug that made + it cause an stack overflow. + + * HtmlContainerControl.cs: reformatted and added tag and attributes + rendering. + + * HtmlGenericControl.cs: removed TagName, which is already in + HtmlControl. + + * HtmlTable.cs: + (RenderEndTag): new -> override. + 2002-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com> * System.Web.UI.HtmlControls/HtmlForm.cs: diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs index 8d8a4787198..f469b7ee1c2 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs @@ -25,7 +25,7 @@ namespace System.Web.UI.HtmlControls{ if(handler != null) handler.Invoke(this, e);
}
- protected new void RenderAttributes(HtmlTextWriter writer){
+ protected override void RenderAttributes(HtmlTextWriter writer){
if ( Events[EventServerClick] != null){
Attributes.Remove("href");
base.RenderAttributes(writer);
@@ -33,7 +33,7 @@ namespace System.Web.UI.HtmlControls{ }
else{
PreProcessRelativeReference(writer,"href");
- RenderAttributes(writer);
+ base.RenderAttributes(writer);
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs index 41f3b8046c8..6f063a51102 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs @@ -1,83 +1,89 @@ -//
-// System.Web.UI.HtmlControls.HtmlContainerControl.cs
-//
-// Author
- // Bob Smith <bob@thestuff.net>
- //
- // (C) Bob Smith
- //
-
- using System;
- using System.Web;
- using System.Web.UI;
-
- //LAMESPEC: The dox talk about HttpException but are very ambigious.
- //TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
- //case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
- //to do anything with children.
- // a doc references this. add? protected override ControlCollection CreateControlCollection();
-
- //TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
- // Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
- //[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
- // System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
- // ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
- // System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
- // System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
- // System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
- // System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
- // System.Web.UI.Page.ProcessRequestMain() +660
-
-
- namespace System.Web.UI.HtmlControls
- {
- public abstract class HtmlContainerControl : HtmlControl{
-
- private string _innerHtml = String.Empty;
- private string _innerText = String.Empty;
- private bool _doText = false;
- private bool _doChildren = true;
- protected string _tagName;
-
- public HtmlContainerControl() : base(){}
-
- public HtmlContainerControl(string tag) : base(tag) {}
-
- public virtual string InnerHtml
- {
- get
- {
- return _innerHtml;
- }
- set
- {
- _innerHtml = value;
- _doText = false;
- _doChildren = false;
- }
- }
-
- public virtual string InnerText
- {
- get
- {
- return _innerText;
- }
- set
- {
- _innerText = value;
- _doText = true;
- _doChildren = false;
- }
- }
-
- protected override void Render(HtmlTextWriter writer)
- {
- if(_doChildren) RenderChildren(writer);
- else if(_doText) Page.Server.HtmlEncode(_innerText, writer);
- else writer.Write(_innerHtml);
- }
-
- protected virtual void RenderEndTag(HtmlTextWriter writer){}
- }
- }
+// +// System.Web.UI.HtmlControls.HtmlContainerControl.cs +// +// Author +// Bob Smith <bob@thestuff.net> +// +// (C) Bob Smith +// + +using System; +using System.Web; +using System.Web.UI; + +//LAMESPEC: The dox talk about HttpException but are very ambigious. +//TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the +//case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear +//to do anything with children. +// a doc references this. add? protected override ControlCollection CreateControlCollection(); + +//TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this: +// Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal. +//[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.] +// System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278 +// ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6 +// System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108 +// System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26 +// System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 +// System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149 +// System.Web.UI.Page.ProcessRequestMain() +660 + + +namespace System.Web.UI.HtmlControls +{ + public abstract class HtmlContainerControl : HtmlControl{ + + private string _innerHtml = String.Empty; + private string _innerText = String.Empty; + private bool _doText = false; + private bool _doChildren = true; + + public HtmlContainerControl() : base(){} + + public HtmlContainerControl(string tag) : base(tag) {} + + public virtual string InnerHtml + { + get + { + return _innerHtml; + } + set + { + _innerHtml = value; + _doText = false; + _doChildren = false; + } + } + + public virtual string InnerText + { + get + { + return _innerText; + } + set + { + _innerText = value; + _doText = true; + _doChildren = false; + } + } + + protected override void Render(HtmlTextWriter writer) + { + writer.WriteBeginTag (TagName); + RenderAttributes (writer); + writer.Write ('>'); + if(_doChildren) RenderChildren(writer); + else if(_doText) Page.Server.HtmlEncode(_innerText, writer); + else writer.Write(_innerHtml); + RenderEndTag (writer); + } + + protected virtual void RenderEndTag (HtmlTextWriter writer) + { + writer.WriteEndTag (TagName); + } + } +} diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs index 2583de6190b..619ad693642 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs @@ -19,14 +19,5 @@ public HtmlGenericControl(string tag): base(tag){}
- public new string TagName {
- get
- {
- return _tagName;
- }
- set{
- _tagName = value;
- }
- }
}
}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs index db057fd16ff..800b64a0bc8 100755 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs @@ -26,7 +26,7 @@ namespace System.Web.UI.HtmlControls{ writer.Indent = writer.Indent - 1;
}
- protected new void RenderEndTag(HtmlTextWriter writer){
+ protected override void RenderEndTag(HtmlTextWriter writer){
base.RenderEndTag(writer);
writer.WriteLine();
}
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index 0d493474cc0..deae2c8e196 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,5 +1,12 @@ 2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + * Control.cs: don't throw exception in ControlID. By now, it returns ID. + + * Page.cs: + (ProcessRequest): implemented. + +2002-06-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + * System.Web.UI/Page.cs: finished stubbing out. Implemented some methods. diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs index 70779b7cdaa..406cc951a1c 100644 --- a/mcs/class/System.Web/System.Web.UI/Control.cs +++ b/mcs/class/System.Web/System.Web.UI/Control.cs @@ -219,7 +219,7 @@ namespace System.Web.UI {
//TODO: Some Naming container methods here. What are they? Why arnt they declared?
//Note: Nuked the old stuff here. Was total crap. :)
- throw new NotImplementedException();
+ return ID;
}
}
public virtual bool Visible
@@ -533,7 +533,7 @@ namespace System.Web.UI [MonoTODO]
public string ResolveUrl(string relativeUrl)
{
- throw new NotImplementedException();
+ return relativeUrl;
}
public void SetRenderMethodDelegate(RenderMethod renderMethod) //DIT
{
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 3661b9f1f86..61fe2e186ea 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -339,7 +339,12 @@ public class Page : TemplateControl, IHttpHandler public void ProcessRequest (HttpContext context) { - throw new NotImplementedException (); + FrameworkInitialize (); + _context = context; + HtmlTextWriter output = new HtmlTextWriter (context.Response.Output); + + foreach (Control ctrl in Controls) + ctrl.RenderControl (output); } protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument) |