2004-03-31 Juraj Skripsky <juraj@hotfeet.ch>
[mono.git] / mcs / class / System.Data / System.Data / DataViewManager.cs
1 //
2 // System.Data.DataViewManager
3 //
4 // Author:
5 //   Rodrigo Moya (rodrigo@ximian.com)
6 //   Tim Coleman (tim@timcoleman.com)
7 //
8 // (C) Ximian, Inc. 2002
9 // Copyright (C) Tim Coleman, 2002
10 //
11
12 using System;
13 using System.Collections;
14 using System.ComponentModel;
15
16 namespace System.Data
17 {
18         /// <summary>
19         /// Contains a default DataViewSettingCollection for each DataTable in a DataSet.
20         /// </summary>
21         //[Designer]
22         public class DataViewManager : MarshalByValueComponent, IBindingList, ICollection, IList, ITypedList, IEnumerable
23         {
24                 #region Fields
25
26                 DataSet dataSet;
27                 DataViewManagerListItemTypeDescriptor descriptor;
28
29                 #endregion // Fields
30
31                 #region Constructors
32
33                 public DataViewManager () 
34                 {
35                         dataSet = null;
36                 }
37
38                 public DataViewManager (DataSet ds) 
39                 {
40                         dataSet = ds;
41                 }
42
43                 #endregion // Constructors
44
45                 #region Properties
46
47                 [DataSysDescription ("Indicates the source of data for this DataViewManager.")]
48                 [DefaultValue (null)]
49                 public DataSet DataSet {
50                         get { return dataSet; }
51                         set { dataSet = value; }
52                 }
53
54                 [MonoTODO]
55                 [DataSysDescription ("Indicates the sorting/filtering/state settings for any table in the corresponding DataSet.")]
56                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
57                 public string DataViewSettingCollectionString {
58                         get { throw new NotImplementedException (); }
59                         set { throw new NotImplementedException (); }
60                 }
61
62                 [MonoTODO]
63                 public DataViewSettingCollection DataViewSettings {
64                         get { throw new NotImplementedException (); }
65                 }
66
67                 int ICollection.Count {
68                         [MonoTODO]
69                         get { throw new NotImplementedException (); }
70                 }
71
72                 bool ICollection.IsSynchronized {
73                         [MonoTODO]
74                         get { throw new NotImplementedException (); }
75                 }
76
77                 object ICollection.SyncRoot {
78                         [MonoTODO]
79                         get { throw new NotImplementedException (); }
80                 }
81
82                 bool IList.IsFixedSize {
83                         get { return true; }
84                 }
85
86                 bool IList.IsReadOnly {
87                         get { return true; }
88                 }
89
90                 object IList.this [int index] {
91                         get { 
92                                 if (descriptor == null)
93                                         descriptor = new DataViewManagerListItemTypeDescriptor (this);
94
95                                 return descriptor;
96                         }
97
98                         set { throw new ArgumentException ("Not modifiable"); }
99                 }
100
101                 bool IBindingList.AllowEdit {
102                         [MonoTODO]
103                         get { throw new NotImplementedException (); }
104                 }
105
106                 bool IBindingList.AllowNew {
107                         [MonoTODO]
108                         get { throw new NotImplementedException (); }
109                 }
110
111                 bool IBindingList.AllowRemove {
112                         [MonoTODO]
113                         get { throw new NotImplementedException (); }
114                 }
115
116                 bool IBindingList.IsSorted {
117                         [MonoTODO]
118                         get { throw new NotImplementedException (); }
119                 }
120
121                 ListSortDirection IBindingList.SortDirection {
122                         [MonoTODO]
123                         get { throw new NotImplementedException (); }
124                 }
125
126                 PropertyDescriptor IBindingList.SortProperty {
127                         [MonoTODO]
128                         get { throw new NotImplementedException (); }
129                 }
130
131                 bool IBindingList.SupportsChangeNotification {
132                         [MonoTODO]
133                         get { throw new NotImplementedException (); }
134                 }
135
136                 bool IBindingList.SupportsSearching {
137                         [MonoTODO]
138                         get { throw new NotImplementedException (); }
139                 }
140
141                 bool IBindingList.SupportsSorting {
142                         [MonoTODO]
143                         get { throw new NotImplementedException (); }
144                 }
145
146                 #endregion // Properties
147
148                 #region Methods
149
150                 [MonoTODO]
151                 public DataView CreateDataView (DataTable table) 
152                 {
153                         return new DataView (table);
154                 }
155
156                 [MonoTODO]
157                 void IBindingList.AddIndex (PropertyDescriptor property)
158                 {
159                         throw new NotImplementedException ();
160                 }
161         
162                 [MonoTODO]
163                 object IBindingList.AddNew ()
164                 {
165                         throw new NotImplementedException ();
166                 }
167         
168                 [MonoTODO]
169                 void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction)
170                 {
171                         throw new NotImplementedException ();
172                 }
173         
174                 [MonoTODO]
175                 int IBindingList.Find (PropertyDescriptor property, object key)
176                 {
177                         throw new NotImplementedException ();
178                 }
179         
180                 [MonoTODO]
181                 void IBindingList.RemoveIndex (PropertyDescriptor property)
182                 {
183                         throw new NotImplementedException ();
184                 }
185         
186                 [MonoTODO]
187                 void IBindingList.RemoveSort ()
188                 {
189                         throw new NotImplementedException ();
190                 }
191         
192                 [MonoTODO]
193                 void ICollection.CopyTo (Array array, int index)
194                 {
195                         throw new NotImplementedException ();
196                 }
197         
198                 [MonoTODO]
199                 IEnumerator IEnumerable.GetEnumerator ()
200                 {
201                         throw new NotImplementedException ();
202                 }
203         
204                 [MonoTODO]
205                 int IList.Add (object value)
206                 {
207                         throw new NotImplementedException ();
208                 }
209         
210                 [MonoTODO]
211                 void IList.Clear ()
212                 {
213                         throw new NotImplementedException ();
214                 }
215         
216                 [MonoTODO]
217                 bool IList.Contains (object value)
218                 {
219                         throw new NotImplementedException ();
220                 }
221         
222                 [MonoTODO]
223                 int IList.IndexOf (object value)
224                 {
225                         throw new NotImplementedException ();
226                 }
227         
228                 [MonoTODO]
229                 void IList.Insert (int index, object value)
230                 {
231                         throw new NotImplementedException ();
232                 }
233         
234                 [MonoTODO]
235                 void IList.Remove (object value)
236                 {
237                         throw new NotImplementedException ();
238                 }
239         
240                 [MonoTODO]
241                 void IList.RemoveAt (int index)
242                 {
243                         throw new NotImplementedException ();
244                 }
245         
246                 PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors)
247                 {
248                         if (dataSet == null)
249                                 throw new DataException ("dataset is null");
250
251                         if (listAccessors == null || listAccessors.Length == 0) {
252                                 ICustomTypeDescriptor desc = new DataViewManagerListItemTypeDescriptor (this);
253                                 return desc.GetProperties ();
254                         }
255                                 
256                         throw new NotImplementedException ();
257                 }
258         
259                 [MonoTODO]
260                 string ITypedList.GetListName (PropertyDescriptor[] listAccessors)
261                 {
262                         throw new NotImplementedException ();
263                 }
264         
265                 protected virtual void OnListChanged (ListChangedEventArgs e) 
266                 {
267                         if (ListChanged != null)
268                                 ListChanged (this, e);
269                 }
270
271                 protected virtual void RelationCollectionChanged (object sender, CollectionChangeEventArgs e) 
272                 {
273                 }
274
275                 protected virtual void TableCollectionChanged (object sender, CollectionChangeEventArgs e) 
276                 {
277                 }
278
279                 #endregion // Methods
280
281                 #region Events
282
283                 public event ListChangedEventHandler ListChanged;
284
285                 #endregion // Events
286         }
287 }