2002-11-14 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / class / System.Data / System.Data / DataRowView.cs
1 //
2 // System.Data.DataRowView.cs
3 //
4 // Author:
5 //    Rodrigo Moya <rodrigo@ximian.com>
6 //    Miguel de Icaza <miguel@ximian.com>
7 //    Daniel Morgan <danmorg@sc.rr.com>
8 //
9 // (C) Ximian, Inc 2002
10 // (C) Daniel Morgan 2002
11 //
12
13 using System;
14 using System.Collections;
15 using System.ComponentModel;
16 using System.Reflection;
17
18 namespace System.Data
19 {
20         /// <summary>
21         /// Represents a customized view of a DataRow exposed as a fully featured Windows Forms control.
22         /// </summary>
23         //[DefaultMember("Item")]
24         [DefaultProperty("Item")]
25         public class DataRowView : ICustomTypeDescriptor, IEditableObject, IDataErrorInfo
26         {
27                 #region Fields
28
29                 private DataView dataView;
30                 private DataRow dataRow;
31
32                 #endregion // Fields
33
34                 #region Constructors
35
36                 internal DataRowView (DataView dataView, int rowIndex) {
37                         this.dataView = dataView;
38                         this.dataRow = dataView.Table.Rows[rowIndex];
39                 }
40
41                 #endregion // Constructors
42
43                 #region Methods
44
45                 [MonoTODO]
46                 public void BeginEdit ()
47                 {
48                         throw new NotImplementedException ();
49                 }
50
51                 [MonoTODO]
52                 public void CancelEdit ()
53                 {
54                         throw new NotImplementedException ();
55                 }
56
57                 [MonoTODO]
58                 public DataView CreateChildView (DataRelation relation)
59                 {
60                         throw new NotImplementedException ();
61                 }
62
63                 [MonoTODO]
64                 public DataView CreateChildView (string name)
65                 {
66                         throw new NotImplementedException ();
67                 }
68
69                 [MonoTODO]
70                 public void Delete ()
71                 {
72                         throw new NotImplementedException ();
73                 }
74
75                 [MonoTODO]
76                 public void EndEdit ()
77                 {
78                         throw new NotImplementedException ();
79                 }
80
81                 #endregion // Methods
82
83                 #region Properties
84                 
85                 public DataView DataView
86                 {
87                         [MonoTODO]
88                         get {
89                                 return dataView;
90                         }
91                 }
92
93                 public bool IsEdit {
94                         [MonoTODO]
95                         get {
96                                 throw new NotImplementedException ();
97                         }
98                 }
99
100                 public bool IsNew {
101                         [MonoTODO]
102                         get {
103                                 throw new NotImplementedException ();
104                         }
105                 }
106                 
107                 public object this[string column] {
108                         [MonoTODO]
109                         get {
110                                 DataColumn dc = dataView.Table.Columns[column];
111                                 return dataRow[dc];
112                         }
113                         [MonoTODO]
114                         set {
115                                 DataColumn dc = dataView.Table.Columns[column];
116                                 dataRow[dc] = value;
117                         }
118                 }
119
120                 public string Error {
121                         get {
122                                 throw new NotImplementedException ();
123                         }
124                 }
125
126                 public object this[int column] {
127                         [MonoTODO]
128                         get {
129                                 DataColumn dc = dataView.Table.Columns[column];
130                                 return dataRow[dc];
131                         }
132                         [MonoTODO]
133                         set {
134                                 DataColumn dc = dataView.Table.Columns[column];
135                                 dataRow[dc] = value;
136
137                         }
138                 }
139
140                 public DataRow Row {
141                         [MonoTODO]
142                         get {
143                                 return dataRow;
144                         }
145                 }
146
147                 public DataRowVersion RowVersion {
148                         [MonoTODO]
149                         get {
150                                 throw new NotImplementedException ();
151                         }
152                 }
153
154                 #endregion // Properties
155                 
156                 #region ICustomTypeDescriptor implementations
157                 
158                 [MonoTODO]
159                 AttributeCollection ICustomTypeDescriptor.GetAttributes  ()
160                 {
161                         System.ComponentModel.AttributeCollection attributes;\r
162                         attributes = AttributeCollection.Empty;\r
163                         return attributes;\r
164                         //object[] attributes = this.GetType ().GetCustomAttributes (true);
165                         //AttributeCollection attribCollection;
166                         //attribCollection = new AttributeCollection (attributes);
167                         //return attribCollection;
168                 }
169
170                 [MonoTODO]
171                 string ICustomTypeDescriptor.GetClassName ()
172                 {
173                         return "";
174                 }
175                 
176                 [MonoTODO]
177                 string ICustomTypeDescriptor.GetComponentName ()
178                 {
179                         return "";
180                 }
181
182                 [MonoTODO]
183                 TypeConverter ICustomTypeDescriptor.GetConverter ()
184                 {
185                         return null;
186                 }
187
188                 [MonoTODO]
189                 EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
190                 {
191                         throw new NotImplementedException ();
192                 }
193                 
194                 [MonoTODO]
195                 PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
196                 {
197                         return null;
198                 }
199                 
200                 [MonoTODO]
201                 object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
202                 {
203                         throw new NotImplementedException ();
204                 }
205                 
206                 [MonoTODO]
207                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
208                 {
209                         throw new NotImplementedException ();
210                 }
211
212                 [MonoTODO]
213                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attributes)
214                 {
215                         throw new NotImplementedException ();
216                 }
217
218                 [MonoTODO]
219                 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
220                 {
221                         ITypedList typedList = (ITypedList) dataView;
222                         return typedList.GetItemProperties(new PropertyDescriptor[0]);
223                 }
224
225                 [MonoTODO]
226                 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attributes)
227                 {
228                         PropertyDescriptorCollection descriptors;
229                         descriptors = ((ICustomTypeDescriptor) this).GetProperties ();
230                         // TODO: filter out any Attributes not in the attributes array
231                         return descriptors;
232                 }
233                 
234                 [MonoTODO]
235                 object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
236                 {
237                         throw new NotImplementedException ();
238                 }
239
240                 #endregion // ICustomTypeDescriptor implementations
241
242                 #region IDataErrorInfo implementation
243
244                 string IDataErrorInfo.Error {
245                         [MonoTODO]
246                         get {
247                                 throw new NotImplementedException();
248                         }
249                 }
250
251                 string IDataErrorInfo.this[string columnName] {
252                         [MonoTODO]
253                         get {
254                                 throw new NotImplementedException();
255                         }
256                 }
257
258                 #endregion // IDataErrorInfo implementation
259         }
260 }