X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Builder%2FProvider%2FFile%2FRoo.js;h=db0d28da91201423e04412daaad5a45b8f2f6569;hb=ae36594d7a193ff1b695cf2fc09a66e4e34f8a6b;hp=534ef624403c80c9ee7bcdae4bff7471f6aa988a;hpb=24767743e279fc249b0a45c7b6fc711d8aa58867;p=app.Builder.js diff --git a/Builder/Provider/File/Roo.js b/Builder/Provider/File/Roo.js old mode 100755 new mode 100644 index 534ef6244..db0d28da9 --- a/Builder/Provider/File/Roo.js +++ b/Builder/Provider/File/Roo.js @@ -9,9 +9,9 @@ XObject = imports.XObject.XObject; //----------------------- our roo verison Base = imports.Builder.Provider.File.Base.Base; Gio = imports.gi.Gio; - +File = imports.File.File; -JSDOC = imports['JSDOC.js']; +//JSDOC = imports['JSDOC.js']; //----------------------- our roo verison var rid = 0; @@ -28,8 +28,9 @@ Roo = XObject.define( //console.dump(cfg); if (!cfg.name || !cfg.fullname ) { - cfg.name = cfg.path.split('/').pop().replace(/\.js$/, ''); - cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name; + cfg.name = cfg.path.split('/').pop().replace(/\.bjs$/, ''); + //cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name; + cfg.fullname = cfg.name; } @@ -64,7 +65,22 @@ Roo = XObject.define( }, Base, { - + doubleStringProps : [ + 'title', + 'legend', + 'loadingText', + 'emptyText', + 'qtip', + 'value', + 'text' + ], + modOrder : '001', /// sequence id that this uses. + region : 'center', + parent : '', + title : '', // the title on displayed when loading. + disable : '', // use a function to that returns false to disable this.. + permname: '', /// permission name + setNSID : function(id) { @@ -77,7 +93,8 @@ Roo = XObject.define( getType: function() { return 'Roo'; }, - + + loadItems : function(cb) { console.log("load Items!"); @@ -96,11 +113,17 @@ Roo = XObject.define( var cfg = JSON.parse(src); print("loaded data"); console.dump(cfg); - - _this.name = cfg.name; + _this.modOrder = cfg.modOrder || '001'; + _this.name = cfg.name.replace(/\.bjs/, ''); // BC! _this.parent = cfg.parent; + _this.permname = cfg.permname || ''; _this.title = cfg.title; _this.items = cfg.items || []; + + _this.fixItems(_this, false); + + + cb(); /* var tstream = new JSDOC.TextStream(src); @@ -133,29 +156,130 @@ Roo = XObject.define( }, - - - - toSource: function() + /** + * old code had broken xtypes and used arrays differently, + * this code should try and clean it up.. + * + * + */ + fixItems : function(node, fixthis) { - // dump the file tree back out to a string. - - if (typeof(this.items[0]['|module']) != 'undefined') { - return this.toSourceStdClass(); + if (fixthis) { + // fix xtype. + var fn = this.guessName(node); + //print("guessname got " + fn); + if (fn) { + var bits = fn.split('.'); + node.xtype = bits.pop(); + node['|xns'] = bits.join('.'); + + } + // fix array??? + + } - - if (this.items[0].region) { - return this.toSourceLayout(); + if (!node.items || !node.items.length) { + return; } - return this.toSourceDialog(); + var _this = this; + var aitems = []; + var nitems = []; + node.items.forEach(function(i) { + + + + _this.fixItems(i, true); + if (i.xtype == 'Array') { + aitems.push(i); + return; + } + nitems.push(i); + }); + node.items = nitems; + if (!aitems.length) { + return; + } + aitems.forEach(function(i) { + if (!i.items || !i.items.length) { + return; + } + var prop = i['*prop'] + '[]'; + // colModel to cm? + i.items.forEach(function(c) { + c['*prop'] = prop; + node.items.push(c); + }); - - + + }); + + + // array handling.. + + + + + + }, + + save : function() + { + Base.prototype.save.call(this); + // now write the js file.. + var js = this.path.replace(/\.bjs$/, '.js'); + var d = new Date(); + var js_src = this.toSource(); + print("TO SOURCE in " + ((new Date()) - d) + "ms"); + File.write(js, js_src); + + + + }, + /** + * convert xtype for munged output.. + * + */ + mungeXtype : function(xtype, els) + { + var bits = xtype.split('.'); + // assume it has lenght! + + els.push("xtype: '"+ bits.pop()+"'"); + els.push('xns: '+ bits.join('.')); + }, + + /** + * This needs to use some options on the project + * to determine how the file is output.. + * + * At present we are hard coding it.. + * + * + */ + toSource: function() + { + // dump the file tree back out to a string. + + // we have 2 types = dialogs and components + // + var top = this.guessName(this.items[0]); + if (!top) { + return false; + } + if (top.match(/Dialog/)) { + return this.toSourceDialog(); + } + return this.toSourceLayout(); + /* + eventually support 'classes??' + return this.toSourceStdClass(); + */ + }, outputHeader : function() @@ -163,20 +287,21 @@ Roo = XObject.define( return [ "//