1 //<Script type="text/javascript">
2 console = imports['console.js'];
3 Roo = imports['Roo.js'];
7 Builder = imports['Builder.js'];
8 JSDOC = imports['JSDOC.js'];
9 //----------------------- our roo verison
13 Builder.Provider.File.Roo = function(cfg) {
16 //"name":"Edit Module Details",
18 //"btype":"FORM", // was to be components...
20 //"module":"Pman.Tab.BuilderTop2"
23 if (!cfg.name || !cfg.fullname ) {
24 cfg.name = cfg.path.split('/').pop().replace(/\.js$/, '');
25 cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
31 var jstr = JSON.parse(cfg.json);
32 this.items = [ jstr ];
33 //console.log(cfg.items.length);
34 delete cfg.json; // not needed!
38 var p = cfg.items && cfg.items.length && cfg.items[0].parent ? cfg.items[0].parent : false;
40 // ensure real data is set...
51 Builder.Provider.File.Roo.superclass.constructor.call(this, cfg);
56 // various loader methods..
60 Roo.extend(Builder.Provider.File.Roo, Builder.Provider.File, {
61 setNSID : function(id)
64 this.items[0]['|module'] = id;
69 loadItems : function(cb)
71 console.log("load Items!");
72 if (this.items.length) {
75 var file = Gio.file_new_for_path(this.path);
78 file.read_async(0, null, function(source,result) {
79 var stream = source.read_finish(result)
80 var dstream = new Gio.DataInputStream.c_new(stream);
82 var src = dstream.read_until("")
83 var tstream = new JSDOC.TextStream(src);
84 var tr = new JSDOC.TokenReader( {
88 var toks = tr.tokenize(tstream);
89 var ts = new JSDOC.Collapse(toks);
90 //console.dump(ts.tokens);
91 var rd = new JSDOC.RooFile(ts.tokens);
96 _this.items = [ src ];
101 console.dump(rd.cfg);
102 //!!??? have we got engouth!
103 // try parsing self..
104 _this.items = [ rd.cfg ];
118 // dump the file tree back out to a string.
120 if (typeof(this.items[0]['|module']) != 'undefined') {
121 return this.toSourceStdClass();
124 if (this.items[0].region) {
125 return this.toSourceLayout();
127 return this.toSourceDialog();
138 outputHeader : function()
141 "//<script type=\"text/javascript\">",
143 "// Auto generated file - created by Builder Module - do not edit directly",
149 // a standard dialog module.
150 toSourceDialog : function()
152 var b = this.items[0];
153 var o = this.mungePropObj(this.items[0]);
156 b['|module'] + " = {",
161 " show : function(data, cb)",
163 " if (!this.dialog) {",
167 " this.callback = cb;",
168 " this.data = data;",
169 " this.dialog.show();",
171 " this.form.reset();",
172 " this.form.setValues(data);",
173 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
178 " create : function()",
180 " var _this = this;",
181 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
192 toSourceLayout : function()
194 var b = this.items[0];
195 var o = this.mungePropObj(this.items[0]);
197 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
203 "// register the module first",
204 "Pman.on('beforeload', function()",
207 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
208 " module : " + b['|module'] + ",",
209 " region : '" + (b.region || '') +"',",
210 " parent : " + (b.parent || false) + ",",
211 " name : \"" + (b.name || "unnamed module") + "\"",
212 " disabled : " + disabled +" ",
217 b['|module'] + " = new Roo.util.Observable({",
220 " disabled : false,",
221 " parentLayout: false,",
223 " add : function(parentLayout, region)",
226 " var _this = this;", // standard avaialbe..
227 " this.parentLayout = parentLayout;",
229 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
230 " this.layout = this.panel.layout;",
242 getTree : function( o ) {