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-' + (rid++);
63 // various loader methods..
68 setNSID : function(id)
71 this.items[0]['|module'] = id;
81 loadItems : function(cb)
83 console.log("load Items!");
84 if (this.items !== false) {
87 var file = Gio.file_new_for_path(this.path);
90 file.read_async(0, null, function(source,result) {
91 var stream = source.read_finish(result)
92 var dstream = new Gio.DataInputStream.c_new(stream);
94 var src = dstream.read_until("")
96 var cfg = JSON.parse(src);
100 _this.name = cfg.name;
101 _this.parent = cfg.parent;
102 _this.title = cfg.title;
103 _this.items = cfg.items || [];
106 var tstream = new JSDOC.TextStream(src);
107 var tr = new JSDOC.TokenReader( {
111 var toks = tr.tokenize(tstream);
112 var ts = new JSDOC.Collapse(toks);
113 //console.dump(ts.tokens);
114 var rd = new JSDOC.RooFile(ts.tokens);
119 _this.items = [ src ];
124 console.dump(rd.cfg);
125 //!!??? have we got engouth!
126 // try parsing self..
127 _this.items = [ rd.cfg ];
141 // dump the file tree back out to a string.
143 if (typeof(this.items[0]['|module']) != 'undefined') {
144 return this.toSourceStdClass();
147 if (this.items[0].region) {
148 return this.toSourceLayout();
150 return this.toSourceDialog();
161 outputHeader : function()
164 "//<script type=\"text/javascript\">",
166 "// Auto generated file - created by Builder Module - do not edit directly",
172 // a standard dialog module.
173 toSourceDialog : function()
175 var b = this.items[0];
176 var o = this.mungePropObj(this.items[0]);
179 b['|module'] + " = {",
184 " show : function(data, cb)",
186 " if (!this.dialog) {",
190 " this.callback = cb;",
191 " this.data = data;",
192 " this.dialog.show();",
194 " this.form.reset();",
195 " this.form.setValues(data);",
196 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
201 " create : function()",
203 " var _this = this;",
204 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
215 toSourceLayout : function()
217 var b = this.items[0];
218 var o = this.mungePropObj(this.items[0]);
220 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
226 "// register the module first",
227 "Pman.on('beforeload', function()",
230 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
231 " module : " + b['|module'] + ",",
232 " region : '" + (b.region || '') +"',",
233 " parent : " + (b.parent || false) + ",",
234 " name : \"" + (b.name || "unnamed module") + "\"",
235 " disabled : " + disabled +" ",
240 b['|module'] + " = new Roo.util.Observable({",
243 " disabled : false,",
244 " parentLayout: false,",
246 " add : function(parentLayout, region)",
249 " var _this = this;", // standard avaialbe..
250 " this.parentLayout = parentLayout;",
252 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
253 " this.layout = this.panel.layout;",
265 getTree : function( o ) {