소스 검색

2004-11-26 Lluis Sanchez Gual <[email protected]>

	* TreeNodeBindingCollection.cs: Implemented.
	* TreeNodeBinding.cs: Implemented.
	* TreeNode.cs: Added support for data binding.
	* TreeView_Default_Collapse.gif, TreeView_Default_Expand.gif
	  TreeView_Default_NoExpand.gif: Moved to resources directory.
	* ListControl.cs: Fixed api.
	* XmlHierarchicalEnumerable.cs: Made internal.
	* DataBoundControl.cs: Modified api to match latest ms.net.
	* TreeView.js: New javascript file to support TreeView in the client.
	* XmlDataSource.cs: Added missing attributes.
	* HierarchicalDataBoundControl.cs: Mostly implemented.
	* BaseDataBoundControl.cs: Mostly implemented.
	* XmlHierarchyData.cs: Made internal.
	* TreeView.cs: Mostly implemented. The major missing feature is
	  client side tree population.


svn path=/trunk/mcs/; revision=36652
Lluis Sanchez 21 년 전
부모
커밋
7cd5b5fde6

+ 89 - 0
mcs/class/System.Web/System.Web.UI.WebControls/BaseDataBoundControl.cs

@@ -35,6 +35,95 @@ namespace System.Web.UI.WebControls
 {
 	public abstract class BaseDataBoundControl: WebControl
 	{
+		public event EventHandler DataBound;
+		
+		object dataSource;
+		string dataSourceId;
+		bool initialized;
+		bool requiresDataBinding = true;
+		
+		public virtual object DataSource {
+			get {
+				return dataSource;
+			}
+			set {
+				ValidateDataSource (value);
+				dataSource = value;
+			}
+		}
+		
+		public virtual string DataSourceID {
+			get { return dataSourceId; }
+			set { dataSourceId = value; }
+		}
+		
+		protected bool Initialized {
+			get { return initialized; }
+		}
+		
+		[MonoTODO]
+		protected bool IsBoundUsingDataSourceID {
+			get { return dataSourceId != null; }
+		}
+		
+		protected bool RequiresDataBinding {
+			get { return requiresDataBinding; }
+			set { requiresDataBinding = value; }
+		}
+		
+		[MonoTODO]
+		protected void ConfirmInitState ()
+		{
+		}
+		
+		public override void DataBind ()
+		{
+			PerformSelect ();
+			RequiresDataBinding = false;
+			OnDataBound (EventArgs.Empty);
+		}
+		
+		protected void EnsureDataBound ()
+		{
+			if (RequiresDataBinding && DataSourceID != "")
+				DataBind ();
+		}
+		
+		protected virtual void OnDataBound (EventArgs e)
+		{
+			if (DataBound != null)
+				DataBound (this, e);
+		}
+		
+		[MonoTODO]
+		protected virtual void OnDataPropertyChanged ()
+		{
+		}
+		
+		[MonoTODO]
+		protected override void OnInit (EventArgs e)
+		{
+			base.OnInit (e);
+			initialized = true;
+			if (!Page.IsPostBack)
+				RequiresDataBinding = true;
+		}
+		
+		[MonoTODO]
+		protected virtual void OnPagePreLoad (object sender, EventArgs e)
+		{
+		}
+		
+		protected override void OnPreRender (EventArgs e)
+		{
+			EnsureDataBound ();
+			base.OnPreRender (e);
+		}
+		
+		protected abstract void PerformSelect ();
+		
+		protected abstract void ValidateDataSource (object dataSource);
+		
 	}
 }
 

+ 18 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,21 @@
+2004-11-26 Lluis Sanchez Gual <[email protected]>
+
+	* TreeNodeBindingCollection.cs: Implemented.
+	* TreeNodeBinding.cs: Implemented.
+	* TreeNode.cs: Added support for data binding.
+	* TreeView_Default_Collapse.gif, TreeView_Default_Expand.gif
+	  TreeView_Default_NoExpand.gif: Moved to resources directory.
+	* ListControl.cs: Fixed api.
+	* XmlHierarchicalEnumerable.cs: Made internal.
+	* DataBoundControl.cs: Modified api to match latest ms.net.
+	* TreeView.js: New javascript file to support TreeView in the client.
+	* XmlDataSource.cs: Added missing attributes.
+	* HierarchicalDataBoundControl.cs: Mostly implemented.
+	* BaseDataBoundControl.cs: Mostly implemented.
+	* XmlHierarchyData.cs: Made internal.
+	* TreeView.cs: Mostly implemented. The major missing feature is
+	  client side tree population.
+
 2004-11-25 Sanjay Gupta <[email protected]>
 
 	* BaseDataList.cs: 

