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 == 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);
97 '*parent' : cfg.parent,
103 var tstream = new JSDOC.TextStream(src);
104 var tr = new JSDOC.TokenReader( {
108 var toks = tr.tokenize(tstream);
109 var ts = new JSDOC.Collapse(toks);
110 //console.dump(ts.tokens);
111 var rd = new JSDOC.RooFile(ts.tokens);
116 _this.items = [ src ];
121 console.dump(rd.cfg);
122 //!!??? have we got engouth!
123 // try parsing self..
124 _this.items = [ rd.cfg ];
138 // dump the file tree back out to a string.
140 if (typeof(this.items[0]['|module']) != 'undefined') {
141 return this.toSourceStdClass();
144 if (this.items[0].region) {
145 return this.toSourceLayout();
147 return this.toSourceDialog();
158 outputHeader : function()
161 "//<script type=\"text/javascript\">",
163 "// Auto generated file - created by Builder Module - do not edit directly",
169 // a standard dialog module.
170 toSourceDialog : function()
172 var b = this.items[0];
173 var o = this.mungePropObj(this.items[0]);
176 b['|module'] + " = {",
181 " show : function(data, cb)",
183 " if (!this.dialog) {",
187 " this.callback = cb;",
188 " this.data = data;",
189 " this.dialog.show();",
191 " this.form.reset();",
192 " this.form.setValues(data);",
193 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
198 " create : function()",
200 " var _this = this;",
201 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
212 toSourceLayout : function()
214 var b = this.items[0];
215 var o = this.mungePropObj(this.items[0]);
217 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
223 "// register the module first",
224 "Pman.on('beforeload', function()",
227 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
228 " module : " + b['|module'] + ",",
229 " region : '" + (b.region || '') +"',",
230 " parent : " + (b.parent || false) + ",",
231 " name : \"" + (b.name || "unnamed module") + "\"",
232 " disabled : " + disabled +" ",
237 b['|module'] + " = new Roo.util.Observable({",
240 " disabled : false,",
241 " parentLayout: false,",
243 " add : function(parentLayout, region)",
246 " var _this = this;", // standard avaialbe..
247 " this.parentLayout = parentLayout;",
249 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
250 " this.layout = this.panel.layout;",
262 getTree : function( o ) {