{ "id": "file-gtk-3", "name": "DialogNewComponent", "parent": "", "title": false, "path": "/home/alan/gitlive/app.Builder.js/Builder4/DialogNewComponent.bjs", "items": [ { "listeners": { "delete_event": "(self, event) => {\n this.el.hide();\n return true; \n}\n ", "response": " (self, response_id) => { \n \n\tif (response_id < 1) { // cancel!\n this.el.hide();\n return;\n }\n\n if (_this.name.el.get_text().length < 1) {\n StandardErrorDialog.show(\n \"You have to set Project name \"\n );\n \n return;\n }\n // what does this do?\n \n var isNew = _this.file.name.length > 0 ? false : true;\n \n if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n StandardErrorDialog.show(\n \"Sorry changing names does not work yet. \"\n );\n \n return;\n }\n\n // FIXME - this may be more complicated...\n //for (var i in this.def) {\n // this.file[i] = this.get(i).el.get_text();\n //}\n\n if (!isNew) {\n _this.file.save();\n this.el.hide();\n return;\n }\n\n \n\tvar dir = _this.project.firstPath();\n\t//FIXME...\n //for (var i in this.project.paths) {\n \t//\tdir = i;\n\t//\tbreak;\n\t//}\n\n \n \n // what about .js ?\n if (GLib.FileUtils.test(_this.file.name + \".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 nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n //for (var i in this.file) {\n // nf[i] = this.file[i];\n //}\n _this.success(_this.project, nf);\n /*\n\n -- fixme -- needs to be a signal..\n if (DialogNewComponent.success != null) {\n DialogNewComponent.success(_this.project, nf);\n }\n */\n}", "show": "(self) => {\n this.el.show_all();\n \n}" }, ".JsRender.JsRender:file": "", ".Project.Project:project": "", ".signal:void:success": "(Project.Project pr, JsRender.JsRender file)", "default_height": 200, "default_width": 500, "id": "DialogNewComponent", "title": "New Component", "xtype": "Dialog", "|deletable": "false", "|modal": "true", "|void:show": "(JsRender.JsRender c) \n{\n this.project = c.project;\n \n //if (!this.el) {\n //this.init();\n //}\n \n _this.name.el.set_text(c.name);\n _this.title.el.set_text(c.title);\n _this.parent.el.set_text(c.parent); \n _this.region.el.set_text(c.region);\n _this.modOrder.el.set_text(c.modOrder);\n _this.permname.el.set_text(c.permname);\n \n if (c.path.length > 0) {\n this.el.set_title(\"Edit File Details - \" + c.name);\n } else {\n this.el.set_title(\"Create New File\");\n }\n \n _this.file = c;\n //console.log('show all');\n this.el.show_all();\n \n //this.success = c.success;\n \n \n}", "|xns": "Gtk", "items": [ { "|xns": "Gtk", "xtype": "VBox", "|pack": "function(p,e) {\n p.el.get_content_area().add(e.el)\n }\n", "items": [ { "n_columns": 2, "n_rows": 3, "pack": "pack_start,false,false,0", "xtype": "Table", "|homogeneous": false, "|xns": "Gtk", "items": [ { "label": "Component Name", "pack": "add", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|xns": "Gtk" }, { "id": "name", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" }, { "label": "Title", "pack": "add", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|visible": true, "|xns": "Gtk" }, { "id": "title", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" }, { "label": "Region", "pack": "add", "tooltip_text": "center, north, south, east, west", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|visible": true, "|xns": "Gtk" }, { "id": "region", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" }, { "label": "Parent Name", "pack": "add", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|visible": true, "|xns": "Gtk" }, { "id": "parent", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" }, { "label": "Permission Name", "pack": "add", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|visible": true, "|xns": "Gtk" }, { "id": "permname", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" }, { "label": "Order (for tabs)", "pack": "add", "x_options": 4, "xalign": 0.9, "xtype": "Label", "|justify": "Gtk.Justification.RIGHT", "|visible": true, "|xns": "Gtk" }, { "id": "modOrder", "pack": "add", "xtype": "Entry", "|visible": true, "|xns": "Gtk" } ] } ] }, { "|xns": "Gtk", "xtype": "Button", "pack": "add_action_widget,0", "label": "Cancel" }, { "|xns": "Gtk", "xtype": "Button", "pack": "add_action_widget,1", "label": "OK" } ] } ], "permname": "", "modOrder": "" }