2003-01-30 Gaurav Vaish <gvaish_mono AT lycos.com>
authorGaurav Vaish <gvaish@mono-cvs.ximian.com>
Thu, 30 Jan 2003 17:04:07 +0000 (17:04 -0000)
committerGaurav Vaish <gvaish@mono-cvs.ximian.com>
Thu, 30 Jan 2003 17:04:07 +0000 (17:04 -0000)
* ListDataHelper.cs      : Initial implementation.
* DataSourceHelper.cs    : Initial implementation.

svn path=/trunk/mcs/; revision=11064

mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ChangeLog [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.Mobile.Util/DataSourceHelper.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ListDataHelper.cs [new file with mode: 0644]

diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ChangeLog
new file mode 100644 (file)
index 0000000..668435d
--- /dev/null
@@ -0,0 +1,5 @@
+
+2003-01-30     Gaurav Vaish <gvaish_mono AT lycos.com>
+
+       * ListDataHelper.cs      : Initial implementation.
+       * DataSourceHelper.cs    : Initial implementation.
diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/DataSourceHelper.cs b/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/DataSourceHelper.cs
new file mode 100644 (file)
index 0000000..e8e3a0e
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.Mobile.Util
+ * Class     : DataSourceHelper
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System.Collections;
+using System.Web.UI;
+using System.Web.Mobile;
+using System.Web.UI.MobileControls;
+
+namespace System.Web.Mobile.Util
+{
+       internal class DataSourceHelper
+       {
+               private DataSourceHelper()
+               {
+               }
+
+               [MonoTODO("Have_to_see_how_I_did_in_WebControls")]
+               public static IEnumerable GetResolvedDataSource(object dataSource,
+                                                               string dataMember)
+               {
+                       IEnumerable retVal = null;
+                       if(dataSource != null)
+                       {
+                               throw new NotImplementedException();
+                       }
+                       return retVal;
+               }
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ListDataHelper.cs b/mcs/class/System.Web.Mobile/System.Web.Mobile.Util/ListDataHelper.cs
new file mode 100644 (file)
index 0000000..61cd1b8
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.Mobile.Util
+ * Class     : ListDataHelper
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System.Collections;
+using System.Web.UI;
+using System.Web.Mobile;
+using System.Web.UI.MobileControls;
+
+namespace System.Web.Mobile.Util
+{
+       internal class ListDataHelper
+       {
+               private object dataSource;
+               private int    dataSourceCount = -1;
+               private IEnumerable resolvedDataSrc;
+               private MobileListItemCollection items;
+               private string dataTextField;
+               private string dataValueField;
+               private bool   bindFromFields;
+
+               private IListControl parent;
+               private StateBag     parentViewState;
+
+               public ListDataHelper(IListControl parent, StateBag parentViewState)
+               {
+                       this.parent          = parent;
+                       this.parentViewState = parentViewState;
+               }
+
+               public string DataMember
+               {
+                       get
+                       {
+                               object o = parentViewState["DataMember"];
+                               if(o != null)
+                                       return (string)o;
+                               return String.Empty;
+                       }
+                       set
+                       {
+                               parentViewState["DataMember"] = value;
+                       }
+               }
+
+               public object DataSource
+               {
+                       get
+                       {
+                               return this.dataSource;
+                       }
+                       set
+                       {
+                               this.dataSource = value;
+                       }
+               }
+
+               public int DataSourceCount
+               {
+                       get
+                       {
+                               if(dataSourceCount == -1)
+                               {
+                                       if(ResolvedDataSource != null)
+                                       {
+                                               if(ResolvedDataSource is ICollection)
+                                                       dataSourceCount = ((ICollection)ResolvedDataSource).Count;
+                                       }
+                               }
+                               return dataSourceCount;
+                       }
+               }
+
+               public IEnumerable ResolvedDataSource
+               {
+                       get
+                       {
+                               if(this.resolvedDataSrc == null)
+                               {
+                                       resolvedDataSrc = DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+                               }
+                               return resolvedDataSrc;
+                       }
+               }
+
+
+       }
+}