flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/develop] - allow for getters of the correct datatype that wrap the data object
Date Sat, 10 Dec 2016 07:34:31 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop a26107575 -> 9bd0b05f6


allow for getters of the correct datatype that wrap the data object


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/024626e8
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/024626e8
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/024626e8

Branch: refs/heads/develop
Commit: 024626e8ad1261b9044c2d2552fd9d145e20f13c
Parents: a261075
Author: Alex Harui <aharui@apache.org>
Authored: Fri Dec 9 23:31:20 2016 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Dec 9 23:31:20 2016 -0800

----------------------------------------------------------------------
 .../flex/binding/ItemRendererDataBinding.as     | 76 +++++++++++++++++---
 1 file changed, 67 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/024626e8/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ItemRendererDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ItemRendererDataBinding.as
b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ItemRendererDataBinding.as
index 48afdba..ac54206 100644
--- a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ItemRendererDataBinding.as
+++ b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ItemRendererDataBinding.as
@@ -72,6 +72,7 @@ package org.apache.flex.binding
             var fieldWatcher:Object;
             var isStatic:Boolean;
             var sb:SimpleBinding;
+            var cb:ConstantBinding;
             if (!("_bindings" in _strand))
                 return;
             var bindingData:Array = _strand["_bindings"];
@@ -126,17 +127,74 @@ package org.apache.flex.binding
                         }
                     }
                 }
-                else
-                if (binding.source is Array
-                        && binding.source[0] == "data"
+                else if (binding.source is Array
                         && binding.source.length == 2 && binding.destination.length
== 2)
                 {
-                    var irsb:ItemRendererSimpleBinding = new ItemRendererSimpleBinding();
-                    irsb.destinationID = binding.destination[0];
-                    irsb.destinationPropertyName = binding.destination[1];
-                    irsb.sourcePropertyName = binding.source[1];
-                    irsb.setDocument(_strand);
-                    _strand.addBead(irsb);
+                    var compWatcher:Object;
+                    compWatcher = watchers.watcherMap[binding.source[0]];
+                    fieldWatcher = compWatcher.children.watcherMap[binding.source[1]];
+                    if (binding.source[0] == "data" ||
+                            (compWatcher.eventNames is String
+                            && compWatcher.eventNames == "dataChange"))
+                    {
+                        var irsb:ItemRendererSimpleBinding = new ItemRendererSimpleBinding();
+                        irsb.destinationID = binding.destination[0];
+                        irsb.destinationPropertyName = binding.destination[1];
+                        irsb.sourcePropertyName = binding.source[1];
+                        irsb.setDocument(_strand);
+                        _strand.addBead(irsb);
+                    }
+                    else if (fieldWatcher.eventNames is String)
+                    {
+                        sb = new SimpleBinding();
+                        sb.destinationPropertyName = binding.destination[1];
+                        sb.eventName = fieldWatcher.eventNames as String;
+                        sb.sourceID = binding.source[0];
+                        sb.sourcePropertyName = binding.source[1];
+                        sb.setDocument(_strand);
+                        destObject = _strand[binding.destination[0]];                   
            
+                        destination = destObject as IStrand;
+                        if (destination)
+                            destination.addBead(sb);
+                        else
+                        {
+                            if (destObject)
+                            {
+                                sb.destination = destObject;
+                                _strand.addBead(sb);
+                            }
+                            else
+                            {
+                                deferredBindings[binding.destination[0]] = sb;
+                                IEventDispatcher(_strand).addEventListener("valueChange",
deferredBindingsHandler);
+                            }
+                        }
+                    }
+                    else if (fieldWatcher.eventNames == null)
+                    {
+                        cb = new ConstantBinding();
+                        cb.destinationPropertyName = binding.destination[1];
+                        cb.sourceID = binding.source[0];
+                        cb.sourcePropertyName = binding.source[1];
+                        cb.setDocument(_strand);
+                        destObject = _strand[binding.destination[0]];                   
            
+                        destination = destObject as IStrand;
+                        if (destination)
+                            destination.addBead(cb);
+                        else
+                        {
+                            if (destObject)
+                            {
+                                cb.destination = destObject;
+                                _strand.addBead(cb);
+                            }
+                            else
+                            {
+                                deferredBindings[binding.destination[0]] = cb;
+                                IEventDispatcher(_strand).addEventListener("valueChange",
deferredBindingsHandler);
+                            }
+                        }
+                    }
                 }
                 else
                 {


Mime
View raw message