2 // System.Web.UI.WebControls.TreeNodeBinding.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
34 using System.Collections;
36 using System.ComponentModel;
38 namespace System.Web.UI.WebControls
40 [DefaultProperty ("TextField")]
41 public sealed class TreeNodeBinding: IStateManager, ICloneable, IDataSourceViewSchemaAccessor
43 StateBag ViewState = new StateBag ();
46 public string DataMember {
48 object o = ViewState ["DataMember"];
49 if (o != null) return (string) o;
53 ViewState ["DataMember"] = value;
60 object o = ViewState ["Depth"];
61 if (o != null) return (int) o;
65 ViewState ["Depth"] = value;
72 public string FormatString {
74 object o = ViewState ["FormatString"];
75 if (o != null) return (string) o;
79 ViewState ["FormatString"] = value;
85 public string ImageToolTip {
87 object o = ViewState ["ImageToolTip"];
88 if (o != null) return (string) o;
92 ViewState ["ImageToolTip"] = value;
97 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
98 public string ImageToolTipField {
100 object o = ViewState ["ImageToolTipField"];
101 if (o != null) return (string) o;
105 ViewState ["ImageToolTipField"] = value;
111 [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
112 public string ImageUrl {
114 object o = ViewState ["ImageUrl"];
115 if (o != null) return (string) o;
119 ViewState ["ImageUrl"] = value;
124 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
125 public string ImageUrlField {
127 object o = ViewState ["ImageUrlField"];
128 if (o != null) return (string) o;
132 ViewState ["ImageUrlField"] = value;
138 [Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
139 public string NavigateUrl {
141 object o = ViewState ["NavigateUrl"];
142 if (o != null) return (string) o;
146 ViewState ["NavigateUrl"] = value;
151 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
152 public string NavigateUrlField {
154 object o = ViewState ["NavigateUrlField"];
155 if (o != null) return (string) o;
159 ViewState ["NavigateUrlField"] = value;
163 [DefaultValue (false)]
164 public bool PopulateOnDemand {
166 object o = ViewState ["PopulateOnDemand"];
167 if (o != null) return (bool) o;
171 ViewState ["PopulateOnDemand"] = value;
175 [DefaultValue (TreeNodeSelectAction.Select)]
176 public TreeNodeSelectAction SelectAction {
178 object o = ViewState ["SelectAction"];
179 if (o != null) return (TreeNodeSelectAction)o;
180 return TreeNodeSelectAction.Select;
183 ViewState ["SelectAction"] = value;
187 [DefaultValue (false)]
188 public bool ShowCheckBox {
190 object o = ViewState ["ShowCheckBox"];
191 if (o != null) return (bool)o;
195 ViewState ["ShowCheckBox"] = value;
200 public string Target {
202 object o = ViewState ["Target"];
203 if(o != null) return (string)o;
207 ViewState ["Target"] = value;
212 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
213 public string TargetField {
215 object o = ViewState ["TargetField"];
216 if (o != null) return (string) o;
220 ViewState ["TargetField"] = value;
226 [WebSysDescription ("The display text of the tree node.")]
229 object o = ViewState ["Text"];
230 if(o != null) return (string)o;
234 ViewState ["Text"] = value;
239 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
240 public string TextField {
242 object o = ViewState ["TextField"];
243 if(o != null) return (string)o;
247 ViewState ["TextField"] = value;
253 public string ToolTip {
255 object o = ViewState ["ToolTip"];
256 if(o != null) return (string)o;
260 ViewState ["ToolTip"] = value;
265 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
266 public string ToolTipField {
268 object o = ViewState ["ToolTipField"];
269 if(o != null) return (string)o;
273 ViewState ["ToolTipField"] = value;
279 public string Value {
281 object o = ViewState ["Value"];
282 if(o != null) return (string)o;
286 ViewState ["Value"] = value;
290 internal bool HasPropertyValue (string propName)
292 return ViewState [propName] != null;
296 [TypeConverter ("System.Web.UI.Design.DataSourceViewSchemaConverter, " + Consts.AssemblySystem_Design)]
297 public string ValueField {
299 object o = ViewState ["ValueField"];
300 if(o != null) return (string)o;
304 ViewState ["ValueField"] = value;
308 void IStateManager.LoadViewState (object savedState)
310 ViewState.LoadViewState (savedState);
313 object IStateManager.SaveViewState ()
315 return ViewState.SaveViewState();
318 void IStateManager.TrackViewState ()
320 ViewState.TrackViewState ();
323 bool IStateManager.IsTrackingViewState {
324 get { return ViewState.IsTrackingViewState; }
328 object IDataSourceViewSchemaAccessor.DataSourceViewSchema {
329 get { throw new NotImplementedException (); }
330 set { throw new NotImplementedException (); }
333 object ICloneable.Clone ()
335 TreeNodeBinding bin = new TreeNodeBinding ();
336 foreach (DictionaryEntry e in ViewState)
337 bin.ViewState [(string)e.Key] = e.Value;
341 internal void SetDirty ()
343 foreach (string key in ViewState.Keys)
344 ViewState.SetItemDirty (key, true);