Locale.cs removed
[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         public class DataRowView : ICustomTypeDescriptor, IEditableObject, IDataErrorInfo
24         {
25                 #region Fields
26
27                 DataView dataView;
28                 DataRow dataRow;
29                 DataRowVersion rowVersion = DataRowVersion.Default;
30
31                 // FIXME: what are the defaults?
32                 bool isEdit = false;
33                 bool isNew = false;
34
35                 #endregion // Fields
36
37                 #region Constructors
38
39                 internal DataRowView (DataView dataView, DataRow row) {
40                         this.dataView = dataView;
41                         this.dataRow = row;
42                 }
43
44                 #endregion // Constructors
45
46                 #region Methods
47
48                 [MonoTODO]
49                 public void BeginEdit ()
50                 {
51                         // FIXME:
52                 }
53
54                 [MonoTODO]
55                 public void CancelEdit ()
56                 {
57                         // FIXME:
58                 }
59
60                 [MonoTODO]
61                 public DataView CreateChildView (DataRelation relation)
62                 {
63                         throw new NotImplementedException ();
64                 }
65
66                 [MonoTODO]
67                 public DataView CreateChildView (string name)
68                 {
69                         throw new NotImplementedException ();
70                 }
71
72                 [MonoTODO]
73                 public void Delete ()
74                 {
75                         throw new NotImplementedException ();
76                 }
77
78                 [MonoTODO]
79                 public void EndEdit ()
80                 {
81                         // FIXME:
82                 }
83
84                 #endregion // Methods
85
86                 #region Properties
87                 
88                 public DataView DataView
89                 {
90                         [MonoTODO]
91                         get {
92                                 return dataView;
93                         }
94                 }
95
96                 public bool IsEdit {
97                         [MonoTODO]
98                         get {
99                                 return isEdit;
100                         }
101                 }
102
103                 public bool IsNew {
104                         [MonoTODO]
105                         get {
106                                 return isNew;
107                         }
108                 }
109                 
110                 [System.Runtime.CompilerServices.IndexerName("Item")]
111                 public object this[string column] {
112                         [MonoTODO]
113                         get {
114                                 DataColumn dc = dataView.Table.Columns[column];
115                                 return dataRow[dc];
116                         }
117                         [MonoTODO]
118                         set {
119                                 DataColumn dc = dataView.Table.Columns[column];
120                                 dataRow[dc] = value;
121                         }
122                 }
123
124                 public string Error {
125                         get {
126                                 return ""; // FIXME:
127                         }
128                 }
129                 
130                 // the compiler creates a DefaultMemeberAttribute from
131                 // this IndexerNameAttribute
132                 public object this[int column] {
133                         [MonoTODO]
134                         get {
135                                 DataColumn dc = dataView.Table.Columns[column];
136                                 return dataRow[dc];
137                         }
138                         [MonoTODO]
139                         set {
140                                 DataColumn dc = dataView.Table.Columns[column];
141                                 dataRow[dc] = value;
142
143                         }
144                 }
145
146                 public DataRow Row {
147                         [MonoTODO]
148                         get {
149                                 return dataRow;
150                         }
151                 }
152
153                 public DataRowVersion RowVersion {
154                         [MonoTODO]
155                         get {
156                                 return rowVersion;
157                         }
158                 }
159
160                 #endregion // Properties
161                 
162                 #region ICustomTypeDescriptor implementations
163                 
164                 [MonoTODO]
165                 AttributeCollection ICustomTypeDescriptor.GetAttributes  ()
166                 {
167                         System.ComponentModel.AttributeCollection attributes;\r
168                         attributes = AttributeCollection.Empty;\r
169                         return attributes;\r
170                 }
171
172                 [MonoTODO]
173                 string ICustomTypeDescriptor.GetClassName ()
174                 {
175                         return "";
176                 }
177                 
178                 [MonoTODO]
179                 string ICustomTypeDescriptor.GetComponentName ()
180                 {
181                         return null;
182                 }
183
184                 [MonoTODO]
185                 TypeConverter ICustomTypeDescriptor.GetConverter ()
186                 {
187                         return null;
188                 }
189
190                 [MonoTODO]
191                 EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
192                 {
193                         return null;
194                 }
195                 
196                 [MonoTODO]
197                 PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
198                 {
199                         return null;
200                 }
201                 
202                 [MonoTODO]
203                 object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
204                 {
205                         return null;
206                 }
207                 
208                 [MonoTODO]
209                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
210                 {
211                         return new EventDescriptorCollection(null);
212                 }
213
214                 [MonoTODO]
215                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attributes)
216                 {
217                         return new EventDescriptorCollection(null);
218                 }
219
220                 [MonoTODO]
221                 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
222                 {
223                         ITypedList typedList = (ITypedList) dataView;
224                         return typedList.GetItemProperties(new PropertyDescriptor[0]);
225                 }
226
227                 [MonoTODO]
228                 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attributes)
229                 {
230                         PropertyDescriptorCollection descriptors;
231                         descriptors = ((ICustomTypeDescriptor) this).GetProperties ();
232                         // TODO: filter out descriptors which do not contain
233                         //       any of those attributes
234                         //       except, those descriptors 
235                         //       that contain DefaultMemeberAttribute
236                         return descriptors;
237                 }
238                 
239                 [MonoTODO]
240                 object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
241                 {
242                         return this;
243                 }
244
245                 #endregion // ICustomTypeDescriptor implementations
246
247                 #region IDataErrorInfo implementation
248
249                 string IDataErrorInfo.Error {
250                         [MonoTODO]
251                         get {
252                                 return ""; // FIXME
253                         }
254                 }
255
256                 string IDataErrorInfo.this[string columnName] {
257                         [MonoTODO]
258                         get {
259                                 return ""; // FIXME
260                         }
261                 }
262
263                 #endregion // IDataErrorInfo implementation
264         }
265 }