Fix for running against RabbitMQ 2.2
[mono.git] / mcs / class / System.Web / System.Web.UI.Adapters / ControlAdapter.cs
index 2d5a7a019f3267b8dd70f5df94d2719be1189a32..ea0aa13b97df70875b3c7d3ffc115140804e2548 100644 (file)
@@ -4,7 +4,7 @@
 // Author:
 //     Dick Porter  <dick@ximian.com>
 //
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 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
@@ -26,7 +26,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System.Web;
 using System.Web.UI;
 using System.ComponentModel;
@@ -35,125 +34,146 @@ namespace System.Web.UI.Adapters
 {
        public abstract class ControlAdapter
        {
+               internal ControlAdapter (Control c)
+               {
+                       control = c;
+               }
+               
                protected ControlAdapter ()
                {
                }
 
-               [MonoTODO("Not implemented")]
                protected HttpBrowserCapabilities Browser 
                {
                        get {
-                               throw new NotImplementedException ();
+                               Page page = Page;
+
+                               if (page != null)
+                                       return page.Request.Browser;
+
+                               return null;
                        }
                }
 
-               [MonoTODO("Not implemented")]
+               internal Control control;
+               
                [Browsable (false)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                protected Control Control 
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       get { return control; }
                }
 
-               [MonoTODO("Not implemented")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                [Browsable (false)]
                protected Page Page 
                {
                        get {
-                               throw new NotImplementedException ();
+                               Control control = Control;
+
+                               if (control != null)
+                                       return control.Page;
+
+                               return null;
                        }
                }
                
-               [MonoTODO("Not implemented")]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                [Browsable (false)]
                protected PageAdapter PageAdapter 
                {
                        get {
-                               throw new NotImplementedException ();
+                               Page page = Page;
+
+                               if (page != null)
+                                       return page.PageAdapter;
+
+                               return null;
                        }
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void BeginRender (HtmlTextWriter w)
                {
-                       throw new NotImplementedException ();
+                       w.BeginRender();
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void CreateChildControls ()
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+                       if (control != null)
+                               control.CreateChildControls ();
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void EndRender (HtmlTextWriter w)
                {
-                       throw new NotImplementedException ();
+                       w.EndRender ();
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void LoadAdapterControlState (object state)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void LoadAdapterViewState (object state)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void OnInit (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.OnInit(e);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void OnLoad (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.OnLoad(e);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void OnPreRender (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.OnPreRender(e);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void OnUnload (EventArgs e)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.OnUnload(e);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void Render (HtmlTextWriter w)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.Render (w);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual void RenderChildren (HtmlTextWriter w)
                {
-                       throw new NotImplementedException ();
+                       Control control = Control;
+
+                       if (control != null)
+                               control.RenderChildren (w);
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual object SaveAdapterControlState ()
                {
-                       throw new NotImplementedException ();
+                       return null;
                }
 
-               [MonoTODO("Not implemented")]
                protected internal virtual object SaveAdapterViewState ()
                {
-                       throw new NotImplementedException ();
+                       return null;
                }
        }
 }
-#endif
+