"gint default_height" : 500,
"gboolean deletable" : true,
"xtype" : "Dialog",
- "| string show" : " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {\n \n if (parent != null) {\n this.el.set_transient_for(parent);\n this.el.modal = true;\n }\n this.result_json = \"\";\n var db = project.roo_database;\n \n \n this.el.show_all();\n var ret = \"\";\n while (true) {\n \n var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n string builderhtml;\n \n try {\n GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n } catch (Error e) {\n builderhtml = \"\";\n }\n \n\n runhtml += builderhtml + \"\\n\";\n \n \n runhtml += \"\\n\" +\n \"Builder.saveHTML = function() {};\\n\" + \n\t \"Roo.onReady(function() {\\n\" +\n\n\t \"Roo.XComponent.build();\\n\" +\n\t \"});\\n\";\n\t\n\t\n \n\n var ar = db.readForeignKeys(tbl);\n var generator = new Json.Generator ();\n var root = new Json.Node(Json.NodeType.OBJECT);\n root.init_object(ar);\n generator.set_root (root);\n \n generator.pretty = true;\n generator.indent = 4;\n \n runhtml += \"\\n\" +\n \" Roo.XComponent.on('buildcomplete', function() {\\n\" +\n \" Editor.\" + cls + \".panel.loadData(\" + generator.to_data (null) + \"); \" +\n \"});\\n\";\n\n \n\t\n\t\n\n runhtml += \"</script>\\n\" ;\n\n print(runhtml);\n // fix to make sure they are the same..\n \n // need to modify paths\n\n string inhtml;\n try {\n GLib.FileUtils.get_contents(\n BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n , out inhtml);\n \n } catch (Error e) {\n inhtml = \"\";\n }\n // fetch the json from the database...\n \n //print(runhtml);\n \n var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + \n \"<script type=\\\"text/javascript\\\" src=\\\"resources://localhost/Editors/Editor.\" + cls + \".js\\\"></script>\" + \n \n \n \"</head>\");\n //print(\"LOAD HTML \" + html);\n \n //var rootURL = _this.file.project.rootURL;\n \n \n \n this.webview.el.load_html( html , \n //fixme - should be a config option!\n \"xhttp://localhost/app.Builder.js/\"\n );\n \n \n \n \n var response_id = this.el.run();\n \n if (response_id == 1) { // OK...\n var loop = new MainLoop();\n // run toBJS to get the data... (calls back into alert handler)\n this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {\n\n this.webview.el.run_javascript.end(res);\n\n loop.quit();\n });\n loop.run();\n ret = _this.result_json;\n // print(\"LOOP END?\");\n // try and get the resopse...\n break;\n }\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n // keep showing...?\n continue;\n }\n \n // now we save it..\n this.el.hide();\n \n return ret;\n \n \n \n}\n",
+ "| string show" : " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {\n \n if (parent != null) {\n this.el.set_transient_for(parent);\n this.el.modal = true;\n }\n this.result_json = \"\";\n var db = project.roo_database;\n \n \n this.el.show_all();\n var ret = \"\";\n while (true) {\n \n var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n string builderhtml;\n \n try {\n GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n } catch (Error e) {\n builderhtml = \"\";\n }\n \n\n runhtml += builderhtml + \"\\n\";\n \n \n runhtml += \"\\n\" +\n \"Builder.saveHTML = function() {};\\n\" + \n\t \"Roo.onReady(function() {\\n\" +\n\n\t \"Roo.XComponent.build();\\n\" +\n\t \"});\\n\";\n\t\n\t\n \n\n var ar = db.readForeignKeys(tbl);\n var generator = new Json.Generator ();\n var root = new Json.Node(Json.NodeType.OBJECT);\n root.init_object(ar);\n generator.set_root (root);\n \n generator.pretty = true;\n generator.indent = 4;\n \n runhtml += \"\\n\" +\n \" Roo.XComponent.on('buildcomplete', function() {\\n\" +\n \" Editor.\" + cls + \".panel.loadData(\" + generator.to_data (null) + \"); \" +\n \"});\\n\";\n\n \n\t\n\t\n\n runhtml += \"</script>\\n\" ;\n\n print(runhtml);\n // fix to make sure they are the same..\n \n // need to modify paths\n\n string inhtml;\n try {\n GLib.FileUtils.get_contents(\n BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n , out inhtml);\n \n } catch (Error e) {\n inhtml = \"\";\n }\n // fetch the json from the database...\n \n //print(runhtml);\n \n var html = inhtml.replace(\"</head>\", runhtml + // + this.runhtml + \n \"<script type=\\\"text/javascript\\\" src=\\\"resources://localhost/Editors/Editor.\" + cls + \".js\\\"></script>\" + \n \n \n \"</head>\");\n //print(\"LOAD HTML \" + html);\n \n //var rootURL = _this.file.project.rootURL;\n \n \n \n this.webview.el.load_html( html , \n //fixme - should be a config option!\n \"xhttp://localhost/app.Builder.js/\"\n );\n \n \n \n \n var response_id = this.el.run();\n \n if (response_id == 1) { // OK...\n var loop = new MainLoop();\n // run toBJS to get the data... (calls back into alert handler)\n _this.result_json = \"\";\n this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {\n try {\n this.webview.el.run_javascript.end(res);\n } catch(Error e) {\n \n }\n loop.quit();\n });\n loop.run();\n ret = _this.result_json;\n \n \n // print(\"LOOP END?\");\n // try and get the resopse...\n break;\n }\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n // keep showing...?\n continue;\n }\n \n // now we save it..\n this.el.hide();\n \n return ret;\n \n \n \n}\n",
"| bool has_plugin" : "(string cls) {\n\n return GLib.FileUtils.test(\n BuilderApplication.configDirectory() + \"/resources/Editors/Editor.\" + cls + \".js\",\n GLib.FileTest.IS_REGULAR\n );\n \n\n\n}\n",
"$ xns" : "Gtk",
"gint default_width" : 750,
if (response_id == 1) { // OK...
var loop = new MainLoop();
// run toBJS to get the data... (calls back into alert handler)
- this.webview.el.run_javascript.begin("Editor." + cls + ".panel.toBJS();", null, (obj, res) => {
-
- this.webview.el.run_javascript.end(res);
-
- loop.quit();
- });
- loop.run();
- ret = _this.result_json;
+ _this.result_json = "";
+ this.webview.el.run_javascript.begin("Editor." + cls + ".panel.toBJS();", null, (obj, res) => {
+ try {
+ this.webview.el.run_javascript.end(res);
+ } catch(Error e) {
+
+ }
+ loop.quit();
+ });
+ loop.run();
+ ret = _this.result_json;
+
+
// print("LOOP END?");
// try and get the resopse...
break;