- /**
- * move modules into their correct place in the tree..
- *
- */
- preBuild : function ()
- {
- var modules = this.modules;
- this.modules = false;
-
- Roo.each(modules , function (obj)
- {
- obj.parent = this.toObject(obj.parent);
-
- if (!obj.parent) {
- this.topModule = obj;
- return;
- }
- obj.parent = toObject(obj.parent);
- if (!obj.parent.modules) {
- obj.parent.modules = new Roo.util.MixedCollection(false, function(o) { return o.order + '' });
- }
-
- obj.parent.modules.add(obj);
- }, this);
- }
-
-
- /**
- * Build the registered modules.
- * @param {Object} parent element.
- * @param {Function} optional method to call after module has been added.
- *
- */
-
- build : function(onCompleteFn)
- {
-
-
- var onComplete = function () {
- if (onCompleteFn) {
- onCompleteFn.call(this);
- }
- Roo.MessageBox.hide();
-
-
-
- }
- var _this = this;
- var cmp = function(a,b) {
- return String(a).toUpperCase() > String(b).toUpperCase() ? 1 : -1;
- };
-
- if (!parent.modules) {
- return;
- }
-
- // make a flat list in order of modules to build.
- var mods = [];
-
-
- // add modules to their parents..
- var addMod = function(m) {
- // console.log(m.modKey);
-
- mods.push(m);
- if (m.module.modules) {
- m.module.modules.keySort('ASC', cmp );
- m.module.modules.each(addMod);
- }
- if (m.finalize) {
- m.finalize.name = m.name + " (clean up) ";
- mods.push(m.finalize);
- }
-
- }
- parent.modules.keySort('ASC', cmp );
- parent.modules.each(addMod);
- //this.allmods = mods;
- //console.log(mods);
- //return;
- if (!mods.length) { // should not happen
- throw "NO modules!!!";
- }
- // flash it up as modal - so we store the mask!?
- Roo.MessageBox.show({ title: 'loading' });
- Roo.MessageBox.show({
- title: "Please wait...",
- msg: "Building Interface...",
- width:450,
- progress:true,
- closable:false,
- modal: false
-
- });
- var n = -1;
- var _this = this;
- var progressRun = function() {
- n++;
- if (n >= mods.length) {
- _this.topModule.fireEvent('built', _this.topModule);
- return;
- }
-
- var m = mods[n];
-
-
- Roo.MessageBox.updateProgress(
- (n+1)/mods.length, "Building Interface " + (n+1) +
- " of " + mods.length +
- (m.name ? (' - ' + m.name) : '')
- );
-
- if (typeof(m) == 'function') {
- m.call(this);
- progressRun.defer(10, _this);
- return;
- }
- var disabled = (typeof(m.module.disabled) == 'function') ?
- m.module.disabled.call(m.module.disabled) : m.module.disabled;
-
- }
-
- if (m.parent.layout && !disabled) {
- // modules have to support a 'add method'
- // should we just move that code into here..
- m.module.add(m.parent.layout, m.region);
- }
-
-
-
- }
- progressRun.defer(1, _this);
-
-
-
- }
-
-