diff options
author | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-18 13:48:51 -0700 |
commit | 2e04af953463643791f6362bd8ef4c6ba190abfa (patch) | |
tree | d07aaf646091ddf9dad5b030a7905055fd323490 /node_modules/montage/core/event/binding.js | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-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/core/event/binding.js')
-rwxr-xr-x | node_modules/montage/core/event/binding.js | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/node_modules/montage/core/event/binding.js b/node_modules/montage/core/event/binding.js index 21b40609..709a5d85 100755 --- a/node_modules/montage/core/event/binding.js +++ b/node_modules/montage/core/event/binding.js | |||
@@ -18,6 +18,7 @@ var Montage = require("montage").Montage, | |||
18 | ChangeTypes = require("core/event/mutable-event").ChangeTypes, | 18 | ChangeTypes = require("core/event/mutable-event").ChangeTypes, |
19 | Serializer = require("core/serializer").Serializer, | 19 | Serializer = require("core/serializer").Serializer, |
20 | Deserializer = require("core/deserializer").Deserializer, | 20 | Deserializer = require("core/deserializer").Deserializer, |
21 | logger = require("core/logger").logger("binding"); | ||
21 | defaultEventManager = require("core/event/event-manager").defaultEventManager, | 22 | defaultEventManager = require("core/event/event-manager").defaultEventManager, |
22 | AT_TARGET = 2, | 23 | AT_TARGET = 2, |
23 | UNDERSCORE = "_"; | 24 | UNDERSCORE = "_"; |
@@ -1184,11 +1185,14 @@ var BindingDescriptor = exports.BindingDescriptor = Montage.create(Montage, /** | |||
1184 | }, | 1185 | }, |
1185 | 1186 | ||
1186 | serializeSelf: {value: function(serializer) { | 1187 | serializeSelf: {value: function(serializer) { |
1187 | serializer.setReference("boundObject", this.boundObject); | 1188 | var serialization = {}; |
1188 | serializer.set("boundObjectPropertyPath", this.boundObjectPropertyPath); | 1189 | |
1189 | serializer.set("oneway", this.oneway); | 1190 | serializer.addObjectReference(this.boundObject); |
1190 | serializer.set("deferred", this.deferred); | 1191 | serialization[this.oneway ? "<-" : "<<->"] = "@" + serializer.getObjectLabel(this.boundObject) + "." + this.boundObjectPropertyPath; |
1191 | serializer.set("converter", this.converter); | 1192 | serialization.deferred = this.deferred; |
1193 | serialization.converter = this.converter; | ||
1194 | |||
1195 | return serialization; | ||
1192 | }} | 1196 | }} |
1193 | }); | 1197 | }); |
1194 | 1198 | ||
@@ -1200,10 +1204,36 @@ Serializer.defineSerializationUnit("bindings", function(object) { | |||
1200 | } | 1204 | } |
1201 | }); | 1205 | }); |
1202 | 1206 | ||
1203 | Deserializer.defineDeserializationUnit("bindings", function(object, bindings) { | 1207 | Deserializer.defineDeserializationUnit("bindings", function(object, bindings, deserializer) { |
1204 | var sourcePath; | 1208 | for (var sourcePath in bindings) { |
1205 | for (sourcePath in bindings) { | 1209 | var binding = bindings[sourcePath], |
1206 | Object.defineBinding(object, sourcePath, bindings[sourcePath]); | 1210 | dotIndex; |
1211 | |||
1212 | if (!("boundObject" in binding)) { | ||
1213 | var targetPath = binding["<-"] || binding["->"] || binding["<->>"] || binding["<<->"]; | ||
1214 | |||
1215 | if (targetPath[0] !== "@") { | ||
1216 | logger.error("Invalid binding syntax '" + targetPath + "', should be in the form of '@label.path'."); | ||
1217 | throw "Invalid binding syntax '" + targetPath + "'"; | ||
1218 | } | ||
1219 | if ("->" in binding || "<->>" in binding) { | ||
1220 | binding.boundObject = object; | ||
1221 | binding.boundObjectPropertyPath = sourcePath; | ||
1222 | |||
1223 | dotIndex = targetPath.indexOf("."); | ||
1224 | object = deserializer.getObjectByLabel(targetPath.slice(1, dotIndex)); | ||
1225 | sourcePath = targetPath.slice(dotIndex+1); | ||
1226 | } else { | ||
1227 | dotIndex = targetPath.indexOf("."); | ||
1228 | binding.boundObject = deserializer.getObjectByLabel(targetPath.slice(1, dotIndex)); | ||
1229 | binding.boundObjectPropertyPath = targetPath.slice(dotIndex+1); | ||
1230 | } | ||
1231 | |||
1232 | if ("<-" in binding || "->" in binding) { | ||
1233 | binding.oneway = true; | ||
1234 | } | ||
1235 | } | ||
1236 | Object.defineBinding(object, sourcePath, binding); | ||
1207 | } | 1237 | } |
1208 | }); | 1238 | }); |
1209 | 1239 | ||