1 static Xcls_DialogPluginWebkit _DialogPluginWebkit;
3 public class Xcls_DialogPluginWebkit : Object
6 private Xcls_DialogPluginWebkit _this;
8 public static Xcls_DialogPluginWebkit singleton()
10 if (_DialogPluginWebkit == null) {
11 _DialogPluginWebkit= new Xcls_DialogPluginWebkit();
13 return _DialogPluginWebkit;
15 public Xcls_webview webview;
21 public Xcls_DialogPluginWebkit()
24 this.el = new Gtk.Dialog();
29 this.el.title = "Add / Edit Component";
30 this.el.default_height = 500;
31 this.el.default_width = 500;
32 this.el.deletable = true;
34 var child_0 = new Xcls_VBox2( _this );
36 this.el.get_content_area().add ( child_0.el );
37 var child_1 = new Xcls_Button5( _this );
39 this.el.add_action_widget ( child_1.el , 0 );
40 var child_2 = new Xcls_Button6( _this );
42 this.el.add_action_widget ( child_2.el , 1 );
45 this.el.delete_event.connect( (self, event) => {
52 // user defined functions
53 public string show (Gtk.Window ?parent, string text) {// JsRender.Node node) {
56 this.el.set_transient_for(parent);
61 var runhtml = "<script type=\"text/javascript\">\n" ;
65 GLib.FileUtils.get_contents(BuilderApplication.configDirectory() + "/resources/roo.builder.js", out builderhtml);
67 runhtml += builderhtml + "\n";
71 "Roo.onReady(function() {\n" +
73 "Roo.XComponent.build();\n" +
77 var db = new JsRender.RooDatabase.from_cfg ("MySQL", "hydra", "root", "");
80 var ar = db.readForeignKeys("Person");
81 var generator = new Json.Generator ();
82 var root = new Json.Node(Json.NodeType.OBJECT);
84 generator.set_root (root);
86 generator.pretty = true;
90 " Roo.XComponent.on('buildcomplete', function() {" +
91 " Editor.Roo.grid.Grid.show(" + generator.to_data (null) + "); " +
98 runhtml += "</script>\n" ;
100 // fix to make sure they are the same..
102 // need to modify paths
106 GLib.FileUtils.get_contents(
107 BuilderApplication.configDirectory() + "/resources/roo.builder.html"
111 // fetch the json from the database...
115 var html = inhtml.replace("</head>", runhtml + // + this.runhtml +
116 "<script type=\"text/javascript\" src=\"xhttp://localhost/app.Builder.js/resources/Editors/Editor.Roo.grid.Grid.js\"></script>" +
117 // "<script type=\"text/javascript\" src=\"xhttp://localhost" + fc.fname + "\"></script>" +
118 // "<script type=\"text/javascript\">\n" +
123 //print("LOAD HTML " + html);
125 //var rootURL = _this.file.project.rootURL;
129 this.webview.el.load_html( html ,
130 //fixme - should be a config option!
131 "xhttp://localhost/app.Builder.js/"
139 var response_id = this.el.run();
140 if (response_id < 1) {
156 public class Xcls_VBox2 : Object
159 private Xcls_DialogPluginWebkit _this;
165 public Xcls_VBox2(Xcls_DialogPluginWebkit _owner )
168 this.el = new Gtk.VBox( false, 0 );
172 // set gobject values
173 var child_0 = new Xcls_ScrolledWindow3( _this );
175 this.el.pack_start ( child_0.el , false,true,3 );
178 // user defined functions
180 public class Xcls_ScrolledWindow3 : Object
182 public Gtk.ScrolledWindow el;
183 private Xcls_DialogPluginWebkit _this;
189 public Xcls_ScrolledWindow3(Xcls_DialogPluginWebkit _owner )
192 this.el = new Gtk.ScrolledWindow( null, null );
196 // set gobject values
197 this.el.expand = true;
198 var child_0 = new Xcls_webview( _this );
200 this.el.add ( child_0.el );
204 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
207 // user defined functions
209 public class Xcls_webview : Object
211 public WebKit.WebView el;
212 private Xcls_DialogPluginWebkit _this;
218 public Xcls_webview(Xcls_DialogPluginWebkit _owner )
221 _this.webview = this;
222 this.el = new WebKit.WebView();
226 // set gobject values
231 // this may not work!?
232 var settings = this.el.get_settings();
233 settings.enable_write_console_messages_to_stdout = true;
235 var fs= new FakeServer(this.el);
237 // this was an attempt to change the url perms.. did not work..
238 // settings.enable_file_access_from_file_uris = true;
239 // settings.enable_offline_web_application_cache - true;
240 // settings.enable_universal_access_from_file_uris = true;
247 // FIXME - base url of script..
248 // we need it so some of the database features work.
249 this.el.load_html( "Render not ready" ,
250 //fixme - should be a config option!
251 // or should we catch stuff and fix it up..
252 "xhttp://localhost/app.Builder/"
261 this.el.script_dialog.connect( (dialog) => {
262 if (this.el == null) {
266 var msg = dialog.get_message();
267 if (msg.length < 4) {
270 if (msg.substring(0,4) != "IPC:") {
273 var ar = msg.split(":", 3);
277 print("CMD: %s\n",ar[1]);
278 print("ARGS: %s\n",ar[2]);
282 // _this.file.saveHTML(ar[2]);
291 // user defined functions
293 public class Xcls_Button5 : Object
295 public Gtk.Button el;
296 private Xcls_DialogPluginWebkit _this;
302 public Xcls_Button5(Xcls_DialogPluginWebkit _owner )
305 this.el = new Gtk.Button();
309 // set gobject values
310 this.el.label = "Cancel";
313 // user defined functions
315 public class Xcls_Button6 : Object
317 public Gtk.Button el;
318 private Xcls_DialogPluginWebkit _this;
324 public Xcls_Button6(Xcls_DialogPluginWebkit _owner )
327 this.el = new Gtk.Button();
331 // set gobject values
332 this.el.label = "OK";
335 // user defined functions