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;
79 loadItems : function(cb)
81 console.log("load Items!");
82 if (this.items.length) {
85 var file = Gio.file_new_for_path(this.path);
88 file.read_async(0, null, function(source,result) {
89 var stream = source.read_finish(result)
90 var dstream = new Gio.DataInputStream.c_new(stream);
92 var src = dstream.read_until("")
93 var tstream = new JSDOC.TextStream(src);
94 var tr = new JSDOC.TokenReader( {
98 var toks = tr.tokenize(tstream);
99 var ts = new JSDOC.Collapse(toks);
100 //console.dump(ts.tokens);
101 var rd = new JSDOC.RooFile(ts.tokens);
106 _this.items = [ src ];
111 console.dump(rd.cfg);
112 //!!??? have we got engouth!
113 // try parsing self..
114 _this.items = [ rd.cfg ];
128 // dump the file tree back out to a string.
130 if (typeof(this.items[0]['|module']) != 'undefined') {
131 return this.toSourceStdClass();
134 if (this.items[0].region) {
135 return this.toSourceLayout();
137 return this.toSourceDialog();
148 outputHeader : function()
151 "//<script type=\"text/javascript\">",
153 "// Auto generated file - created by Builder Module - do not edit directly",
159 // a standard dialog module.
160 toSourceDialog : function()
162 var b = this.items[0];
163 var o = this.mungePropObj(this.items[0]);
166 b['|module'] + " = {",
171 " show : function(data, cb)",
173 " if (!this.dialog) {",
177 " this.callback = cb;",
178 " this.data = data;",
179 " this.dialog.show();",
181 " this.form.reset();",
182 " this.form.setValues(data);",
183 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
188 " create : function()",
190 " var _this = this;",
191 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
202 toSourceLayout : function()
204 var b = this.items[0];
205 var o = this.mungePropObj(this.items[0]);
207 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
213 "// register the module first",
214 "Pman.on('beforeload', function()",
217 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
218 " module : " + b['|module'] + ",",
219 " region : '" + (b.region || '') +"',",
220 " parent : " + (b.parent || false) + ",",
221 " name : \"" + (b.name || "unnamed module") + "\"",
222 " disabled : " + disabled +" ",
227 b['|module'] + " = new Roo.util.Observable({",
230 " disabled : false,",
231 " parentLayout: false,",
233 " add : function(parentLayout, region)",
236 " var _this = this;", // standard avaialbe..
237 " this.parentLayout = parentLayout;",
239 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
240 " this.layout = this.panel.layout;",
252 getTree : function( o ) {