You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/10/18 07:43:30 UTC
[13/30] git commit: [flex-asjs] [refs/heads/develop] - teach
containerdatabinding to use constantbinding in more cases. Also fix single
watcher scenario
teach containerdatabinding to use constantbinding in more cases. Also fix single watcher scenario
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3f2ff22b
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3f2ff22b
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3f2ff22b
Branch: refs/heads/develop
Commit: 3f2ff22b3d4ff4b4c2daae6daff5c3e6880e56c3
Parents: 6bbb7cb
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 13 12:49:13 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Oct 17 22:38:44 2014 -0700
----------------------------------------------------------------------
.../apache/flex/core/ContainerDataBinding.as | 38 +++++++++++++++++---
1 file changed, 34 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3f2ff22b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as
index 3b2a2e0..6cbb0d4 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as
@@ -76,6 +76,7 @@ package org.apache.flex.core
{
var fieldWatcher:Object;
var sb:SimpleBinding;
+ var cb:ConstantBinding;
if (!("_bindings" in _strand))
return;
var bindingData:Array = _strand["_bindings"];
@@ -135,7 +136,7 @@ package org.apache.flex.core
}
else if (fieldWatcher.eventNames == null)
{
- var cb:ConstantBinding = new ConstantBinding();
+ cb = new ConstantBinding();
cb.destinationPropertyName = binding.destination[1];
cb.sourceID = binding.source[0];
cb.sourcePropertyName = binding.source[1];
@@ -164,7 +165,31 @@ package org.apache.flex.core
else if (binding.source is String)
{
fieldWatcher = watchers.watcherMap[binding.source];
- if (fieldWatcher.eventNames is String)
+ if (fieldWatcher == null)
+ {
+ cb = new ConstantBinding();
+ cb.destinationPropertyName = binding.destination[1];
+ cb.sourcePropertyName = binding.source;
+ cb.setDocument(_strand);
+ destObject = getProperty(_strand, binding.destination[0]);
+ destination = destObject as IStrand;
+ if (destination)
+ destination.addBead(cb);
+ else
+ {
+ if (destObject)
+ {
+ cb.destination = destObject;
+ _strand.addBead(sb);
+ }
+ else
+ {
+ deferredBindings[binding.destination[0]] = sb;
+ IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler);
+ }
+ }
+ }
+ else if (fieldWatcher.eventNames is String)
{
sb = new SimpleBinding();
sb.destinationPropertyName = binding.destination[1];
@@ -213,7 +238,12 @@ package org.apache.flex.core
for (var i:int = 0; i < n; i++)
{
var watcher:Object = watchers[i];
- if (watcher.bindings.indexOf(index) != -1)
+ var isValidWatcher:Boolean = false;
+ if (typeof(watcher.bindings) == "number")
+ isValidWatcher = (watcher.bindings == index);
+ else
+ isValidWatcher = (watcher.bindings.indexOf(index) != -1);
+ if (isValidWatcher)
{
var type:String = watcher.type;
switch (type)
@@ -238,7 +268,7 @@ package org.apache.flex.core
}
if (watcher.children)
{
- setupWatchers(gb, index, watcher.children, watcher.watcher);
+ setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
}
}
}