1 //<Script type="text/javascript">
5 console = imports.console;
6 XObject = imports.XObject.XObject;
9 //----------------------- our roo verison
10 Base = imports.Builder.Provider.File.Base.Base;
14 JSDOC = imports['JSDOC.js'];
15 //----------------------- our roo verison
23 //"name":"Edit Module Details",
25 //"btype":"FORM", // was to be components...
27 //"module":"Pman.Tab.BuilderTop2"
30 if (!cfg.name || !cfg.fullname ) {
31 cfg.name = cfg.path.split('/').pop().replace(/\.js$/, '');
32 cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
38 var jstr = JSON.parse(cfg.json);
39 this.items = [ jstr ];
40 //console.log(cfg.items.length);
41 delete cfg.json; // not needed!
45 var p = cfg.items && cfg.items.length && cfg.items[0].parent ? cfg.items[0].parent : false;
47 // ensure real data is set...
58 Roo.superclass.constructor.call(this, cfg);
62 this.id = 'roo-file-' + (id++);
63 // various loader methods..
68 setNSID : function(id)
71 this.items[0]['|module'] = id;
76 loadItems : function(cb)
78 console.log("load Items!");
79 if (this.items.length) {
82 var file = Gio.file_new_for_path(this.path);
85 file.read_async(0, null, function(source,result) {
86 var stream = source.read_finish(result)
87 var dstream = new Gio.DataInputStream.c_new(stream);
89 var src = dstream.read_until("")
90 var tstream = new JSDOC.TextStream(src);
91 var tr = new JSDOC.TokenReader( {
95 var toks = tr.tokenize(tstream);
96 var ts = new JSDOC.Collapse(toks);
97 //console.dump(ts.tokens);
98 var rd = new JSDOC.RooFile(ts.tokens);
103 _this.items = [ src ];
108 console.dump(rd.cfg);
109 //!!??? have we got engouth!
110 // try parsing self..
111 _this.items = [ rd.cfg ];
125 // dump the file tree back out to a string.
127 if (typeof(this.items[0]['|module']) != 'undefined') {
128 return this.toSourceStdClass();
131 if (this.items[0].region) {
132 return this.toSourceLayout();
134 return this.toSourceDialog();
145 outputHeader : function()
148 "//<script type=\"text/javascript\">",
150 "// Auto generated file - created by Builder Module - do not edit directly",
156 // a standard dialog module.
157 toSourceDialog : function()
159 var b = this.items[0];
160 var o = this.mungePropObj(this.items[0]);
163 b['|module'] + " = {",
168 " show : function(data, cb)",
170 " if (!this.dialog) {",
174 " this.callback = cb;",
175 " this.data = data;",
176 " this.dialog.show();",
178 " this.form.reset();",
179 " this.form.setValues(data);",
180 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
185 " create : function()",
187 " var _this = this;",
188 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
199 toSourceLayout : function()
201 var b = this.items[0];
202 var o = this.mungePropObj(this.items[0]);
204 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
210 "// register the module first",
211 "Pman.on('beforeload', function()",
214 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
215 " module : " + b['|module'] + ",",
216 " region : '" + (b.region || '') +"',",
217 " parent : " + (b.parent || false) + ",",
218 " name : \"" + (b.name || "unnamed module") + "\"",
219 " disabled : " + disabled +" ",
224 b['|module'] + " = new Roo.util.Observable({",
227 " disabled : false,",
228 " parentLayout: false,",
230 " add : function(parentLayout, region)",
233 " var _this = this;", // standard avaialbe..
234 " this.parentLayout = parentLayout;",
236 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
237 " this.layout = this.panel.layout;",
249 getTree : function( o ) {