* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Data / System.Data / DataViewManagerListItemTypeDescriptor.cs
1 //
2 // System.Data.DataViewManagerListItemTypeDscriptor
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //      Jackson Harper  (jackson@ximian.com)
7 //
8 // (C) 2002 Ximian, Inc (http://www.ximian.com)
9 // (C) 2005 Novell, Inc (http://www.novell.com)
10 //
11
12 //
13 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 //
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 // 
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 // 
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 //
34
35 using System;
36 using System.ComponentModel;
37
38 namespace System.Data
39 {
40         class DataViewManagerListItemTypeDescriptor : ICustomTypeDescriptor
41         {
42                 DataViewManager dvm;
43                 PropertyDescriptorCollection propsCollection;
44
45                 internal DataViewManagerListItemTypeDescriptor (DataViewManager dvm)
46                 {
47                         this.dvm = dvm;
48                 }
49
50                 internal DataViewManager DataViewManager {
51                         get { return dvm; }
52                 }
53
54                 AttributeCollection ICustomTypeDescriptor.GetAttributes ()
55                 {
56                         return new AttributeCollection (null);
57                 }
58
59                 string ICustomTypeDescriptor.GetClassName ()
60                 {
61                         return null;
62                 }
63
64                 string ICustomTypeDescriptor.GetComponentName ()
65                 {
66                         return null;
67                 }
68
69                 TypeConverter ICustomTypeDescriptor.GetConverter ()
70                 {
71                         return null;
72                 }
73
74                 EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
75                 {
76                         return null;
77                 }
78
79                 PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
80                 {
81                         return null;
82                 }
83
84                 object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
85                 {
86                         return null;
87                 }
88
89                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
90                 {
91                         return new EventDescriptorCollection (null);
92                 }
93
94                 EventDescriptorCollection ICustomTypeDescriptor.GetEvents (System.Attribute[] attributes)
95                 {
96                         return new EventDescriptorCollection (null);
97                 }
98
99                 public PropertyDescriptorCollection GetProperties ()
100                 {
101                         DataSet ds = dvm.DataSet;
102                         if (ds == null)
103                                 return null;
104
105                         DataTableCollection tables = ds.Tables;
106                         int index = 0;
107                         PropertyDescriptor [] descriptors  = new PropertyDescriptor [tables.Count];
108                         foreach (DataTable table in tables)
109                                 descriptors [index++] = new DataTablePropertyDescriptor (table);
110
111                         return new PropertyDescriptorCollection (descriptors);
112                 }
113
114                 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (System.Attribute[] attributes)
115                 {
116                         return this.GetProperties ();
117                 }
118
119                 object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
120                 {
121                         return this;
122                 }
123         }
124 }
125