From: Alan Knowles Date: Tue, 18 May 2010 15:26:14 +0000 (+0800) Subject: XObject.js X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=commitdiff_plain;h=53584dfafb0dbb766cd0ff8fc58b757a38773623 XObject.js --- diff --git a/XObject.js b/XObject.js index 6493d60d9..98c3cea2c 100644 --- a/XObject.js +++ b/XObject.js @@ -120,14 +120,16 @@ XObject.prototype = { */ init : function() { - + /* var items = []; this.items.forEach(function(i) { items.push(i); }); + this.items = []; + */ // remove items. this.listeners = this.listeners || {}; - this.items = []; + // do we need to call 'beforeInit here?' @@ -199,11 +201,12 @@ XObject.prototype = { // XObject.registry[o.xnsid] = XObject.registry[o.xnsid] || {}; // XObject.registry[o.xnsid][o.id] = this; //} + /* var _this=this; items.forEach(function(i) { _this.addItem(i); }) - + */ for (var i in this.listeners) { this.addListener(i, this.listeners[i]); @@ -221,7 +224,8 @@ XObject.prototype = { * uses pack property to determine how to add it. * @arg cfg {Object} same as XObject constructor. */ - addItem : function(o) { + addItem : function(o) + { if (typeof(o) == 'undefined') { print("Invalid Item added to this!"); imports.console.dump(this); @@ -230,7 +234,19 @@ XObject.prototype = { // what about extended items!?!?!? var item = (o.constructor == XObject) ? o : new XObject(o); item.parent = this; + + + + var items = []; + o.items.forEach(function(i) { + items.push(i); + }); + o.items = []; + + this.items.push(item); + + item.init(); //print("CTR:PROTO:" + ( item.id ? item.id : '??')); // print("addItem - call init [" + item.pack.join(',') + ']'); @@ -287,6 +303,14 @@ XObject.prototype = { this.el[pack_m].apply(this.el, args); } + + + items.forEach(function(i) { + o.addItem(i); + }) + + + },