In System.Web.Configuration.Internal:
[mono.git] / mcs / class / System.Web / System.Web.UI / DataSourceControl.cs
1 //
2 // System.Web.UI.DataSourceControl
3 //
4 // Authors:
5 //      Ben Maurer (bmaurer@users.sourceforge.net)
6 //
7 // (C) 2003 Ben Maurer
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 #if NET_2_0
32 using System.Collections;
33 using System.Collections.Specialized;
34 using System.ComponentModel;
35 using System.Text;
36
37 namespace System.Web.UI {
38
39         [DesignerAttribute ("System.Web.UI.Design.DataSourceDesigner, " + Consts.AssemblySystem_Design,
40                             "System.ComponentModel.Design.IDesigner")]
41         [ControlBuilderAttribute (typeof (DataSourceControlBuilder))]
42         [NonVisualControlAttribute]
43         [BindableAttribute (false)]
44         public abstract class DataSourceControl : Control, IDataSource, System.ComponentModel.IListSource {
45
46
47                 protected DataSourceControl()
48                 {
49                 }
50                 
51                 [MonoTODO]
52                 [EditorBrowsable (EditorBrowsableState.Never)]
53                 public override void ApplyStyleSheetSkin (Page page)
54                 {
55                         throw new NotImplementedException ();
56                 }
57
58                 protected override ControlCollection CreateControlCollection ()
59                 {
60                         return new EmptyControlCollection (this);
61                 }
62
63                 [MonoTODO ("why override?")]
64                 [EditorBrowsable (EditorBrowsableState.Never)]
65                 public override Control FindControl (string id)
66                 {
67                         return base.FindControl (id);
68                 }
69
70                 [MonoTODO ("why override?")]
71                 [EditorBrowsable (EditorBrowsableState.Never)]
72                 public override void Focus ()
73                 {
74                         base.Focus();
75                 }
76
77                 protected abstract DataSourceView GetView (string viewName);
78                 
79                 DataSourceView IDataSource.GetView (string viewName)
80                 {
81                         return GetView (viewName);
82                 }
83                 
84                 protected virtual ICollection GetViewNames ()
85                 {
86                         return null;
87                 }
88                 
89                 ICollection IDataSource.GetViewNames ()
90                 {
91                         return GetViewNames ();
92                 }
93
94                 IList System.ComponentModel.IListSource.GetList ()
95                 {
96                         return ListSourceHelper.GetList (this);
97                 }
98                 
99                 [MonoTODO ("why override?")]
100                 [EditorBrowsable (EditorBrowsableState.Never)]
101                 public override bool HasControls ()
102                 {
103                         return base.HasControls ();
104                 }
105
106                 protected virtual void RaiseDataSourceChangedEvent (EventArgs e)
107                 {
108                         EventHandler eh = Events [dataSourceChanged] as EventHandler;
109                         if (eh != null)
110                                 eh (this, e);
111                 }
112
113                 [MonoTODO ("why override?")]
114                 [EditorBrowsable (EditorBrowsableState.Never)]
115                 public override void RenderControl (HtmlTextWriter tw)
116                 {
117                         base.RenderControl (tw);
118                 }
119
120                 [MonoTODO ("why override?")]
121                 [EditorBrowsable (EditorBrowsableState.Never)]
122                 public override string ClientID {
123                         get { return base.ClientID; }
124                 }
125
126                 [MonoTODO ("why override?")]
127                 [EditorBrowsable (EditorBrowsableState.Never)]
128                 public override ControlCollection Controls {
129                         get { return base.Controls; }
130                 }
131
132                 [MonoTODO ("why override?")]
133                 [DefaultValue (false)]
134                 [Browsable (false)]
135                 [EditorBrowsable (EditorBrowsableState.Never)]
136                 public override bool EnableTheming {
137                         get { return base.EnableTheming; }
138                         set { base.EnableTheming = value; }
139                 }
140
141                 [MonoTODO ("why override?")]
142                 [DefaultValue ("")]
143                 [Browsable (false)]
144                 [EditorBrowsable (EditorBrowsableState.Never)]
145                 public override string SkinID {
146                         get { return base.SkinID; }
147                         set { base.SkinID = value; }
148                 }
149
150                 bool System.ComponentModel.IListSource.ContainsListCollection {
151                         get { return ListSourceHelper.ContainsListCollection (this); }
152                 }
153
154                 [Browsable (false)]
155                 [EditorBrowsable (EditorBrowsableState.Never)]
156                 [DefaultValue (false)]
157                 public override bool Visible { 
158                         get { return false; }
159                         set { throw new NotSupportedException (); }
160                 }
161
162                 static object dataSourceChanged = new object ();
163                 event EventHandler System.Web.UI.IDataSource.DataSourceChanged {
164                         add { Events.AddHandler (dataSourceChanged, value); }
165                         remove { Events.RemoveHandler (dataSourceChanged, value); }
166                 }
167
168         }
169 }
170 #endif
171