2003-01-19 Gaurav Vaish <gvaish_mono AT lycos.com>
authorGaurav Vaish <gvaish@mono-cvs.ximian.com>
Sun, 19 Jan 2003 18:21:11 +0000 (18:21 -0000)
committerGaurav Vaish <gvaish@mono-cvs.ximian.com>
Sun, 19 Jan 2003 18:21:11 +0000 (18:21 -0000)
* Command.cs             : Initial implementation.
* IObjectListFieldCollection.cs
                         : F*** the docs. Use only reflection
                           to get the correct methods / properties.
* TextControl.cs         : Implemented.
* ObjectListCommandEventArgs/Handler.cs
                         : Implemented.
* MobileListItem.cs      : Initial Implementation.
* ObjectListItem.cs      : Initial Implementation.
* ObjectList.cs          : Initial Implementation.
* TemplateContainer.cs   : Initial Implementation.

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

mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/IObjectListFieldCollection.cs
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs [new file with mode: 0644]
mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs [new file with mode: 0644]

index cc540cd1c74cef1019391f11cda92ddc0793f766..8c541cd28dc2c2384f78b769831f84ce94d06ea4 100644 (file)
@@ -1,4 +1,18 @@
 
+2003-01-19     Gaurav Vaish <gvaish_mono AT lycos.com>
+
+       * Command.cs             : Initial implementation.
+       * IObjectListFieldCollection.cs
+                                : F*** the docs. Use only reflection
+                                  to get the correct methods / properties.
+       * TextControl.cs         : Implemented.
+       * ObjectListCommandEventArgs/Handler.cs
+                                : Implemented.
+       * MobileListItem.cs      : Initial Implementation.
+       * ObjectListItem.cs      : Initial Implementation.
+       * ObjectList.cs          : Initial Implementation.
+       * TemplateContainer.cs   : Initial Implementation.
+
 2003-01-18     Gaurav Vaish <gvaish_mono AT lycos.com>
 
        * Constants.cs           : Undocumented class. Reflection revealed.     
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/Command.cs
new file mode 100644 (file)
index 0000000..33bc613
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : Command
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+       public class Command : TextControl, IPostBackEventHandler
+       {
+               private static readonly object ClickEvent       = new object();
+               private static readonly object ItemCommandEvent = new object();
+
+               public Command()
+               {
+               }
+
+               public event EventHandler Click
+               {
+                       add
+                       {
+                               Events.AddHandler(ClickEvent, value);
+                       }
+                       remove
+                       {
+                               Events.RemoveHandler(ClickEvent, value);
+                       }
+               }
+
+               public event ObjectListCommandEventHandler ItemCommand
+               {
+                       add
+                       {
+                               Events.AddHandler(ItemCommandEvent, value);
+                       }
+                       remove
+                       {
+                               Events.RemoveHandler(ItemCommandEvent, value);
+                       }
+               }
+
+               void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+               {
+                       throw new NotImplementedException();
+               }
+       }
+}
index 84fdd9523e1d25eb11ad2d1179b18d91f5ab69be..c84d3946b4c4b0ff9c317bdd207ebc96eef73c7b 100644 (file)
@@ -18,6 +18,6 @@ namespace System.Web.UI.MobileControls
                
                ObjectListField[] GetAll();
                int               IndexOf(ObjectListField field);
