X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FBuilder4%2FDialogTemplateSelect.bjs;h=c0d04c701ab63607cdbfcc1fb4e866038c748e58;hb=1eb7406e95f4a90ed6e88f4a57efa53c329dc46d;hp=eeeafbb0754a6f35c8d5ce78bdef833393f210fe;hpb=eb7af2cf5db863d7b2611bf8fbea9b543798fb22;p=app.Builder.js diff --git a/src/Builder4/DialogTemplateSelect.bjs b/src/Builder4/DialogTemplateSelect.bjs index eeeafbb07..c0d04c701 100644 --- a/src/Builder4/DialogTemplateSelect.bjs +++ b/src/Builder4/DialogTemplateSelect.bjs @@ -11,12 +11,12 @@ "delete_event" : " (self, event) =>{\n this.el.hide();\n return true;\n}" }, "default_width" : 400, - "xtype" : "Dialog", "title" : "Add an Object", + "xtype" : "Dialog", "default_height" : 200, "$ modal" : true, "$ xns" : "Gtk", - "| JsRender.Node? show" : " (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {\n \n this.el.show_all();\n var opts = pal.listTemplates(node);\n if (opts.length() < 1) {\n this.el.hide();\n return node;\n }\n this.el.set_attached_to( mwindow.el);\n this.el.set_transient_for( mwindow.el);\n \n //opts.unshift({ path: '' , name :'Just add Element' });\n _this.model.loadData(opts);\n _this.combo.el.set_active(-1);\n \n \n var db = new Palete.RooDatabase.from_project(project);\n _this.dbmodel.loadData(db.readTablesGee());\n \n \n _this.dbcombo.el.set_active(-1);\n \n \n \n var res = this.el.run();\n this.el.hide(); \n //var ix = _this.combo.el.get_active();\n if (res < 1 ) {\n return null; // 0 = cancel.\n }\n if (res < 2 ) {\n return node; // 1 = just add it..\n }\n \n Gtk.TreeIter iter;\n if (!_this.combo.el.get_active_iter (out iter)) {\n\n return node; // nothing selected...\n }\n Value vfname;\n this.model.el.get_value (iter, 0, out vfname);\n \n \n return pal.loadTemplate((string)vfname);\n\n}\n", + "| JsRender.Node? show" : " (Xcls_MainWindow mwindow, Palete.Palete pal, JsRender.Node node, Project.Project project) {\n \n this.el.show_all();\n var opts = pal.listTemplates(node);\n if (opts.length() < 1) {\n this.el.hide();\n return node;\n }\n this.el.set_attached_to( mwindow.el);\n this.el.set_transient_for( mwindow.el);\n \n //opts.unshift({ path: '' , name :'Just add Element' });\n _this.model.loadData(opts);\n _this.combo.el.set_active(-1);\n \n \n var db = new Palete.RooDatabase.from_project(project);\n _this.dbmodel.loadData(db.readTablesGee());\n \n var plug = mwindow.windowstate.webkit_plugin;\n \n _this.dbcombo.el.set_active(-1);\n \n \n \n var res = this.el.run();\n this.el.hide(); \n //var ix = _this.combo.el.get_active();\n if (res < 1 ) {\n return null; // 0 = cancel.\n }\n if (res < 2 ) {\n return node; // 1 = just add it..\n }\n \n // have they selected a table??\n \n Gtk.TreeIter iter; \n Value vfname; \n if (_this.dbcombo.el.get_active_iter (out iter)) { \n this.dbmodel.el.get_value (iter, 0, out vfname);\n if (((string)vfname).length > 0 && plug.has_plugin(node.fqn())) {\n var json_str = plug.show(mwindow.el, project, node.fqn(), (string)vfname);\n print(\"json_str = %s\\n\", json_str);\n if (json_str.length < 1) {\n\n return node;\n }\n var pa = new Json.Parser();\n\t pa.load_from_data(json_str);\n\t var new_node = pa.get_root();\n\n\t if (new_node.get_node_type () != Json.NodeType.OBJECT) {\n\t\t return node;\n\t }\n\t var obj = new_node.get_object ();\n\n\t var ret = new JsRender.Node();\n\n\t ret.loadFromJson(obj, 1);\n\t return ret;\n }\n \n }\n\n if (!_this.combo.el.get_active_iter (out iter)) {\n\n return node; // nothing selected...\n }\n \n this.model.el.get_value (iter, 0, out vfname);\n \n \n return pal.loadTemplate((string)vfname);\n\n}\n", "items" : [ { "xtype" : "VBox", @@ -24,15 +24,15 @@ "$ xns" : "Gtk", "items" : [ { + "xtype" : "HBox", "gint margin" : 3, "* pack" : "pack_start,false,false,0", - "xtype" : "HBox", "$ xns" : "Gtk", "items" : [ { "label" : "Select Template : ", - "* pack" : "pack_start,false,false", "xtype" : "Label", + "* pack" : "pack_start,false,false", "$ xns" : "Gtk" }, { @@ -44,14 +44,14 @@ "items" : [ { "id" : "cellrenderer", - "* pack" : "pack_start,true", "xtype" : "CellRendererText", + "* pack" : "pack_start,true", "$ xns" : "Gtk" }, { "id" : "model", - "xtype" : "ListStore", "* pack" : "set_model", + "xtype" : "ListStore", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -62,15 +62,15 @@ ] }, { + "xtype" : "HBox", "gint margin" : 3, "* pack" : "pack_start,false,false,0", - "xtype" : "HBox", "$ xns" : "Gtk", "items" : [ { "label" : "Select Database Table : ", - "* pack" : "pack_start,false,false", "xtype" : "Label", + "* pack" : "pack_start,false,false", "$ xns" : "Gtk" }, { @@ -82,14 +82,14 @@ "items" : [ { "id" : "dbcellrenderer", - "* pack" : "pack_start,true", "xtype" : "CellRendererText", + "* pack" : "pack_start,true", "$ xns" : "Gtk" }, { "id" : "dbmodel", - "xtype" : "ListStore", "* pack" : "set_model", + "xtype" : "ListStore", "$ columns" : "typeof(string),typeof(string)", "n_columns" : 2, "$ xns" : "Gtk", @@ -103,20 +103,20 @@ }, { "label" : "Cancel", - "* pack" : "add_action_widget,0", "xtype" : "Button", + "* pack" : "add_action_widget,0", "$ xns" : "Gtk" }, { "label" : "Just add it", - "xtype" : "Button", "* pack" : "add_action_widget,1", + "xtype" : "Button", "$ xns" : "Gtk" }, { "label" : "OK", - "* pack" : "add_action_widget,2", "xtype" : "Button", + "* pack" : "add_action_widget,2", "$ xns" : "Gtk" } ]