Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Vaish <gvaish@mono-cvs.ximian.com>2003-04-07 15:24:39 +0400
committerGaurav Vaish <gvaish@mono-cvs.ximian.com>2003-04-07 15:24:39 +0400
commitf942ad8b268c9b91fc93d0395e90aeb77b2e9e86 (patch)
tree341b9791b31b71ecb65154ebf6ad238e9a7c960e /mcs/class/System.Web.Mobile
parent011004ad7f6568f233ff72eb35b999ec29b21234 (diff)
2003-04-07 Gaurav Vaish <gvaish_mono AT lycos.com>
* MobileListItem.cs : Completed. svn path=/trunk/mcs/; revision=13266
Diffstat (limited to 'mcs/class/System.Web.Mobile')
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog4
-rw-r--r--mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs207
2 files changed, 201 insertions, 10 deletions
diff --git a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
index 8f491eb06bc..33c47efad9d 100644
--- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/ChangeLog
@@ -1,4 +1,8 @@
+2003-04-07 Gaurav Vaish <gvaish_mono AT lycos.com>
+
+ * MobileListItem.cs : Completed.
+
2003-04-04 Gaurav Vaish <gvaish_mono AT lycos.com>
* DeviceSpecificChoice.cs: FindAndApplyProperty(...) - Bug fix.
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
index 8f2b36a1048..fa870646ab1 100644
--- a/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs
+++ b/mcs/class/System.Web.Mobile/System.Web.UI.MobileControls/MobileListItem.cs
@@ -9,50 +9,150 @@
*/
using System;
+using System.Collections;
using System.Web.UI;
+using System.Web.UI.WebControls;
namespace System.Web.UI.MobileControls
{
- public class MobileListItem : TemplateContainer//, IStateManager
+ public class MobileListItem : TemplateContainer, IStateManager
{
+ private int index;
+ private string text;
+ private string value;
+
+ private object dataItem;
+ private MobileListItemType itemType;
+
+ private const int SELECTED = 0x00;
+ private const int MARKED = 0x01; // Tracking?
+ private const int SELECTD = 0x02; // Selection dirty flag
+ private const int TEXTD = 0x03; // Text dirty flag
+ private const int VALUED = 0x04; // Value dirty flag
+
+ private BitArray flags = new BitArray(5);
+
public MobileListItem()
+ : this(null, null, null)
{
}
public MobileListItem(MobileListItemType type)
+ : this(null, null, null)
{
- throw new NotImplementedException();
+ this.itemType = type;
}
public MobileListItem(string text)
+ : this(null, text, null)
{
- throw new NotImplementedException();
}
public MobileListItem(string text, string value)
+ : this(null, text, value)
{
- throw new NotImplementedException();
}
public MobileListItem(object dataItem, string text, string value)
+ : base()
{
- throw new NotImplementedException();
+ this.dataItem = dataItem;
+ this.text = text;
+ this.value = value;
+ this.itemType = MobileListItemType.ListItem;
}
internal void SetIndex(int index)
{
- throw new NotImplementedException();
+ this.index = index;
+ }
+
+ public object DataItem
+ {
+ get
+ {
+ return this.dataItem;
+ }
+ set
+ {
+ this.dataItem = value;
+ }
+ }
+
+ public int Index
+ {
+ get
+ {
+ return this.index;
+ }
+ }
+
+ internal MobileListItemType ItemType
+ {
+ get
+ {
+ return this.itemType;
+ }
+ }
+
+ public bool Selected
+ {
+ get
+ {
+ return flags[SELECTED];
+ }
+ set
+ {
+ flags[SELECTED] = value;
+ if(IsTrackingViewState)
+ {
+ flags[SELECTD] = true;
+ }
+ }
+ }
+
+ internal bool IsSelectionDirty
+ {
+ get
+ {
+ return flags[SELECTD];
+ }
+ set
+ {
+ flags[SELECTD] = value;
+ }
+ }
+
+ internal bool IsDirty
+ {
+ get
+ {
+ return (flags[TEXTD] || flags[VALUED]);
+ }
+ set
+ {
+ flags[TEXTD] = value;
+ flags[VALUED] = value;
+ }
}
public string Text
{
get
{
- throw new NotImplementedException();
+ if(this.text != null)
+ return this.text;
+ if(this.value != null)
+ return this.value;
+ return String.Empty;
}
set
{
- throw new NotImplementedException();
+ this.text = value;
+ if(IsTrackingViewState)
+ {
+ flags[TEXTD] = true;
+ }
}
}
@@ -60,11 +160,98 @@ namespace System.Web.UI.MobileControls
{
get
{
- throw new NotImplementedException();
+ if(this.value != null)
+ return this.value;
+ if(this.text != null)
+ return this.text;
+ return String.Empty;
}
set
{
- throw new NotImplementedException();
+ this.value = value;
+ if(IsTrackingViewState)
+ {
+ flags[VALUED] = true;
+ }
+ }
+ }
+
+ public static implicit operator MobileListItem(string text)
+ {
+ return new MobileListItem(text);
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return flags[MARKED];
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj is MobileListItem)
+ {
+ MobileListItem other = (MobileListItem) obj;
+ return (this.Text == other.Text &&
+ this.Value == other.Value);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return (Text.GetHashCode() + Value.GetHashCode());
+ }
+
+ public static MobileListItem FromString(string text)
+ {
+ return new MobileListItem(text);
+ }
+
+ public override string ToString()
+ {
+ return this.Text;
+ }
+
+ protected override bool OnBubbleEvent(object sender, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ CommandEventArgs cmdArgs = (CommandEventArgs)e;
+ RaiseBubbleEvent(this,
+ new ListCommandEventArgs(this, sender,
+ cmdArgs));
+ return true;
+ }
+ return false;
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ flags[MARKED] = true;
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ object retVal = null;
+ string text = (flags[TEXTD] ? this.text : null);
+ string value = (flags[VALUED] ? this.value : null);
+ if(text != null || value != null)
+ {
+ retVal = new string[] { text, value };
+ }
+ return retVal;
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ if(state != null)
+ {
+ string[] data = (string[]) state;
+ this.text = data[0];
+ this.value = data[1];
}
}
}