Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / DialogTemplateSelect.bjs
index bd33682..0af6d62 100644 (file)
@@ -1 +1,75 @@
-{"id":"file-gtk-9","name":"DialogTemplateSelect","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogTemplateSelect.bjs","items":[{"listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}"},"default_height":200,"default_width":400,"xtype":"Dialog","|modal":true,"|show":"function(node) {\n    \n    var pal = this.get('/Window.LeftTree').getPaleteProvider();\n    var opts = pal.listTemplates(node);\n    if (!opts.length) {\n        return node;\n    }\n  \n    opts.unshift({ path: '' , name :'Just add Element' });\n    this.get('combo.model').loadData(opts);\n     this.get('combo').el.set_active(0);\n     \n    this.el.show_all();\n    this.el.run();\n    this.el.hide();\n    var ix = this.get('combo').el.get_active();\n    if (ix < 1 ) {\n        return node;\n    }\n    \n\n    return pal.loadTemplate(opts[ix].path)\n\n}\n","|xns":"Gtk","items":[{"xtype":"VBox","|pack":"function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n","|xns":"Gtk","items":[{"pack":"pack_start,false,false,0","xtype":"HBox","|xns":"Gtk","listeners":{},"items":[{"label":"Select Template : ","pack":"pack_start,false,false","xtype":"Label","|xns":"Gtk"},{"id":"combo","pack":"add","xtype":"ComboBox","|init":"function() {\n    XObject.prototype.init.call(this);\n     this.el.add_attribute(this.items[0].el , 'markup', 1 );\n}\n","|xns":"Gtk","items":[{"pack":"pack_start","xtype":"CellRendererText","|xns":"Gtk"},{"id":"model","pack":"set_model","xtype":"ListStore","|init":"function() {\n    XObject.prototype.init.call(this);\n            this.el.set_column_types ( 2, [\n            GObject.TYPE_STRING,  // real key\n            GObject.TYPE_STRING // real type\n            \n            \n        ] );\n}\n","|loadData":"function (data) {\n    this.el.clear();                                    \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.path);\n        el.set_value(iter, 1, ''+ p.name);\n        \n    });\n              \n                                     \n}\n","|xns":"Gtk"}]}]}]},{"label":"OK","pack":"add_action_widget,0","xtype":"Button","|xns":"Gtk"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false,\"runhtml\":\"\"}"}
\ No newline at end of file
+{
+    "id": "file-gtk-5",
+    "name": "DialogTemplateSelect",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/DialogTemplateSelect.bjs",
+    "items": [
+        {
+            "listeners": {
+                "delete_event": "  (self, event)  =>{\n    this.el.hide();\n    return true;\n}"
+            },
+            "default_height": 200,
+            "default_width": 400,
+            "xtype": "Dialog",
+            "|JsRender.Node?:show": " (Palete.Palete pal, JsRender.Node node) {\n    \n\n    var opts = pal.listTemplates(node);\n    if (opts.length() < 1) {\n        return node;\n    }\n    \n    //opts.unshift({ path: '' , name :'Just add Element' });\n     _this.model.loadData(opts);\n     _this.combo.el.set_active(0);\n     \n    this.el.show_all();\n    this.el.run();\n    this.el.hide();\n    var ix = _this.combo.el.get_active();\n    if (ix < 1 ) {\n        return null;\n    }\n    \n\n    return pal.loadTemplate(opts.nth_data(ix));\n\n}\n",
+            "|modal": "true",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "xtype": "VBox",
+                    "|pack": "get_content_area().add ",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "pack": "pack_start,false,false,0",
+                            "xtype": "HBox",
+                            "|xns": "Gtk",
+                            "listeners": {},
+                            "items": [
+                                {
+                                    "label": "Select Template : ",
+                                    "pack": "pack_start,false,false",
+                                    "xtype": "Label",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "combo",
+                                    "pack": "add",
+                                    "xtype": "ComboBox",
+                                    "|init": "this.el.add_attribute(_this.cellrenderer , \"markup\", 1 );",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "id": "cellrenderer",
+                                            "pack": "pack_start,true",
+                                            "xtype": "CellRendererText",
+                                            "|xns": "Gtk"
+                                        },
+                                        {
+                                            "id": "model",
+                                            "n_columns": 2,
+                                            "pack": "set_model",
+                                            "xtype": "ListStore",
+                                            "|columns": "typeof(string),typeof(string)",
+                                            "|void:loadData": "  (GLib.List<string> data) {\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n    \n     \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"Just add Element\");\n    \n    for (var i = 0; i < data.length();i++) {\n    \n\n        el.append(out iter);\n        var str = data.nth_data(i);\n        var fn = Path.get_basename (str);\n        fn.replace(\".json\", \"\");\n        \n        el.set_value(iter, 0, fn);\n        el.set_value(iter, 1, str);\n        \n    }\n              \n                                     \n}\n",
+                                            "|xns": "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "label": "OK",
+                    "pack": "add_action_widget,0",
+                    "xtype": "Button",
+                    "|xns": "Gtk"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file