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;
82 loadItems : function(cb)
84 console.log("load Items!");
85 if (this.items !== false) {
88 var file = Gio.file_new_for_path(this.path);
91 file.read_async(0, null, function(source,result) {
92 var stream = source.read_finish(result)
93 var dstream = new Gio.DataInputStream.c_new(stream);
95 var src = dstream.read_until("")
97 var cfg = JSON.parse(src);
101 _this.name = cfg.name;
102 _this.parent = cfg.parent;
103 _this.title = cfg.title;
104 _this.items = cfg.items || [];
107 var tstream = new JSDOC.TextStream(src);
108 var tr = new JSDOC.TokenReader( {
112 var toks = tr.tokenize(tstream);
113 var ts = new JSDOC.Collapse(toks);
114 //console.dump(ts.tokens);
115 var rd = new JSDOC.RooFile(ts.tokens);
120 _this.items = [ src ];
125 console.dump(rd.cfg);
126 //!!??? have we got engouth!
127 // try parsing self..
128 _this.items = [ rd.cfg ];
142 // dump the file tree back out to a string.
144 if (typeof(this.items[0]['|module']) != 'undefined') {
145 return this.toSourceStdClass();
148 if (this.items[0].region) {
149 return this.toSourceLayout();
151 return this.toSourceDialog();
162 outputHeader : function()
165 "//<script type=\"text/javascript\">",
167 "// Auto generated file - created by Builder Module - do not edit directly",
173 // a standard dialog module.
174 toSourceDialog : function()
176 var b = this.items[0];
177 var o = this.mungePropObj(this.items[0]);
180 b['|module'] + " = {",
185 " show : function(data, cb)",
187 " if (!this.dialog) {",
191 " this.callback = cb;",
192 " this.data = data;",
193 " this.dialog.show();",
195 " this.form.reset();",
196 " this.form.setValues(data);",
197 " this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });",
202 " create : function()",
204 " var _this = this;",
205 " this.dialog = Roo.factory(" + this.objectToJsString(o,3) + ");",
216 toSourceLayout : function()
218 var b = this.items[0];
219 var o = this.mungePropObj(this.items[0]);
221 var disabled = typeof(b['|disabled']) == 'undefined' ? (b.disabled || false) : b['disabled'];
227 "// register the module first",
228 "Pman.on('beforeload', function()",
231 " modKey : '" + (b.modkey || "000-unnumbered module") +"',",
232 " module : " + b['|module'] + ",",
233 " region : '" + (b.region || '') +"',",
234 " parent : " + (b.parent || false) + ",",
235 " name : \"" + (b.name || "unnamed module") + "\"",
236 " disabled : " + disabled +" ",
241 b['|module'] + " = new Roo.util.Observable({",
244 " disabled : false,",
245 " parentLayout: false,",
247 " add : function(parentLayout, region)",
250 " var _this = this;", // standard avaialbe..
251 " this.parentLayout = parentLayout;",
253 " this.panel = parentLayout.addxtype(" + this.objectToJsString(o,3) + ");",
254 " this.layout = this.panel.layout;",
264 guessName : function(ar) // turns the object into full name.
266 // eg. xns: Roo, xtype: XXX -> Roo.xxx
268 ret.push(typeof( ar['|xns'] ) == 'undefined' ? 'Roo' : ar['|xns'] );
272 if (typeof( ar['xtype'] ) == 'undefined' || !ar['xtype'].length) {
275 var xtype = ar['xtype'] + '';
276 if (xtype == '*') { // prefixes????
277 xtype = xtype.substring(1);
279 if (xtype.match(/^Roo/)) {
280 // already starts with roo...
284 return ret.join('.');
290 getTree : function( o ) {
296 getHelpUrl : function(cls)
298 return 'http://www.akbkhome.com/roojs1/docs/symbols/' + cls + '.html';