aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/component.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-18 13:48:51 -0700
committerValerio Virgillito2012-04-18 13:48:51 -0700
commit2e04af953463643791f6362bd8ef4c6ba190abfa (patch)
treed07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/ui/component.js
parent616a8532099fec2a15855eac97cd85cb60c4451c (diff)
downloadninja-2e04af953463643791f6362bd8ef4c6ba190abfa.tar.gz
Squashed commit of the following:
commit 2054551bfb01a0f4ca2e138b9d724835462d45cd Merge: 765c2da 616a853 Author: Valerio Virgillito <valerio@motorola.com> Date: Wed Apr 18 13:48:21 2012 -0700 Merge branch 'refs/heads/master' into integration commit 765c2da8e1aa03550caf42b2bd5f367555ad2843 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 17 15:29:41 2012 -0700 updating the picasa carousel Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 9484f1c82b81e27edf2dc0a1bcc1fa3b12077406 Merge: d27f2df cacb4a2 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 17 15:03:50 2012 -0700 Merge branch 'refs/heads/master' into integration commit d27f2df4d846064444263d7832d213535962abe7 Author: Valerio Virgillito <valerio@motorola.com> Date: Wed Apr 11 10:39:36 2012 -0700 integrating new picasa carousel component Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 6f98384c9ecbc8abe55ccfe1fc25a0c7ce22c493 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Apr 10 14:33:00 2012 -0700 fixed the text area case issue Text area was renamed from TextArea to Textarea Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 1e83e26652266136802bc7af930379c1ecd631a6 Author: Valerio Virgillito <valerio@motorola.com> Date: Mon Apr 9 22:10:45 2012 -0700 integrating montage v0.8 into ninja. Signed-off-by: Valerio Virgillito <valerio@motorola.com> Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/component.js')
-rwxr-xr-xnode_modules/montage/ui/component.js23
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]);