-               int               ObjectListField(string fieldID);
+               int               IndexOf(string fieldID);
        }
 }
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs
new file mode 100644 (file)
index 0000000..d7f9ada
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : MobileListItem
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+       public class MobileListItem : TemplateContainer//, IStateManager
+       {
+               public MobileListItem()
+               {
+               }
+
+               public MobileListItem(MobileListItemType type)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public MobileListItem(string text)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public MobileListItem(string text, string value)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public MobileListItem(object dataItem, string text, string value)
+               {
+                       throw new NotImplementedException();
+               }
+
+               public string Text
+               {
+                       get
+                       {
+                               throw new NotImplementedException();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException();
+                       }
+               }
+
+               public string Value
+               {
+                       get
+                       {
+                               throw new NotImplementedException();
+                       }
+                       set
+                       {
+                               throw new NotImplementedException();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectList.cs
new file mode 100644 (file)
index 0000000..4bb4b46
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : ObjectList
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+       public class ObjectList // : PagedControl, INamingContainer,
+                               // ITemplateable, IPostBackEventHander
+       {
+               public ObjectList()
+               {
+               }
+
+               public IObjectListFieldCollection AllFields
+               {
+                       get
+                       {
+                               throw new NotImplementedException();
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventArgs.cs
new file mode 100644 (file)
index 0000000..5e9d873
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : ObjectListCommandEventHandler
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System;
+using System.Web.UI.WebControls;
+
+namespace System.Web.UI.MobileControls
+{
+       public class ObjectListCommandEventArgs : CommandEventArgs
+       {
+               private ObjectListItem item;
+               private object         commandSource;
+
+               public ObjectListCommandEventArgs(ObjectListItem item,
+                                                 object source, CommandEventArgs e)
+                                                 : base(e)
+               {
+                       this.item          = item;
+                       this.commandSource = source;
+               }
+
+               public ObjectListCommandEventArgs(ObjectListItem item,
+                                                 string commandName)
+                                                 : base(commandName, item)
+               {
+                       this.item          = item;
+                       this.commandSource = null;
+               }
+
+               public object CommandSource
+               {
+                       get
+                       {
+                               return this.commandSource;
+                       }
+               }
+
+               public ObjectListItem ListItem
+               {
+                       get
+                       {
+                               return this.item;
+                       }
+               }
+
+               protected static readonly string DefaultCommand = "Default";
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListCommandEventHandler.cs
new file mode 100644 (file)
index 0000000..7817fe8
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : ObjectListCommandEventHandler
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+namespace System.Web.UI.MobileControls
+{
+       public delegate void ObjectListCommandEventHandler(object sender,
+                                  ObjectListCommandEventArgs e);
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ObjectListItem.cs
new file mode 100644 (file)
index 0000000..bf80eb8
--- /dev/null
@@ -0,0 +1,119 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : ObjectListCommandEventHandler
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System;
+using System.Web.Mobile;
+
+namespace System.Web.UI.MobileControls
+{
+       public class ObjectListItem : MobileListItem
+       {
+               private ObjectList owner;
+               private string[]   fields;
+               private bool       dirty = false;
+
+               internal ObjectListItem(ObjectList owner, object dataItem)
+                                     : base(dataItem, null, null)
+               {
+                       this.owner = owner;
+                       this.fields = new string[owner.AllFields.Count];
+               }
+
+               internal ObjectListItem(ObjectList owner)
+                                   : this(owner, null)
+               {
+               }
+
+               public string this[int key]
+               {
+                       get
+                       {
+                               if(fields != null && fields.Length >= key - 1
+                                  && fields[key] != null)
+                                       return fields[key];
+                               return String.Empty;
+                       }
+                       set
+                       {
+                               if(fields != null && fields.Length >= key - 1)
+                                       fields[key] = value;
+                               if(IsTrackingViewState)
+                                       dirty = true;
+                       }
+               }
+
+               internal bool Dirty
+               {
+                       get
+                       {
+                               return dirty;
+                       }
+                       set
+                       {
+                               dirty = value;
+                       }
+               }
+
+               public string this[string fieldName]
+               {
+                       get
+                       {
+                               return this[IndexOf(fieldName)];
+                       }
+                       set
+                       {
+                               this[IndexOf(fieldName)] = value;
+                       }
+               }
+
+               [MonoTODO("Exception_Details_Not_Exact")]
+               private int IndexOf(string fieldName)
+               {
+                       int index = owner.AllFields.IndexOf(fieldName);
+                       if(index < 0)
+                       {
+                               throw new ArgumentException("ObjectList_FieldNotFound");
+                       }
+                       return index;
+               }
+
+               public override bool Equals(object obj)
+               {
+                       bool retVal = false;
+                       if(obj is ObjectListItem)
+                       {
+                               ObjectListItem oli = (ObjectListItem) obj;
+                               if(oli.fields != null && this.fields != null)
+                               {
+                                       if(this.fields.Length == oli.fields.Length)
+                                       {
+                                               int i;
+                                               for(i = 0; i < fields.Length; i++)
+                                               {
+                                                       if(fields[i] != oli.fields[i])
+                                                               break;
+                                               }
+                                               if(i == fields.Length)
+                                                       retVal = true;
+                                       }
+                               }
+                               retVal &= (Value == oli.Value);
+                               retVal &= (Text == oli.Text);
+                       }
+                       return retVal;
+               }
+
+               public override int GetHashCode()
+               {
+                       return (fields == null ? Value.GetHashCode() :
+                                                    fields[0].GetHashCode());
+               }
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TemplateContainer.cs
new file mode 100644 (file)
index 0000000..2bbef3f
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : TemplateContainer
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System;
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+       public class TemplateContainer : Panel, INamingContainer
+       {
+               public TemplateContainer()
+               {
+               }
+       }
+}
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/TextControl.cs
new file mode 100644 (file)
index 0000000..055ba9f
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Project   : Mono
+ * Namespace : System.Web.UI.MobileControls
+ * Class     : TextControl
+ * Author    : Gaurav Vaish
+ *
+ * Copyright : 2003 with Gaurav Vaish, and with
+ *             Ximian Inc
+ */
+
+using System.Web.UI;
+
+namespace System.Web.UI.MobileControls
+{
+       public class TextControl : MobileControl
+       {
+               public TextControl()
+               {
+               }
+
+               /*
+                * Document speaks of
+                * public IControlAdapter Adapter { get; }
+                * but this is not available (no such property).
+                * So, I am not keeping it.
+                */
+
+               public string Text
+               {
+                       get
+                       {
+                               return InnerText;
+                       }
+                       set
+                       {
+                               InnerText = value;
+                       }
+               }
+       }
+}