+ 28 - 81
mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs

@@ -40,101 +40,57 @@ using System.ComponentModel;
 namespace System.Web.UI.WebControls {
 	public abstract class DataBoundControl : BaseDataBoundControl
 	{
-		public event EventHandler DataBound;
-		
 		protected DataBoundControl ()
 		{
 		}
 		
-		public sealed override void DataBind ()
-		{
-			PerformDataBinding ();
-			RequiresDataBinding = false;
-			OnDataBound (EventArgs.Empty);
-		}
-		
-		protected void EnsureDataBound ()
-		{
-			if (RequiresDataBinding && DataSourceID != "")
-				DataBind ();
-		}
-
-		protected virtual object GetDataSourceObject()
+		protected IDataSource GetDataSource ()
 		{
 			if (DataSourceID != "")
-				return (IDataSource) NamingContainer.FindControl (DataSourceID);
+				return NamingContainer.FindControl (DataSourceID) as IDataSource;
 			
-			return DataSource;
+			return DataSource as IDataSource;
 		}
 		
-		
-		protected virtual IEnumerable GetResolvedDataSource ()
+		protected DataSourceView GetData ()
 		{
 			if (DataSource != null && DataSourceID != "")
 				throw new HttpException ();
 			
-			IDataSource ds = GetDataSourceObject () as IDataSource;
+			IDataSource ds = GetDataSource ();
 			if (ds != null && DataSourceID != "")
-				return ds.GetView (DataMember).ExecuteSelect (selectArguments);
-			else if (DataSource != null)
-				return DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+				return ds.GetView (DataMember);
 			else
 				return null; 
 		}
 		
-		protected bool IsBoundToDataSourceControl()
-		{
-			return (GetDataSourceObject () is IDataSource) && DataSourceID != "";
-		}
-		
-		protected virtual void OnDataBound(EventArgs e) {
-			if (DataBound != null)
-				DataBound (this, e);
-		}
-		
-		protected virtual void OnDataPropertyChanged ()
-		{
-			this.RequiresDataBinding = true;
-		}
-		
-		protected virtual void OnDataSourceChanged (object sender, EventArgs e)
+		protected override void OnDataPropertyChanged ()
 		{
 			RequiresDataBinding = true;
 		}
 		
-		// should be `internal protected' (why, oh WHY did they do that !?!)
-		protected override void OnInit (EventArgs e)
+		protected virtual void OnDataSourceViewChanged (object sender, EventArgs e)
 		{
-			base.OnInit(e);
-			inited = true;
-			if (!Page.IsPostBack)
-				RequiresDataBinding = true;
+			RequiresDataBinding = true;
 		}
 		
 		// should be `internal protected' (why, oh WHY did they do that !?!)
 		protected override void OnLoad (EventArgs e)
 		{
-			IDataSource ds = GetDataSourceObject () as IDataSource;
+			IDataSource ds = GetDataSource ();
 			if (ds != null && DataSourceID != "")
-				ds.DataSourceChanged += new EventHandler (OnDataSourceChanged);
+				ds.DataSourceChanged += new EventHandler (OnDataSourceViewChanged);
 			
 			base.OnLoad(e);
 		}
 		
-		// should be `internal protected' (why, oh WHY did they do that !?!)
-		protected override void OnPreRender (EventArgs e)
-		{
-			EnsureDataBound ();
-			base.OnPreRender (e);
-		}
-		
-		protected virtual void PerformDataBinding ()
+		protected virtual void PerformDataBinding (IEnumerable data)
 		{
-			OnDataBinding(EventArgs.Empty);
+			OnDataBinding (EventArgs.Empty);
 		}
 
 		
-		protected virtual void ValidateDataSource (object dataSource)
+		protected override void ValidateDataSource (object dataSource)
 		{
 			if (dataSource is IListSource || dataSource is IEnumerable)
 				return;
@@ -155,19 +111,7 @@ namespace System.Web.UI.WebControls {
 			}
 		}
 
-		object dataSource;
-		public virtual object DataSource
-		{
-			get {
-				return dataSource;
-			}
-			set {
-				ValidateDataSource (value);
-				dataSource = value;
-			}
-		}
-		
-		public virtual string DataSourceID {
+		public override string DataSourceID {
 			get {
 				object o = ViewState ["DataSourceID"];
 				if (o != null)
@@ -176,25 +120,28 @@ namespace System.Web.UI.WebControls {
 				return String.Empty;
 			}
 			set {
-				if (inited)
+				if (Initialized)
 					RequiresDataBinding = true;
 				
 				ViewState ["DataSourceID"] = value;
 			}
 		}
 		
-		bool requiresDataBinding;
-		protected bool RequiresDataBinding {
-			get { return requiresDataBinding; }
-			set { requiresDataBinding = value; }
+		protected override void PerformSelect ()
+		{
+			IEnumerable data = null;
+			DataSourceView view = GetData ();
+			if (view != null)
+				data = view.ExecuteSelect (SelectArguments);
+			else if (DataSource != null)
+				data = DataSourceHelper.GetResolvedDataSource (DataSource, DataMember);
+
+			PerformDataBinding (data);
 		}
 		
-		protected bool inited;
-		
-		DataSourceSelectArguments selectArguments = null;
-			
+		[MonoTODO]
 		protected DataSourceSelectArguments SelectArguments {
-			get { return selectArguments; }
+			get { return null; }
 		}
 	}
 }

+ 78 - 1
mcs/class/System.Web/System.Web.UI.WebControls/HierarchicalDataBoundControl.cs

@@ -33,8 +33,85 @@ using System.Collections;
 
 namespace System.Web.UI.WebControls
 {
-	public class HierarchicalDataBoundControl : BaseDataBoundControl
+	public abstract class HierarchicalDataBoundControl : BaseDataBoundControl
 	{
+		public override string DataSourceID {
+			get {
+				object o = ViewState ["DataSourceID"];
+				if (o != null)
+					return (string)o;
+				
+				return String.Empty;
+			}
+			set {
+				if (Initialized)
+					RequiresDataBinding = true;
+				
+				ViewState ["DataSourceID"] = value;
+			}
+		}
+		
+		protected HierarchicalDataSourceView GetData (string viewPath)
+		{
+			if (DataSource != null && DataSourceID != "")
+				throw new HttpException ();
+			
+			IHierarchicalDataSource ds = GetDataSource ();
+			if (ds != null)
+				return ds.GetHierarchicalView (viewPath);
+			else
+				return null; 
+		}
+		
+		protected IHierarchicalDataSource GetDataSource ()
+		{
+			if (DataSourceID != "")
+				return NamingContainer.FindControl (DataSourceID) as IHierarchicalDataSource;
+			
+			return DataSource as IHierarchicalDataSource;
+		}
+		
+		protected override void OnDataPropertyChanged ()
+		{
+			RequiresDataBinding = true;
+		}
+		
+		protected virtual void OnDataSourceChanged (object sender, EventArgs e)
+		{
+			RequiresDataBinding = true;
+		}
+
+		protected override void OnLoad (EventArgs e)
+		{
+			IHierarchicalDataSource ds = GetDataSource ();
+			if (ds != null && DataSourceID != "")
+				ds.DataSourceChanged += new EventHandler (OnDataSourceChanged);
+			
+			base.OnLoad(e);
+		}
+
+		[MonoTODO]
+		protected override void OnPagePreLoad (object sender, EventArgs e)
+		{
+			base.OnPagePreLoad (sender, e);
+		}
+		
+		protected internal virtual void PerformDataBinding ()
+		{
+			OnDataBinding (EventArgs.Empty);
+		}
+		
+		protected override void PerformSelect ()
+		{
+			PerformDataBinding ();
+		}
+		
+		protected override void ValidateDataSource (object dataSource)
+		{
+			if (dataSource is IHierarchicalDataSource || dataSource is IHierarchicalEnumerable)
+				return;
+			throw new InvalidOperationException ("Invalid data source");
+		}
 	}
 }
 #endif

+ 2 - 3
mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs

@@ -343,10 +343,9 @@ namespace System.Web.UI.WebControls
 		}
 
 		#if NET_2_0
-		protected override void PerformDataBinding ()
+		protected override void PerformDataBinding (IEnumerable ds)
 		{
-			base.PerformDataBinding ();
-			IEnumerable ds = GetResolvedDataSource ();
+			base.PerformDataBinding (ds);
 		#else
 		protected override void OnDataBinding(EventArgs e)
 		{

+ 189 - 14
mcs/class/System.Web/System.Web.UI.WebControls/TreeNode.cs

@@ -31,6 +31,8 @@
 #if NET_2_0
 
 using System;
+using System.Collections;
+using System.Text;
 using System.ComponentModel;
 using System.Web.UI;
 
@@ -45,6 +47,13 @@ namespace System.Web.UI.WebControls
 		TreeView tree;
 		TreeNode parent;
 		int index;
+		string path;
+		int depth = -1;
+		
+		IHierarchyData hierarchyData;
+		bool gotBinding;
+		TreeNodeBinding binding;
+		PropertyDescriptorCollection boundProperties;
 		
 		public TreeNode ()
 		{
@@ -77,6 +86,26 @@ namespace System.Web.UI.WebControls
 			Target = target;
 		}
 		
+		public int Depth {
+			get {
+				if (depth != -1) return depth;
+				depth = 0;
+				TreeNode nod = parent;
+				while (nod != null) {
+					depth++;
+					nod = nod.parent;
+				}
+				return depth;
+			}
+		}
+		
+		void ResetPathData ()
+		{
+			path = null;
+			depth = -1;
+			gotBinding = false;
+		}
+		
 		internal TreeView Tree {
 			get { return tree; }
 			set {
@@ -89,6 +118,25 @@ namespace System.Web.UI.WebControls
 				tree = value;
 				if (nodes != null)
 					nodes.SetTree (tree);
+				ResetPathData ();
+			}
+		}
+		
+		public bool DataBound {
+			get { return hierarchyData != null; }
+		}
+		
+		public object DataItem {
+			get {
+				if (hierarchyData == null) throw new InvalidOperationException ("TreeNode is not data bound.");
+				return hierarchyData.Item;
+			}
+		}
+		
+		public string DataPath {
+			get {
+				if (hierarchyData == null) throw new InvalidOperationException ("TreeNode is not data bound.");
+				return hierarchyData.Path;
 			}
 		}
 		
@@ -100,6 +148,8 @@ namespace System.Web.UI.WebControls
 			}
 			set {
 				ViewState ["Checked"] = value;
+				if (tree != null)
+					tree.NotifyCheckChanged (this);
 			}
 		}
 
@@ -110,7 +160,11 @@ namespace System.Web.UI.WebControls
 		public virtual TreeNodeCollection ChildNodes {
 			get {
 				if (nodes == null) {
-					nodes = new TreeNodeCollection (this);
+					if (DataBound)
+						FillBoundChildren ();
+					else
+						nodes = new TreeNodeCollection (this);
+						
 					if (IsTrackingViewState)
 						((IStateManager)nodes).TrackViewState();
 				}
@@ -126,6 +180,8 @@ namespace System.Web.UI.WebControls
 			}
 			set {
 				ViewState ["Expanded"] = value;
+				if (tree != null)
+					tree.NotifyExpandedChanged (this);
 			}
 		}
 
@@ -133,13 +189,21 @@ namespace System.Web.UI.WebControls
 			get {
 				object o = ViewState ["ImageToolTip"];
 				if (o != null) return (string)o;
+				if (DataBound) {
+					TreeNodeBinding bin = GetBinding ();
+					if (bin != null) {
+						if (bin.ImageToolTipField != "")
+							return (string) GetBoundPropertyValue (bin.ImageToolTipField);
+						return bin.ImageToolTip;
+					}
+				}
 				return "";
 			}
 			set {
 				ViewState ["ImageToolTip"] = value;
 			}
 		}
-
+		
 		public virtual string ImageUrl {
 			get {
 				object o = ViewState ["ImageUrl"];
@@ -213,6 +277,16 @@ namespace System.Web.UI.WebControls
 			get {
 				object o = ViewState ["Text"];
 				if(o != null) return (string)o;
+				if (DataBound) {
+					TreeNodeBinding bin = GetBinding ();
+					if (bin != null) {
+						if (bin.TextField != "")
+							return (string) GetBoundPropertyValue (bin.TextField);
+						if (bin.Text != "")
+							return bin.Text;
+					}
+					return hierarchyData.ToString ();
+				}
 				return "";
 			}
 			set {
@@ -235,6 +309,16 @@ namespace System.Web.UI.WebControls
 			get {
 				object o = ViewState ["Value"];
 				if(o != null) return (string)o;
+				if (DataBound) {
+					TreeNodeBinding bin = GetBinding ();
+					if (bin != null) {
+						if (bin.ValueField != "")
+							return (string) GetBoundPropertyValue (bin.ValueField);
+						if (bin.Value != "")
+							return bin.Value;
+					}
+					return hierarchyData.ToString ();
+				}
 				return "";
 			}
 			set {
@@ -269,20 +353,53 @@ namespace System.Web.UI.WebControls
 			}
 		}
 		
-		internal int Index {
-			get { return index; }
-			set { index = value; }
+		public TreeNode Parent {
+			get { return parent; }
 		}
 		
+		public string ValuePath {
+			get {
+				if (tree == null) return Value;
+				
+				StringBuilder sb = new StringBuilder (Value);
+				TreeNode node = parent;
+				while (node != null) {
+					sb.Insert (0, tree.PathSeparator);
+					sb.Insert (0, node.Value);
+					node = node.Parent;
+				}
+				return sb.ToString ();
+			}
+		}
 		
-		public TreeNode Parent {
-			get { return parent; }
+		internal int Index {
+			get { return index; }
+			set { index = value; ResetPathData (); }
 		}
 		
 		internal void SetParent (TreeNode node) {
 			parent = node;
+			ResetPathData ();
 		}
 		
+		internal string Path {
+			get {
+				if (path != null) return path;
+				StringBuilder sb = new StringBuilder (index.ToString());
+				TreeNode node = parent;
+				while (node != null) {
+					sb.Insert (0, '_');
+					sb.Insert (0, node.Index.ToString ());
+					node = node.Parent;
+				}
+				path = sb.ToString ();
+				return path;
+			}
+		}
+		
+		internal bool HasChildData {
+			get { return nodes != null; }
+		}
 		
 		public void Collapse ()
 		{
@@ -299,7 +416,7 @@ namespace System.Web.UI.WebControls
 			Expanded = true;
 		}
 
-		public void Expand (int depth)
+		internal void Expand (int depth)
 		{
 			SetExpandedRec (true, depth);
 		}
@@ -314,10 +431,8 @@ namespace System.Web.UI.WebControls
 			Expanded = expanded;
 			if (depth == 0) return;
 			
-			if (nodes != null) {
-				foreach (TreeNode nod in nodes)
-					nod.SetExpandedRec (expanded, depth - 1);
-			}
+			foreach (TreeNode nod in ChildNodes)
+				nod.SetExpandedRec (expanded, depth - 1);
 		}
 		
 		public void Select ()
@@ -373,11 +488,71 @@ namespace System.Web.UI.WebControls
 		
 		public object Clone ()
 		{
-			object o = SaveViewState ();
 			TreeNode nod = new TreeNode ();
-			nod.LoadViewState (o);
+			foreach (DictionaryEntry e in ViewState)
+				nod.ViewState [(string)e.Key] = e.Value;
+				
+			foreach (TreeNode c in ChildNodes)
+				nod.ChildNodes.Add ((TreeNode)c.Clone ());
+				
 			return nod;
 		}
+		
+		internal void Bind (IHierarchyData hierarchyData)
+		{
+			this.hierarchyData = hierarchyData;
+		}
+		
+		internal bool IsParentNode {
+			get { return ChildNodes.Count > 0 && Parent != null; }
+		}
+		
+		internal bool IsLeafNode {
+			get { return ChildNodes.Count == 0; }
+		}
+		
+		internal bool IsRootNode {
+			get { return ChildNodes.Count > 0 && Parent == null; }
+		}
+		
+		TreeNodeBinding GetBinding ()
+		{
+			if (tree == null) return null;
+			if (gotBinding) return binding;
+			binding = tree.FindBindingForNode (hierarchyData.Type, Depth);
+			gotBinding = true;
+			return binding;
+		}
+		
+		object GetBoundPropertyValue (string name)
+		{
+			if (boundProperties == null) {
+				ICustomTypeDescriptor desc = hierarchyData as ICustomTypeDescriptor;
+				if (desc == null)
+					throw new InvalidOperationException ("Property '" + name + "' not found in data bound item");
+				boundProperties = desc.GetProperties ();
+			}
+			
+			PropertyDescriptor prop = boundProperties.Find (name, true);
+			if (prop == null)
+				throw new InvalidOperationException ("Property '" + name + "' not found in data bound item");
+			return prop.GetValue (hierarchyData);
+		}
+
+		void FillBoundChildren ()
+		{
+			nodes = new TreeNodeCollection (this);
+			if (!hierarchyData.HasChildren) return;
+			if (tree.MaxDataBindDepth != -1 && Depth >= tree.MaxDataBindDepth) return;
+
+			IHierarchicalEnumerable e = hierarchyData.GetChildren ();
+			foreach (object obj in e) {
+				IHierarchyData hdata = e.GetHierarchyData (obj);
+				TreeNode node = new TreeNode ();
+				node.Bind (hdata);
+				nodes.Add (node);
+			}
+		}
 	}
 }
 

+ 225 - 11
mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBinding.cs

@@ -31,33 +31,245 @@
 #if NET_2_0
 
 using System;
+using System.Collections;
 using System.Web.UI;
+using System.ComponentModel;
 
 namespace System.Web.UI.WebControls
 {
 	public sealed class TreeNodeBinding: IStateManager, ICloneable, IDataSourceViewSchemaAccessor
 	{
-		[MonoTODO]
-		void IStateManager.LoadViewState (object state)
+		StateBag ViewState = new StateBag ();
+		
+		public string DataMember {
+			get {
+				object o = ViewState ["DataMember"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["DataMember"] = value;
+			}
+		}
+
+		public int Depth {
+			get {
+				object o = ViewState ["Depth"];
+				if (o != null) return (int) o;
+				return -1;
+			}
+			set {
+				ViewState ["Depth"] = value;
+			}
+		}
+
+		public string FormatString {
+			get {
+				object o = ViewState ["FormatString"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["FormatString"] = value;
+			}
+		}
+
+		public string ImageToolTip {
+			get {
+				object o = ViewState ["ImageToolTip"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["ImageToolTip"] = value;
+			}
+		}
+
+		public string ImageToolTipField {
+			get {
+				object o = ViewState ["ImageToolTipField"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["ImageToolTipField"] = value;
+			}
+		}
+
+		public string ImageUrl {
+			get {
+				object o = ViewState ["ImageUrl"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["ImageUrl"] = value;
+			}
+		}
+
+		public string ImageUrlField {
+			get {
+				object o = ViewState ["ImageUrlField"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["ImageUrlField"] = value;
+			}
+		}
+
+		public string NavigateUrl {
+			get {
+				object o = ViewState ["NavigateUrl"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["NavigateUrl"] = value;
+			}
+		}
+
+		public string NavigateUrlField {
+			get {
+				object o = ViewState ["NavigateUrlField"];
+				if (o != null) return (string) o;
+				return "";
+			}
+			set {
+				ViewState ["NavigateUrlField"] = value;
+			}
+		}
+
+		public bool PopulateOnDemand {
+			get {
+				object o = ViewState ["PopulateOnDemand"];
+				if (o != null) return (bool) o;
+				return false;
+			}
+			set {
+				ViewState ["PopulateOnDemand"] = value;
+			}
+		}
+
+		public TreeNodeSelectAction SelectAction {
+			get {
+				object o = ViewState ["SelectAction"];
+				if (o != null) return (TreeNodeSelectAction)o;
+				return TreeNodeSelectAction.Select;
+			}
+			set {
+				ViewState ["SelectAction"] = value;
+			}
+		}
+
+		public bool ShowCheckBox {
+			get {
+				object o = ViewState ["ShowCheckBox"];
+				if (o != null) return (bool)o;
+				return false;
+			}
+			set {
+				ViewState ["ShowCheckBox"] = value;
+			}
+		}
+
+		public string Target {
+			get {
+				object o = ViewState ["Target"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["Target"] = value;
+			}
+		}
+
+		[Localizable (true)]
+		[DefaultValue ("")]
+		[WebSysDescription ("The display text of the tree node.")]
+		public string Text {
+			get {
+				object o = ViewState ["Text"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["Text"] = value;
+			}
+		}
+
+		public string TextField {
+			get {
+				object o = ViewState ["TextField"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["TextField"] = value;
+			}
+		}
+
+		public string ToolTip {
+			get {
+				object o = ViewState ["ToolTip"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["ToolTip"] = value;
+			}
+		}
+
+		public string ToolTipField {
+			get {
+				object o = ViewState ["ToolTipField"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["ToolTipField"] = value;
+			}
+		}
+
+		public string Value {
+			get {
+				object o = ViewState ["Value"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["Value"] = value;
+			}
+		}
+
+		public string ValueField {
+			get {
+				object o = ViewState ["ValueField"];
+				if(o != null) return (string)o;
+				return "";
+			}
+			set {
+				ViewState ["ValueField"] = value;
+			}
+		}
+
+		void IStateManager.LoadViewState (object savedState)
 		{
-			throw new NotImplementedException ();
+			ViewState.LoadViewState (savedState);
 		}
 		
-		[MonoTODO]
 		object IStateManager.SaveViewState ()
 		{
-			throw new NotImplementedException ();
+			return ViewState.SaveViewState();
 		}
 		
-		[MonoTODO]
 		void IStateManager.TrackViewState ()
 		{
-			throw new NotImplementedException ();
+			ViewState.TrackViewState ();
 		}
 		
-		[MonoTODO]
 		bool IStateManager.IsTrackingViewState {
-			get { throw new NotImplementedException (); }
+			get { return ViewState.IsTrackingViewState; }
 		}
 		
 		[MonoTODO]
@@ -66,10 +278,12 @@ namespace System.Web.UI.WebControls
 			set { throw new NotImplementedException (); }
 		}
 		
-		[MonoTODO]
 		object ICloneable.Clone ()
 		{
-			throw new NotImplementedException ();
+			TreeNodeBinding bin = new TreeNodeBinding ();
+			foreach (DictionaryEntry e in ViewState)
+				bin.ViewState [(string)e.Key] = e.Value;
+			return bin;
 		}
 	}
 }

+ 53 - 3
mcs/class/System.Web/System.Web.UI.WebControls/TreeNodeBindingCollection.cs

@@ -31,22 +31,72 @@
 #if NET_2_0
 
 using System;
+using System.Collections;
 using System.Web.UI;
 
 namespace System.Web.UI.WebControls
 {
 	public sealed class TreeNodeBindingCollection: StateManagedCollection
 	{
-		[MonoTODO]
+		static Type[] types = new Type[] { typeof (TreeNodeBinding) };
+		
+		internal TreeNodeBindingCollection ()
+		{
+		}
+		
+		public int Add (TreeNodeBinding binding)
+		{
+			return ((IList)this).Add (binding);
+		}
+		
+		public bool Contains (TreeNodeBinding binding)
+		{
+			return ((IList)this).Contains (binding);
+		}
+		
+		public void CopyTo (TreeNodeBinding[] array, int index)
+		{
+			((IList)this).CopyTo (array, index);
+		}
+		
 		protected override object CreateKnownType (int index)
 		{
-			throw new NotImplementedException ();
+			return new TreeNodeBinding ();
+		}
+		
+		protected override Type[] GetKnownTypes ()
+		{
+			return types;
+		}
+		
+		public int IndexOf (TreeNodeBinding binding)
+		{
+			return ((IList)this).IndexOf (binding);
+		}
+		
+		public void Insert (int index, TreeNodeBinding binding)
+		{
+			((IList)this).Insert (index, binding);
+		}
+		
+		public void Remove (TreeNodeBinding binding)
+		{
+			((IList)this).Remove (binding);
+		}
+		
+		public void RemoveAt (int index)
+		{
+			((IList)this).RemoveAt (index);
+		}
+		
+		public TreeNodeBinding this [int i] {
+			get { return (TreeNodeBinding) ((IList)this) [i]; }
+			set { ((IList)this) [i] = value; }
 		}
 		
 		[MonoTODO]
 		protected override void SetDirtyObject (object o)
 		{
-			throw new NotImplementedException ();
 		}
 	}
 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 568 - 93
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.cs


+ 30 - 0
mcs/class/System.Web/System.Web.UI.WebControls/TreeView.js

@@ -0,0 +1,30 @@
+
+function TreeView_ToggleExpand (treeId, nodeId) {
+	var node = document.getElementById (treeId + "_" + nodeId);
+	var expand = node.style.display == "none";
+	node.style.display = expand ? "block" : "none";
+	
+	var inputStates = document.forms[0][treeId + "_ExpandStates"];
+	var states = inputStates.value;
+	var i = states.indexOf ("|" + nodeId + "|");
+	if (node.style.display == "none") states = states.replace ("|" + nodeId + "|", "|");
+	else states = states + nodeId + "|";
+	inputStates.value = states;
+	
+	var tree = eval (treeId + "_data");
+	if (tree.showImage) {
+		var image = document.getElementById (treeId + "_img_" + nodeId);
+		if (tree.defaultImages) {
+			if (expand)
+				image.src = image.src.replace ("plus","minus");
+			else
+				image.src = image.src.replace ("minus","plus");
+		} else {
+			if (expand)
+				image.src = tree.collapseImage;
+			else
+				image.src = tree.expandImage;
+		}
+	}
+}
+

BIN
mcs/class/System.Web/System.Web.UI.WebControls/TreeView_Default_Collapse.gif


BIN
mcs/class/System.Web/System.Web.UI.WebControls/TreeView_Default_Expand.gif


BIN
mcs/class/System.Web/System.Web.UI.WebControls/TreeView_Default_NoExpand.gif


+ 13 - 0
mcs/class/System.Web/System.Web.UI.WebControls/XmlDataSource.cs

@@ -38,6 +38,13 @@ using System.ComponentModel;
 using System.IO;
 
 namespace System.Web.UI.WebControls {
+
+	[DefaultProperty ("DataFile")]
+	[DefaultEvent ("Transforming")]
+	[ParseChildren (true)]
+	[PersistChildren (false)]
+	[WebSysDescription ("Connect to an XML file.")]
+//	[WebSysDisplayName ("XML file")]
 	public class XmlDataSource : HierarchicalDataSourceControl, IDataSource, IListSource {
 
 		
@@ -170,6 +177,12 @@ namespace System.Web.UI.WebControls {
 		//public virtual DataSourceCacheExpiry CacheExpirationPolicy { get; set; }
 		//public virtual string CacheKeyDependency { get; set; }
 		//public virtual bool EnableCaching { get; set; }
+		
+		[DefaultValue ("")]
+		[PersistenceMode (PersistenceMode.InnerProperty)]
+		[WebSysDescription ("Inline XML data.")]
+		[WebCategory ("Data")]
+//		[TypeConverter (typeof(MultilineStringConverter))]
 		public virtual string Data {
 			get {
 				string ret = ViewState ["Data"] as string;

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchicalEnumerable.cs

@@ -35,7 +35,7 @@ using System.Text;
 using System.Xml;
 
 namespace System.Web.UI.WebControls {
-	public class XmlHierarchicalEnumerable : IHierarchicalEnumerable {
+	internal class XmlHierarchicalEnumerable : IHierarchicalEnumerable {
 		internal XmlHierarchicalEnumerable (XmlNodeList nodeList)
 		{
 			this.nodeList = nodeList;

+ 1 - 1
mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs

@@ -37,7 +37,7 @@ using System.ComponentModel;
 using AC = System.ComponentModel.AttributeCollection;
 
 namespace System.Web.UI.WebControls {
-	public class XmlHierarchyData : IHierarchyData, ICustomTypeDescriptor {
+	internal class XmlHierarchyData : IHierarchyData, ICustomTypeDescriptor {
 		internal XmlHierarchyData (XmlNode item)
 		{
 			this.item = item;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.