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;
79 loadItems : function(cb)
81 console.log("load Items!");
82 if (this.items !== false) {
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("")
94 var cfg = JSON.parse(src);
98 _this.name = cfg.name;
99 _this.parent = cfg.parent;
100 _this.title = cfg.title;
101 _this.items = cfg.items || [];
104 var tstream = new JSDOC.TextStream(src);
105 var tr = new JSDOC.TokenReader( {
109 var toks = tr.tokenize(tstream);
110 var ts = new JSDOC.Collapse(toks);
111 //console.dump(ts.tokens);
112 var rd = new JSDOC.RooFile(ts.tokens);
117 _this.items = [ src ];
122 console.dump(rd.cfg);
123 //!!??? have we got engouth!
124 // try parsing self..
125 _this.items = [ rd.cfg ];
139 // dump the file tree back out to a string.
141 if (typeof(this.items[0]['|module']) != 'undefined') {
142 return this.toSourceStdClass();
145 if (this.items[0].region) {
146 return this.toSourceLayout();
148 return this.toSourceDialog();
159 outputHeader : function()
162 "//<script type=\"text/javascript\">",
164 "// Auto generated file - created by Builder Module - do not edit directly",
170 // a standard dialog module.
171 toSourceDialog : function()
173 var b = this.items[0];
174 var o = this.mungePropObj(this.items[0]);
177 b['|module'] + " = {",
182 " show : function(data, cb)",
184 " if (!this.dialog) {",
188 " this.callback = cb;",
189 " this.data = data;",
190 " this.dialog.show();",
192 " this.form.reset();",
193 " this.form.setValues(data);",
194 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
199 " create : function()",
201 " var _this = this;",
202 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
213 toSourceLayout : function()
215 var b = this.items[0];
216 var o = this.mungePropObj(this.items[0]);
218 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
224 "// register the module first",
225 "Pman.on('beforeload', function()",
228 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
229 " module : " + b['|module'] + ",",
230 " region : '" + (b.region || '') +"',",
231 " parent : " + (b.parent || false) + ",",
232 " name : \"" + (b.name || "unnamed module") + "\"",
233 " disabled : " + disabled +" ",
238 b['|module'] + " = new Roo.util.Observable({",
241 " disabled : false,",
242 " parentLayout: false,",
244 " add : function(parentLayout, region)",
247 " var _this = this;", // standard avaialbe..
248 " this.parentLayout = parentLayout;",
250 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
251 " this.layout = this.panel.layout;",
263 getTree : function( o ) {