/**
* @class Roo.XComponent
* A delayed Element creator...
+ * Or a way to group chunks of interface together.
*
* Mypart.xyx = new Roo.XComponent({
}
]
*})
+ *
+ *
+ * It can be used to build a big heiracy, with parent etc.
+ * or you can just use this to render a single compoent to a dom element
+ * MYPART.render(Roo.Element | String(id) | dom_element )
+ *
* @extends Roo.util.Observable
* @constructor
* @param cfg {Object} configuration of component
* String to display while loading.
*/
name : false,
+ /**
+ * @cfg {String} region
+ * Region to render component to (defaults to center)
+ */
+ region : 'center',
+
/**
* @cfg {Array} items
* A single item array - the first element is the root of the tree..
* It's done this way to stay compatible with the Xtype system...
*/
- items : false
+ items : false,
+
+
+ /**
+ * render
+ * render element to dom or tree
+ * @param {Roo.Element|String|DomElement} optional render to if parent is not set.
+ */
+
+ render : function(el)
+ {
+
+ if (!this.parent) {
+
+ el = el ? Roo.get(el) : false;
+
+
+ // it's a top level one..
+ this.parent = {
+ el : new Ext.BorderLayout(el || document.body, {
+
+ center: {
+ titlebar: false,
+ autoScroll:false,
+ closeOnTab: true,
+ tabPosition: 'top',
+ //resizeTabs: true,
+ alwaysShowTabs: el ? false : true,
+ minTabWidth: 140
+ }
+ })
+ }
+ }
+
+ var tree = this.tree();
+ tree.region = tree.region || this.region;
+ this.el = this.parent.el.addxtype(tree);
+ this.fireEvent('built', this);
+
+ this.panel = this.el;
+ this.layout = this.panel.layout;
+
+ }
+
Roo.debug && Roo.log('hide?');
Roo.MessageBox.hide();
_this.topModule.fireEvent('buildcomplete', _this.topModule);
- return;
+ return flase;
}
var m = mods.shift();
+
+
Roo.debug && Roo.log(m);
- if (typeof(m) == 'function') { // not sure if this is supported any more..
+ // not sure if this is supported any more.. - modules that are are just function
+ if (typeof(m) == 'function') {
m.call(this);
return progressRun.defer(10, _this);
}
+
+
Roo.MessageBox.updateProgress(
(total - mods.length)/total, "Building Interface " + (total - mods.length) +
" of " + total +
);
-
+ // is the module disabled?
var disabled = (typeof(m.disabled) == 'function') ?
m.disabled.call(m.module.disabled) : m.disabled;
return progressRun(); // we do not update the display!
}
- if (!m.parent) {
- // it's a top level one..
- var layoutbase = new Ext.BorderLayout(document.body, {
-
- center: {
- titlebar: false,
- autoScroll:false,
- closeOnTab: true,
- tabPosition: 'top',
- //resizeTabs: true,
- alwaysShowTabs: true,
- minTabWidth: 140
- }
- });
- var tree = m.tree();
- tree.region = 'center';
- m.el = layoutbase.addxtype(tree);
- m.panel = m.el;
- m.layout = m.panel.layout;
- return progressRun.defer(10, _this);
- }
-
- var tree = m.tree();
- tree.region = tree.region || m.region;
- m.el = m.parent.el.addxtype(tree);
- m.fireEvent('built', m);
- m.panel = m.el;
- m.layout = m.panel.layout;
- progressRun.defer(10, _this);
+ // now build
+ m.render();
+ // it's 10 on top level, and 1 on others??? why...
+ return progressRun.defer(10, _this);
+
}
progressRun.defer(1, _this);
}
+