DependTree/Window.js
[app.Builder.js] / DependTree / Window.js
1 Gtk = imports.gi.Gtk;
2 Gdk = imports.gi.Gdk;
3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
5 Gio = imports.gi.Gio;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
9 Vte = imports.gi.Vte;
10 GtkClutter = imports.gi.GtkClutter;
11 Gdl = imports.gi.Gdl;
12 console = imports.console;
13 XObject = imports.XObject.XObject;
14 Window=new XObject({
15     xtype: Gtk.Window,
16     listeners : {
17         show : function (self) {
18             print("SHOW");
19             var BuildLists = imports['BuildLists.js'].BuildLists;
20             this.data = new BuildLists();
21             print(JSON.stringify(this.data.allmethods, null,4));
22             
23             var ls = this.get('method-list-store');
24             this.data.allmethods.forEach(function(v) {
25                 ls.append( [ v ]);
26             });
27             var ls = this.get('children-list-store');
28             this.data.allchildren.forEach(function(v) {
29                 ls.append( [ v ]);
30             });
31             var ls = this.get('class-list-store');
32             var i =0;
33             for (var c in this.data.methods) {
34                 i++;
35                 ls.append( [ c , true , i > 10 ? true : false]);
36             };
37             
38             
39             
40         }
41     },
42     default_height : 500,
43     default_width : 600,
44     init : function() {
45         XObject.prototype.init.call(this);
46         this.el.show_all();
47     },
48     items : [
49         {
50             xtype: Gtk.VBox,
51             items : [
52                 {
53                     xtype: Gtk.HBox,
54                     pack : "pack_start,false,false",
55                     items : [
56                         {
57                             xtype: Gtk.Button,
58                             label : "Reset"
59                         }
60                     ]
61                 },
62                 {
63                     xtype: Gtk.HBox,
64                     items : [
65                         {
66                             xtype: Gtk.ScrolledWindow,
67                             items : [
68                                 {
69                                     xtype: Gtk.TreeView,
70                                     items : [
71                                         {
72                                             xtype: Gtk.TreeModelFilter,
73                                             init : function() {
74                                                 this.items[0].pack = false;
75                                                 this.items[0].init();
76                                                 this.list = this.items[0];
77                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
78                                                  this.el.set_visible_column(2);
79                                                 XObject.prototype.init.call(this);
80                                                
81                                             },
82                                             items : [
83                                                 {
84                                                     xtype: Gtk.ListStore,
85                                                     id : "class-list-store",
86                                                     pack : false,
87                                                     init : function() 
88                                                             {
89                                                                 XObject.prototype.init.call(this);
90                                                                 this.el.set_column_types ( 6, [
91                                                                     GObject.TYPE_STRING, 
92                                                                     GObject.TYPE_BOOLEAN, 
93                                                                     GObject.TYPE_BOOLEAN, 
94                                                                     GObject.TYPE_STRING, 
95                                                                     GObject.TYPE_STRING, 
96                                                                     GObject.TYPE_STRING 
97                                                                 ] );
98                                                                 
99                                                             }
100                                                 }
101                                             ]
102                                         },
103                                         {
104                                             xtype: Gtk.TreeViewColumn,
105                                             title : "Class",
106                                             expand : true,
107                                             items : [
108                                                 {
109                                                     xtype: Gtk.CellRendererText
110                                                 }
111                                             ]
112                                         },
113                                         {
114                                             xtype: Gtk.TreeViewColumn,
115                                             title : "Active",
116                                             items : [
117                                                 {
118                                                     xtype: Gtk.CellRendererToggle,
119                                                     listeners : {
120                                                         toggled : function (self, path) {
121                                                             print("TOGGLE");
122                                                             // this.list
123                                                         
124                                                         
125                                                              
126                                                             var old = this.list.getValue(path, 1);
127                                                            // print(JSON.stringify(old));
128                                                             this.list.setValue(path, 1, old ? false : true)
129                                                             
130                                                             
131                                                             
132                                                             
133                                                         }
134                                                     },
135                                                     activatable : true
136                                                 }
137                                             ]
138                                         }
139                                     ]
140                                 }
141                             ]
142                         },
143                         {
144                             xtype: Gtk.ScrolledWindow,
145                             items : [
146                                 {
147                                     xtype: Gtk.TreeView,
148                                     items : [
149                                         {
150                                             xtype: Gtk.TreeModelFilter,
151                                             init : function() {
152                                                 this.items[0].pack = false;
153                                                 this.items[0].init();
154                                                 this.list = this.items[0];
155                                                 this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
156                                                  this.el.set_visible_column(2);
157                                                 XObject.prototype.init.call(this);
158                                                
159                                             },
160                                             items : [
161                                                 {
162                                                     xtype: Gtk.ListStore,
163                                                     id : "method-list-store",
164                                                     init : function() 
165                                                             {
166                                                                 XObject.prototype.init.call(this);
167                                                                 this.el.set_column_types ( 6, [
168                                                                     GObject.TYPE_STRING, 
169                                                                     GObject.TYPE_BOOLEAN, 
170                                                                     GObject.TYPE_STRING, 
171                                                                     GObject.TYPE_STRING, 
172                                                                     GObject.TYPE_STRING, 
173                                                                     GObject.TYPE_STRING 
174                                                                 ] );
175                                                                 
176                                                             },
177                                                     pack : false
178                                                 }
179                                             ]
180                                         },
181                                         {
182                                             xtype: Gtk.TreeViewColumn,
183                                             title : "Methods",
184                                             expand : true,
185                                             items : [
186                                                 {
187                                                     xtype: Gtk.CellRendererText
188                                                 }
189                                             ]
190                                         },
191                                         {
192                                             xtype: Gtk.TreeViewColumn,
193                                             title : "Active",
194                                             items : [
195                                                 {
196                                                     xtype: Gtk.CellRendererToggle,
197                                                     listeners : {
198                                                         toggled : function (self, path) {
199                                                             print("TOGGLE");
200                                                             // this.list
201                                                         
202                                                         
203                                                              
204                                                             var old = this.list.getValue(path, 1);
205                                                            // print(JSON.stringify(old));
206                                                             this.list.setValue(path, 1, old ? false : true)
207                                                             
208                                                             
209                                                             
210                                                             
211                                                         }
212                                                     },
213                                                     activatable : true
214                                                 }
215                                             ]
216                                         }
217                                     ]
218                                 }
219                             ]
220                         },
221                         {
222                             xtype: Gtk.ScrolledWindow,
223                             items : [
224                                 {
225                                     xtype: Gtk.TreeView,
226                                     items : [
227                                         {
228                                             xtype: Gtk.ListStore,
229                                             id : "children-list-store",
230                                             init : function() 
231                                                     {
232                                                         XObject.prototype.init.call(this);
233                                                         this.el.set_column_types ( 6, [
234                                                             GObject.TYPE_STRING, 
235                                                             GObject.TYPE_BOOLEAN, 
236                                                             GObject.TYPE_STRING, 
237                                                             GObject.TYPE_STRING, 
238                                                             GObject.TYPE_STRING, 
239                                                             GObject.TYPE_STRING 
240                                                         ] );
241                                                         
242                                                     }
243                                         },
244                                         {
245                                             xtype: Gtk.TreeViewColumn,
246                                             title : "Child classes",
247                                             expand : true,
248                                             items : [
249                                                 {
250                                                     xtype: Gtk.CellRendererText
251                                                 }
252                                             ]
253                                         },
254                                         {
255                                             xtype: Gtk.TreeViewColumn,
256                                             title : "Active",
257                                             items : [
258                                                 {
259                                                     xtype: Gtk.CellRendererToggle,
260                                                     listeners : {
261                                                         toggled : function (self, path) {
262                                                             print("TOGGLE");
263                                                             // this.list
264                                                         
265                                                         
266                                                              
267                                                             var old = this.list.getValue(path, 1);
268                                                            // print(JSON.stringify(old));
269                                                             this.list.setValue(path, 1, old ? false : true)
270                                                             
271                                                             
272                                                             
273                                                             
274                                                         }
275                                                     },
276                                                     activatable : true
277                                                 }
278                                             ]
279                                         }
280                                     ]
281                                 }
282                             ]
283                         }
284                     ]
285                 }
286             ]
287         }
288     ]
289 });
290 Window.init();
291 XObject.cache['/Window'] = Window;