You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/12/14 11:24:08 UTC
[royale-asjs] branch develop updated: binding: fix #622
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 2212456 binding: fix #622
2212456 is described below
commit 22124566adc7620272f7c984a908f3fac5c55b83
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Dec 14 12:23:56 2019 +0100
binding: fix #622
---
.../org/apache/royale/binding/DataBindingBase.as | 61 +++++++++++++---------
.../org/apache/royale/binding/GenericBinding.as | 2 +-
.../org/apache/royale/binding/PropertyWatcher.as | 25 ++++++++-
3 files changed, 62 insertions(+), 26 deletions(-)
diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
index 90d244d..83967d8 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
@@ -156,6 +156,8 @@ package org.apache.royale.binding
var hasWatcherChildren:Boolean = watcherChildrenRelevantToIndex(watcher.children, index);
var type:String = watcher.type as String;
var parentObj:Object = _strand;
+ var processWatcher:Boolean = false;
+ var pw:PropertyWatcher;
switch (type)
{
case "static":
@@ -173,36 +175,47 @@ package org.apache.royale.binding
{
getterFunction = gb.source as Function;
}
-
- var pw:PropertyWatcher = new PropertyWatcher(_strand,
+ pw = new PropertyWatcher(_strand,
watcher.propertyName,
watcher.eventNames,
getterFunction);
- watcher.watcher = pw;
- if (parentWatcher)
- {
- pw.parentChanged(parentWatcher.value);
- }
- else
- {
- pw.parentChanged(parentObj);
- }
-
- if (parentWatcher)
- {
- parentWatcher.addChild(pw);
- }
-
- if (!hasWatcherChildren)
- {
- pw.addBinding(gb);
- }
-
- foundWatcher = true;
+ processWatcher = true;
+ break;
+ }
+ case 'function': {
+ pw = new PropertyWatcher(_strand,
+ watcher.propertyName,
+ watcher.eventNames, null);
+ pw.funcProps = {};
+ pw.funcProps.functionName = watcher.functionName;
+ pw.funcProps.paramFunction = watcher.paramFunction;
+ processWatcher = true;
break;
}
}
-
+ if (processWatcher)
+ {
+ foundWatcher = true;
+ watcher.watcher = pw;
+ if (parentWatcher)
+ {
+ pw.parentChanged(parentWatcher.value);
+ }
+ else
+ {
+ pw.parentChanged(parentObj);
+ }
+
+ if (parentWatcher)
+ {
+ parentWatcher.addChild(pw);
+ }
+ if (!hasWatcherChildren)
+ {
+ pw.addBinding(gb);
+ }
+ }
+
if (hasWatcherChildren)
{
setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/GenericBinding.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/GenericBinding.as
index 66eac7a..42f354a 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/GenericBinding.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/GenericBinding.as
@@ -123,7 +123,7 @@ package org.apache.royale.binding
* @productversion Royale 0.0
*/
public var isStatic:Boolean;
- public var staticRoot:Object
+ public var staticRoot:Object;
/**
* @copy org.apache.royale.core.IBead#strand
diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/PropertyWatcher.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/PropertyWatcher.as
index 65b95a2..96f3645 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/PropertyWatcher.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/PropertyWatcher.as
@@ -124,6 +124,17 @@ package org.apache.royale.binding
* @productversion Royale 0.0
*/
public var getterFunction:Function;
+
+
+ /**
+ * Support for function return binding on a chain
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public var funcProps:Object;
/**
* The event handler that gets called when
@@ -231,7 +242,19 @@ package org.apache.royale.binding
}
else
{
- if (getterFunction != null)
+ if (funcProps != null) {
+ if (funcProps.functionGetter != null)
+ {
+ value = funcProps.functionGetter(funcProps.functionName).apply(source,
+ funcProps.paramFunction.apply(document));
+ }
+ else
+ {
+ value = source[funcProps.functionName].apply(source,
+ funcProps.paramFunction.apply(document));
+ }
+ }
+ else if (getterFunction != null)
{
try
{