Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / EditProject.bjs
index fca92ef..9c3d84c 100644 (file)
@@ -1 +1,95 @@
-{"id":"file-gtk-12","name":"EditProject","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/EditProject.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","default_height":500,"default_width":600,"|deletable":true,"|modal":true,"border_width":3,"title":"Project Properties","|show":"function(c) {\n       c = c || { name : '' , xtype : '' };\n    this.project  = c;\n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    [ 'xtype'  ].forEach(function(k) {\n        _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    });\n\t// shouild set path..\n    \n    this.el.show_all();\n    this.success = c.success;\n}\n","listeners":{"destroy_event":"function (self, event) {\n     this.el.hide();\n                return false;\n}","response":"function (self, id) {\n if (id < 1) {\n            this.el.hide();\n            return;\n        }\n        if (!this.get('xtype').getValue().length) {\n            this.get('/StandardErrorDialog').show(\"You have to set Project type\");             \n            return;\n        }\n        if (!this.get('dir').el.get_filename().length) {\n            this.get('/StandardErrorDialog').show(\"You have to select a folder\");             \n            return;\n        }\n\n        this.el.hide();\n        \n        \n        var fn = this.get('dir').el.get_filename();\n        \n        this.project.name  = GLib.basename(fn);\n        this.project.xtype  = this.get('xtype').getValue();\n        this.project.paths = {};\n        this.project.paths[fn] =  'dir' ;\n        \n        var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n        \n        this.success(pr);\n        Seed.print(id);\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,3","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,true,3","label":"Project type :"},{"|xns":"Gtk","xtype":"ComboBox","pack":"pack_end,true,true,3","id":"xtype","|setValue":"function(v)\n                {\n                    var el = this.el;\n                    el.set_active(-1);\n                    this.get('model').data.forEach(function(n, ix) {\n                        if (v == n.xtype) {\n                            el.set_active(ix);\n                            return false;\n                        }\n                    });\n                }","|getValue":"function() {\n     var ix = this.el.get_active();\n            if (ix < 0 ) {\n                return '';\n            }\n            return this.get('model').data[ix].xtype;\n}\n","|init":"function() {\n    XObject.prototype.init.call(this);\n  this.el.add_attribute(this.items[0].el , 'markup', 1 );  \n}\n","items":[{"|xns":"Gtk","xtype":"CellRendererText","pack":"pack_start"},{"|xns":"Gtk","xtype":"ListStore","pack":"set_model","|init":"function() {\n    XObject.prototype.init.call(this);\n\n                            this.el.set_column_types ( 2, [\n                                GObject.TYPE_STRING,  // real key\n                                GObject.TYPE_STRING // real type\n                                \n                                \n                            ] );\n                            \n                            this.data = [\n                                { xtype: 'Roo', desc : \"Roo Project\" },\n                                { xtype: 'Gtk', desc : \"Gtk Project\" },    \n                                //{ xtype: 'JS', desc : \"Javascript Class\" }\n                            ]\n                            \n                            this.loadData(this.data);\n                                \n}\n","|loadData":"function (data) {\n                                            \n            var iter = new Gtk.TreeIter();\n            var el = this.el;\n            data.forEach(function(p) {\n                \n                el.append(iter);\n                \n                 \n                el.set_value(iter, 0, p.xtype);\n                el.set_value(iter, 1, p.desc);\n                \n            });\n              \n                                     \n}\n","id":"model"}]}]},{"|xns":"Gtk","xtype":"FileChooserWidget","pack":"pack_end,true,true,5","|action":"Gtk.FileChooserAction.SELECT_FOLDER","id":"dir","|select_multiple":false}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"}]}]}
\ No newline at end of file
+{
+    "id": "file-gtk-6",
+    "name": "EditProject",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/EditProject.bjs",
+    "items": [
+        {
+            "listeners": {
+                "destroy_event": " (self, event) => {\n     this.el.hide();\n                return false;\n}",
+                "response": "  (self, id) => {\n     if (id < 1) {\n            this.el.hide();\n            return;\n    }\n    if (_this.xtype.getValue().length < 1) {\n        StandardErrorDialog.show(\"You have to set Project type\");             \n        return;\n    }\n    if (_this.dir.el.get_filename().length < 1) {\n        StandardErrorDialog.show(\"You have to select a folder\");             \n        return;\n    }\n\n    this.el.hide();\n    \n    \n    var fn = _this.dir.el.get_filename();\n    \n    var project = Project.Project.factory(_this.xtype.getValue(), fn);\n    \n    \n    //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n    \n    this.success(project);\n\n}"
+            },
+            ".signal:void:success(Project.Project project)": "",
+            "border_width": 3,
+            "default_height": 500,
+            "default_width": 600,
+            "title": "Project Properties",
+            "xtype": "Dialog",
+            "|deletable": "true",
+            "|modal": "true",
+            "|void:show": "() {\n      \n\n    //[ 'xtype'  ].forEach(function(k) {\n    //    _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    //});\n\t// shouild set path..\n    _this.model.loadData();\n    this.el.show_all();\n    //this.success = c.success;\n}\n",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "xtype": "VBox",
+                    "|pack": " get_content_area().add \n \n",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "HBox",
+                            "pack": "pack_start,false,true,3",
+                            "items": [
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "Label",
+                                    "pack": "pack_start,false,true,3",
+                                    "label": "Project type :"
+                                },
+                                {
+                                    "id": "xtype",
+                                    "pack": "pack_end,true,true,3",
+                                    "xtype": "ComboBox",
+                                    "|init": " this.el.add_attribute(cellrender , \"markup\", 1 );  \n \n",
+                                    "|setValue": " (v)    {\n        var el = this.el;\n        el.set_active(-1);\n        \n        for (var i =0;i < this.data.length; i++ ) {\n            if (v == this.data.nth_datA(i)) {\n                el.set_active(ix);\n                return false;\n            }\n        }\n    }",
+                                    "|string:getValue": " () {\n     var ix = this.el.get_active();\n        if (ix < 0 ) {\n            return \"\";\n        }\n        switch(ix) {\n            case 0:\n                return \"Roo\";\n            case 1:\n                return \"Gtk\";\n        }\n        return \"\";\n}\n",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "id": "cellrender",
+                                            "pack": "pack_start,true",
+                                            "xtype": "CellRendererText",
+                                            "|xns": "Gtk"
+                                        },
+                                        {
+                                            "columns": "typeof(string),typeof(string)",
+                                            "id": "model",
+                                            "n_columns": 3,
+                                            "pack": "set_model",
+                                            "xtype": "ListStore",
+                                            "|void:loadData": "  ( ) {\n        this.el.clear();\n                      \n        Gtk.TreeIter iter;\n                \n        el.append(out iter);\n        \n        el.set_value(iter, 0, \"Roo\");\n        el.set_value(iter, 1, \"Roo Project\");\n         el.append(out iter);\n        \n        el.set_value(iter, 0, \"Gtk\");\n        el.set_value(iter, 1, \"Gtk Project\");\n         \n              \n                                     \n}\n",
+                                            "|xns": "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "FileChooserWidget",
+                            "pack": "pack_end,true,true,5",
+                            "|action": "Gtk.FileChooserAction.SELECT_FOLDER",
+                            "id": "dir",
+                            "|select_multiple": false
+                        }
+                    ]
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,1",
+                    "label": "OK"
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,0",
+                    "label": "Cancel"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file