diff options
author | Eric Guzman | 2012-04-23 11:55:55 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-23 11:55:55 -0700 |
commit | cdd1189e349e2974681e2c451e861e5b0db570e4 (patch) | |
tree | d8823c3d050e011032c563d20c1a5f61e67ae740 /node_modules/montage/ui/component.js | |
parent | c0fce534c255ef1e25779e2f0e8de95bb4e160cf (diff) | |
parent | 5a0331fc26fcc2cdc6200086109e34440a2dec6a (diff) | |
download | ninja-cdd1189e349e2974681e2c451e861e5b0db570e4.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
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]); |