Sample/DialogNewComponent.bjs
authorAlan Knowles <alan@akbkhome.com>
Thu, 27 May 2010 10:12:55 +0000 (18:12 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 27 May 2010 10:12:55 +0000 (18:12 +0800)
Sample/DialogNewComponent.bjs

index 078c401..d155f68 100644 (file)
@@ -1 +1 @@
-{"id":"file-gtk-3","name":"DialogNewComponent","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogNewComponent.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","|deletable":false,"|modal":true,"title":"New Component","id":"DialogNewComponent","default_width":500,"default_height":200,"|show":"function (c) \n        {\n            if (!this.el) {\n                this.init();\n            }\n            c = c || { name : '' , xtype : '' };\n            // check whic project we are adding to..\n            XObject.extend(this, c);\n            // causes problems.. get_screen?? not transfer ownership?\n           /// var Window                = imports.Builder.Window.Window;\n            //this.el.set_screen(Window.el.get_screen());\n            \n            //var paths = [];\n            //for (var i in this.project.paths) {\n             //   paths.push({\n             //       id : i,\n             //       desc : i\n             //   });\n           // }\n             //console.log('load paths');\n             \n            // load the paths.\n           // this.get('directory_model').loadData(paths);\n                \n            \n            console.log('show all');\n            this.el.show_all();\n            this.success = c.success;\n            /*\n            var tm = this.get('template_model');\n            if (tm.templates) {\n                return;\n            }\n            tm.templates = [];\n            var dir = __script_path__ + '/templates/';\n            \n            var f = Gio.file_new_for_path(dir);\n            f.enumerate_children_async (\"*\",  Gio.FileQueryInfoFlags.NONE, \n                    GLib.PRIORITY_DEFAULT, null, function(o,ar) {\n                // enum completed..\n                var fe = f.enumerate_children_finish(ar);\n                var ch = '';\n                while (ch = fe.next_file(null)) {\n                    var add = dir + '/' + ch.get_name();\n                    if (!add.match(/\\.js$/)) {\n                        continue;\n                    }\n                    tm.templates.push(add);\n                    \n                }\n                tm.loadData();\n                \n            }, null);\n            */\n            \n        }","listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}","response":"function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n\n            \n           \n    \n        if (!this.get('xnsid').el.get_text().length ) {\n            this.get('/StandardErrorDialog').show(\n                \"You have to set Project name \"\n            );\n             \n            return;\n        }\n\tvar dir ='';\n        for (var i in this.project.paths) {\n \t\tdir = i;\n\t\tbreak;\n\t}\n\n        var xidns = DialogNewComponent.get('xnsid').el.get_text();\n        \n        // what about .js ?\n         if (GLib.file_test (GLib.dir + '/' + xidns + '.bjs', GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n        \n        var _this = this;\n        var nf = _this.project.create(dir + '/' + xidns + '.bjs');\n        if (this.get('/DialogNewComponent').success) {\n            this.get('/DialogNewComponent').success(_this.project, nf);\n        }\n}","show":"function (self) {\n  this.el.show_all();\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":"function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n","items":[{"|xns":"Gtk","xtype":"HBox","pack":"pack_start,false,true,0","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,true,0","label":"Component Name","xpad":10},{"|xns":"Gtk","xtype":"Entry","pack":"pack_end,true,true,0","id":"xnsid"}]},{"n_columns":2,"n_rows":3,"pack":"pack_start,false,false,0","xtype":"Table","|homogeneous":false,"|xns":"Gtk","items":[{"x_options":0,"label":"parent","pack":"add","xalign":1,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}},{"x_options":0,"label":"title","pack":"add","xalign":0.9,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}},{"x_options":0,"label":"parent","pack":"add","xalign":1,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}}]}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false}"}
\ No newline at end of file
+{"id":"file-gtk-9","name":"DialogNewComponent","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogNewComponent.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","|deletable":false,"|modal":true,"title":"New Component","id":"DialogNewComponent","default_width":500,"default_height":200,"|show":"function (c) \n        {\n            if (!this.el) {\n                this.init();\n            }\n            c = c || { name : '' , xtype : '' };\n            // check whic project we are adding to..\n            XObject.extend(this, c);\n            // causes problems.. get_screen?? not transfer ownership?\n           /// var Window                = imports.Builder.Window.Window;\n            //this.el.set_screen(Window.el.get_screen());\n            \n            //var paths = [];\n            //for (var i in this.project.paths) {\n             //   paths.push({\n             //       id : i,\n             //       desc : i\n             //   });\n           // }\n             //console.log('load paths');\n             \n            // load the paths.\n           // this.get('directory_model').loadData(paths);\n                \n            \n            console.log('show all');\n            this.el.show_all();\n            this.success = c.success;\n            /*\n            var tm = this.get('template_model');\n            if (tm.templates) {\n                return;\n            }\n            tm.templates = [];\n            var dir = __script_path__ + '/templates/';\n            \n            var f = Gio.file_new_for_path(dir);\n            f.enumerate_children_async (\"*\",  Gio.FileQueryInfoFlags.NONE, \n                    GLib.PRIORITY_DEFAULT, null, function(o,ar) {\n                // enum completed..\n                var fe = f.enumerate_children_finish(ar);\n                var ch = '';\n                while (ch = fe.next_file(null)) {\n                    var add = dir + '/' + ch.get_name();\n                    if (!add.match(/\\.js$/)) {\n                        continue;\n                    }\n                    tm.templates.push(add);\n                    \n                }\n                tm.loadData();\n                \n            }, null);\n            */\n            \n        }","listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}","response":"function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n\n            \n           \n    \n        if (!this.get('xnsid').el.get_text().length ) {\n            this.get('/StandardErrorDialog').show(\n                \"You have to set Project name \"\n            );\n             \n            return;\n        }\n\tvar dir ='';\n        for (var i in this.project.paths) {\n \t\tdir = i;\n\t\tbreak;\n\t}\n\n        var xidns = DialogNewComponent.get('xnsid').el.get_text();\n        \n        // what about .js ?\n         if (GLib.file_test (GLib.dir + '/' + xidns + '.bjs', GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n        \n        var _this = this;\n        var nf = _this.project.create(dir + '/' + xidns + '.bjs');\n        if (this.get('/DialogNewComponent').success) {\n            this.get('/DialogNewComponent').success(_this.project, nf);\n        }\n}","show":"function (self) {\n  this.el.show_all();\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":"function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n","items":[{"|xns":"Gtk","xtype":"HBox","pack":"pack_start,false,true,0","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,true,0","label":"Component Name","xpad":10},{"id":"xnsid","pack":"pack_end,true,true,0","xtype":"Entry","|xns":"Gtk"}]},{"n_columns":2,"n_rows":3,"pack":"pack_start,false,false,0","xtype":"Table","|homogeneous":false,"|xns":"Gtk","items":[{"x_options":0,"label":"parent","pack":"add","xalign":1,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}},{"x_options":0,"label":"title","pack":"add","xalign":0.9,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}},{"x_options":0,"label":"parent","pack":"add","xalign":1,"xtype":"Label","|justify":"Gtk.Justification.RIGHT","|visible":true,"|xns":"Gtk"},{"pack":"add","xtype":"Entry","|visible":true,"|xns":"Gtk","listeners":{}}]}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false}"}
\ No newline at end of file