DependTree/Window.js
[app.Builder.js] / DependTree / Window.js
index 05dd625..5d82e2a 100644 (file)
@@ -22,15 +22,17 @@ Window=new XObject({
             
             var ls = this.get('method-list-store');
             this.data.allmethods.forEach(function(v) {
-                ls.append( [ v ]);
+                ls.append( [ v , false, true ]);
             });
             var ls = this.get('children-list-store');
             this.data.allchildren.forEach(function(v) {
-                ls.append( [ v ]);
+                ls.append( [ v , false, true ]);
             });
             var ls = this.get('class-list-store');
+            var i =0;
             for (var c in this.data.methods) {
-                ls.append( [ c ]);
+                i++;
+                ls.append( [ c , true ,   true]);
             };
             
             
@@ -45,70 +47,267 @@ Window=new XObject({
     },
     items : [
         {
-            xtype: Gtk.HBox,
+            xtype: Gtk.VBox,
             items : [
                 {
-                    xtype: Gtk.ScrolledWindow,
+                    xtype: Gtk.HBox,
+                    pack : "pack_start,false,false",
                     items : [
                         {
-                            xtype: Gtk.TreeView,
+                            xtype: Gtk.Button,
+                            label : "Reset"
+                        }
+                    ]
+                },
+                {
+                    xtype: Gtk.HBox,
+                    items : [
+                        {
+                            xtype: Gtk.ScrolledWindow,
                             items : [
                                 {
-                                    xtype: Gtk.ListStore,
-                                    id : "class-list-store"
-                                },
-                                {
-                                    xtype: Gtk.TreeViewColumn,
-                                    title : "Class",
+                                    xtype: Gtk.TreeView,
+                                    listeners : {
+                                        cursor_changed : function (self) {
+                                            if (!this.selection) {
+                                                this.selection  = this.el.get_selection();
+                                            }
+                                            
+                                            var iter = new Gtk.TreeIter();
+                                            this.selection.get_selected(this.model.el, iter);
+                                            
+                                            var tp = this.model.el.get_path(iter).to_string();
+                                            print(tp);
+                                            // 
+                                            var cls = this.model.getValue(tp, 0);
+                                            print(cls);
+                                            
+                                        }
+                                    },
                                     items : [
                                         {
-                                            xtype: Gtk.CellRendererText
+                                            xtype: Gtk.TreeModelFilter,
+                                            init : function() {
+                                                this.items[0].pack = false;
+                                                this.items[0].init();
+                                                this.list = this.items[0];
+                                                this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
+                                                 this.el.set_visible_column(2);
+                                                XObject.prototype.init.call(this);
+                                                this.parent.model = this;
+                                               
+                                            },
+                                            items : [
+                                                {
+                                                    xtype: Gtk.ListStore,
+                                                    id : "class-list-store",
+                                                    pack : false,
+                                                    init : function() 
+                                                            {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.set_column_types ( 6, [
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING 
+                                                                ] );
+                                                                
+                                                            }
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Class",
+                                            expand : true,
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererText
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Active",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererToggle,
+                                                    listeners : {
+                                                        toggled : function (self, path) {
+                                                            print("TOGGLE");
+                                                            // this.list
+                                                        
+                                                        
+                                                             
+                                                            var old = this.list.getValue(path, 1);
+                                                           // print(JSON.stringify(old));
+                                                            this.list.setValue(path, 1, old ? false : true)
+                                                            
+                                                            
+                                                            
+                                                            
+                                                        }
+                                                    },
+                                                    activatable : true
+                                                }
+                                            ]
                                         }
                                     ]
                                 }
                             ]
-                        }
-                    ]
-                },
-                {
-                    xtype: Gtk.ScrolledWindow,
-                    items : [
+                        },
                         {
-                            xtype: Gtk.TreeView,
+                            xtype: Gtk.ScrolledWindow,
                             items : [
                                 {
-                                    xtype: Gtk.ListStore,
-                                    id : "method-list-store"
-                                },
-                                {
-                                    xtype: Gtk.TreeViewColumn,
-                                    title : "Child Classes",
+                                    xtype: Gtk.TreeView,
                                     items : [
                                         {
-                                            xtype: Gtk.CellRendererText
+                                            xtype: Gtk.TreeModelFilter,
+                                            init : function() {
+                                                this.items[0].pack = false;
+                                                this.items[0].init();
+                                                this.list = this.items[0];
+                                                this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
+                                                 this.el.set_visible_column(2);
+                                                XObject.prototype.init.call(this);
+                                               
+                                            },
+                                            items : [
+                                                {
+                                                    xtype: Gtk.ListStore,
+                                                    id : "method-list-store",
+                                                    init : function() 
+                                                            {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.set_column_types ( 6, [
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING 
+                                                                ] );
+                                                                
+                                                            }
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Methods",
+                                            expand : true,
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererText
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Active",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererToggle,
+                                                    listeners : {
+                                                        toggled : function (self, path) {
+                                                            print("TOGGLE");
+                                                            // this.list
+                                                        
+                                                        
+                                                             
+                                                            var old = this.list.getValue(path, 1);
+                                                           // print(JSON.stringify(old));
+                                                            this.list.setValue(path, 1, old ? false : true)
+                                                            
+                                                            
+                                                            
+                                                            
+                                                        }
+                                                    },
+                                                    activatable : true
+                                                }
+                                            ]
                                         }
                                     ]
                                 }
                             ]
-                        }
-                    ]
-                },
-                {
-                    xtype: Gtk.ScrolledWindow,
-                    items : [
+                        },
                         {
-                            xtype: Gtk.TreeView,
+                            xtype: Gtk.ScrolledWindow,
                             items : [
                                 {
-                                    xtype: Gtk.ListStore,
-                                    id : "children-list-store"
-                                },
-                                {
-                                    xtype: Gtk.TreeViewColumn,
-                                    title : "Methods",
+                                    xtype: Gtk.TreeView,
                                     items : [
                                         {
-                                            xtype: Gtk.CellRendererText
+                                            xtype: Gtk.TreeModelFilter,
+                                            init : function() {
+                                                this.items[0].pack = false;
+                                                this.items[0].init();
+                                                this.list = this.items[0];
+                                                this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
+                                                 this.el.set_visible_column(2);
+                                                XObject.prototype.init.call(this);
+                                               
+                                            },
+                                            items : [
+                                                {
+                                                    xtype: Gtk.ListStore,
+                                                    id : "children-list-store",
+                                                    pack : false,
+                                                    init : function() 
+                                                            {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.set_column_types ( 6, [
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_BOOLEAN, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING, 
+                                                                    GObject.TYPE_STRING 
+                                                                ] );
+                                                                
+                                                            }
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Child classes",
+                                            expand : true,
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererText
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.TreeViewColumn,
+                                            title : "Active",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.CellRendererToggle,
+                                                    listeners : {
+                                                        toggled : function (self, path) {
+                                                            print("TOGGLE");
+                                                            // this.list
+                                                        
+                                                        
+                                                             
+                                                            var old = this.list.getValue(path, 1);
+                                                           // print(JSON.stringify(old));
+                                                            this.list.setValue(path, 1, old ? false : true)
+                                                            
+                                                            
+                                                            
+                                                            
+                                                        }
+                                                    },
+                                                    activatable : true
+                                                }
+                                            ]
                                         }
                                     ]
                                 }