diff options
author | Jose Antonio Marquez | 2012-04-20 10:44:02 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-04-20 10:44:02 -0700 |
commit | 0b7848540a7ca84b7c67821fedc275cf243eff2f (patch) | |
tree | a26b2986d412a02eb93fc7fa1b0f495cab40e757 /node_modules/montage/ui/component.js | |
parent | 154d1a8fdbbe050dbfc97cd13baa8981d8fc1e47 (diff) | |
parent | 8a546291a9d0de3bda1a7765ae9008f2ad052bba (diff) | |
download | ninja-0b7848540a7ca84b7c67821fedc275cf243eff2f.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
Diffstat (limited to 'node_modules/montage/ui/component.js')
-rwxr-xr-x | node_modules/montage/ui/component.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/node_modules/montage/ui/component.js b/node_modules/montage/ui/component.js index 69559fc1..17f87b62 100755 --- a/node_modules/montage/ui/component.js +++ b/node_modules/montage/ui/component.js | |||
@@ -136,23 +136,32 @@ var Component = exports.Component = Montage.create(Montage,/** @lends module:mon | |||
136 | }, | 136 | }, |
137 | set: function(value) { | 137 | set: function(value) { |
138 | if (value == null) { | 138 | if (value == null) { |
139 | console.log("Warning: Tried to set element of ", this, " as " + value + "."); | 139 | console.warn("Tried to set element of ", this, " to ", value); |
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | 142 | ||
143 | this.eventManager.registerEventHandlerForElement(this, value); | ||
144 | |||
145 | if (this.isDeserializing) { | 143 | if (this.isDeserializing) { |
144 | this.eventManager.registerEventHandlerForElement(this, value); | ||
145 | |||
146 | // if this component has a template and has been already instantiated then assume the value is the template. | 146 | // if this component has a template and has been already instantiated then assume the value is the template. |
147 | if (this._isTemplateInstantiated) { | 147 | if (this._isTemplateInstantiated) { |
148 | this._templateElement = value; | 148 | // this is important for component extension, we don't want to override template element |
149 | if (!this._templateElement) { | ||
150 | this._templateElement = value; | ||
151 | } | ||
149 | } else { | 152 | } else { |
150 | this._element = value; | 153 | this._element = value; |
151 | if (!this.blockDrawGate.value && this._element) { | 154 | if (!this.blockDrawGate.value && this._element) { |
152 | this.blockDrawGate.setField("element", true); | 155 | this.blockDrawGate.setField("element", true); |
153 | } | 156 | } |
154 | } | 157 | } |
158 | } else if (!this._firstDraw) { | ||
159 | // If a draw has happened then at some point the element has been set | ||
160 | console.error("Cannot change element of ", this, " after it has been set"); | ||
161 | return; | ||
155 | } else { | 162 | } else { |
163 | this.eventManager.registerEventHandlerForElement(this, value); | ||
164 | |||
156 | this._element = value; | 165 | this._element = value; |
157 | if (!this.blockDrawGate.value && this._element) { | 166 | if (!this.blockDrawGate.value && this._element) { |
158 | this.blockDrawGate.setField("element", true); | 167 | this.blockDrawGate.setField("element", true); |
@@ -614,9 +623,9 @@ var Component = exports.Component = Montage.create(Montage,/** @lends module:mon | |||
614 | } | 623 | } |
615 | }, | 624 | }, |
616 | 625 | ||
617 | serializeSelf: { | 626 | serializeProperties: { |
618 | value: function(serializer, propertyNames) { | 627 | value: function(serializer) { |
619 | serializer.setProperties(propertyNames); | 628 | serializer.setAll(); |
620 | var childComponents = this.childComponents; | 629 | var childComponents = this.childComponents; |
621 | for (var i = 0, l = childComponents.length; i < l; i++) { | 630 | for (var i = 0, l = childComponents.length; i < l; i++) { |
622 | serializer.addObject(childComponents[i]); | 631 | serializer.addObject(childComponents[i]); |