diff options
author | Gaurav Vaish <gvaish@mono-cvs.ximian.com> | 2003-04-14 16:30:45 +0400 |
---|---|---|
committer | Gaurav Vaish <gvaish@mono-cvs.ximian.com> | 2003-04-14 16:30:45 +0400 |
commit | f01e552d751b42a161a4e2c1130b258fe80a126b (patch) | |
tree | 51f33103ccc0d74a73973d5273f85e436fac6970 /mcs/class/System.Web.Mobile | |
parent | 087e75b3369a1ca45e85cb832022cf916b3e3c3e (diff) |
2003-04-08 Gaurav Vaish <gvaish_mono AT lycos.com>
* ControlAdapter.cs : Initial implementation.
* HtmlControlAdapter.cs : Corrected the namesapce.
svn path=/trunk/mcs/; revision=13586
Diffstat (limited to 'mcs/class/System.Web.Mobile')
3 files changed, 192 insertions, 4 deletions
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog index 4b0a3490e4a..e4974edfe67 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ChangeLog @@ -1,4 +1,9 @@ 2003-04-08 Gaurav Vaish <gvaish_mono AT lycos.com> + * ControlAdapter.cs : Initial implementation. + * HtmlControlAdapter.cs : Corrected the namesapce. + +2003-04-08 Gaurav Vaish <gvaish_mono AT lycos.com> + * HtmlControlAdapter.cs : Initial implementation.
\ No newline at end of file diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs new file mode 100644 index 00000000000..f8887e93185 --- /dev/null +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/ControlAdapter.cs @@ -0,0 +1,186 @@ +/** + * Project : Mono + * Namespace : System.Web.UI.MobileControls.Adapters + * Class : ControlAdapter + * Author : Gaurav Vaish + * + * Copyright : 2003 with Gaurav Vaish, and with + * Ximian Inc + */ + +using System; +using System.Collections.Specialized; +using System.Web.Mobile; +using System.Web.UI; +using System.Web.UI.MobileControls; + +namespace System.Web.UI.MobileControls.Adapters +{ + public abstract class ControlAdapter : IControlAdapter + { + private MobileControl control = null; + + protected static readonly int BackLabel = 0x00; + protected static readonly int GoLabel = 0x01; + protected static readonly int OKLabel = 0x02; + protected static readonly int MoreLabel = 0x03; + protected static readonly int OptionsLabel = 0x04; + protected static readonly int NextLabel = 0x05; + protected static readonly int PreviousLabel = 0x06; + protected static readonly int LinkLabel = 0x07; + protected static readonly int CallLabel = 0x08; + + private static string[] labelIDs = { + "ControlAdapter_Back", + "ControlAdapter_Go", + "ControlAdapter_OK", + "ControlAdapter_More", + "ControlAdapter_Options", + "ControlAdapter_Next", + "ControlAdapter_Previous", + "ControlAdapter_Link", + "ControlAdapter_Call" + }; + + private string[] defaultLabels = null; + + public ControlAdapter() + { + } + + public MobileCapabilities Device + { + get + { + if(Page != null) + { + return (MobileCapabilities) Page.Request.Browser; + } + return null; + } + } + + public MobileControl Control + { + get + { + return this.control; + } + set + { + this.control = value; + } + } + + public int ItemWeight + { + get + { + return ControlPager.UseDefaultWeight; + } + } + + public MobilePage Page + { + get + { + if(Control != null) + return Control.MobilePage; + return null; + } + } + + public int VisibleWeight + { + get + { + return ControlPager.UseDefaultWeight; + } + } + + public void CreateTemplatedUI(bool doDataBind) + { + Control.CreateDefaultTemplatedUI(doDataBind); + } + + public bool HandlePostBackEvent(string eventArguments) + { + return false; + } + + public void LoadAdapterState(object state) + { + return; + } + + public bool LoadPostData(string postKey, + NameValueCollection postCollection, + object privateControlData, out bool dataChanged) + { + dataChanged = false; + return false; + } + + public void OnInit(EventArgs e) + { + return; + } + + public void OnLoad(EventArgs e) + { + return; + } + + public void OnPreRender(EventArgs e) + { + return; + } + + public void OnUnload(EventArgs e) + { + return; + } + + public void Render(HtmlTextWriter writer) + { + RenderChildren(writer); + } + + public object SaveAdapterState() + { + return null; + } + + protected void RenderChildren(HtmlTextWriter writer) + { + if(Control != null && Control.HasControls()) + { + foreach(Control cCtrl in Control.Controls) + { + cCtrl.RenderControl(writer); + } + if(Control.Controls.GetEnumerator() is IDisposable) + { + ((IDisposable)Control.Controls.GetEnumerator()).Dispose(); + } + } + } + + protected int CalculateOptimumPageWeight(int defaultPageWeight) + { + int defWt = defaultPageWeight; + if(Device != null) + { + string httpDefWt = Device[Constants.OptimumPageWeightParameter]; + if(httpDefWt != null) + { + try + { + defWt = Convert.ToInt32(httpDefWt); + } catch { } + } + } + return -1; + } + } +} diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs index dc9261c93e9..5f3af52fbac 100644 --- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs +++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls.Adapters/HtmlControlAdapter.cs @@ -9,11 +9,8 @@ */ using System; -using System.Collections; -using System.Web; -using System.Web.UI; -namespace System.Web.Mobile +namespace System.Web.UI.MobileControls.Adapters { public class HtmlControlAdapter //: ControlAdapter { |