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/09/25 18:04:32 UTC

[50/50] git commit: [flex-asjs] [refs/heads/develop] - add platform abstraction so databinding impls can cross-compile

add platform abstraction so databinding impls can cross-compile


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

Branch: refs/heads/develop
Commit: 0fba10b8c4af9663128c2d29c9f53cab21281b50
Parents: 00402c8
Author: Alex Harui <ah...@apache.org>
Authored: Thu Sep 25 08:36:52 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Sep 25 08:36:52 2014 -0700

----------------------------------------------------------------------
 .../flex/core/MXMLBeadViewBaseDataBinding.as    |  8 +--
 .../as/projects/FlexJSUI/src/FlexJSUIClasses.as |  3 +-
 .../src/org/apache/flex/core/DataBindingBase.as | 70 ++++++++++++++++++++
 .../src/org/apache/flex/core/DataBindingBase.js | 65 ++++++++++++++++++
 4 files changed, 141 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0fba10b8/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as
index 4ba80ea..18d6f05 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as
@@ -41,7 +41,7 @@ package org.apache.flex.core
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public class MXMLBeadViewBaseDataBinding implements IBead
+	public class MXMLBeadViewBaseDataBinding extends DataBindingBase implements IBead
 	{
         /**
          *  Constructor.
@@ -114,7 +114,7 @@ package org.apache.flex.core
                                 sb.sourceID = binding.source[0];
                                 sb.sourcePropertyName = binding.source[1];
                                 sb.setDocument(_strand);
-                                destObject = MXMLBeadViewBase(_strand)[binding.destination[0]];                                
+                                destObject = getProperty(_strand, binding.destination[0]);                                
                                 destination = destObject as IStrand;
                                 if (destination)
                                     destination.addBead(sb);
@@ -139,7 +139,7 @@ package org.apache.flex.core
                                 cb.sourceID = binding.source[0];
                                 cb.sourcePropertyName = binding.source[1];
                                 cb.setDocument(_strand);
-                                destObject = MXMLBeadViewBase(_strand)[binding.destination[0]];                                
+                                destObject = getProperty(_strand, binding.destination[0]);                                
                                 destination = destObject as IStrand;
                                 if (destination)
                                     destination.addBead(cb);
@@ -170,7 +170,7 @@ package org.apache.flex.core
                         sb.eventName = fieldWatcher.eventNames as String;
                         sb.sourcePropertyName = binding.source;
                         sb.setDocument(_strand);
-                        destObject = MXMLBeadViewBase(_strand)[binding.destination[0]];                                
+                        destObject = getProperty(_strand, binding.destination[0]);                                
                         destination = destObject as IStrand;
                         if (destination)
                             destination.addBead(sb);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0fba10b8/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 4d2f225..358795e 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -126,7 +126,8 @@ internal class FlexJSUIClasses
 	import org.apache.flex.core.graphics.GraphicsContainer; GraphicsContainer;
 	import org.apache.flex.core.graphics.LinearGradient; LinearGradient;
     import org.apache.flex.core.DropType; DropType;
-    import org.apache.flex.effects.PlatformWiper; PlatformWiper;
+    import org.apache.flex.core.DataBindingBase; DataBindingBase;
+    import org.apache.flex.effects.PlatformWiper; PlatformWiper;    
     
 	import mx.core.ClassFactory; ClassFactory;
     import mx.states.AddItems; AddItems;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0fba10b8/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as
new file mode 100644
index 0000000..5614d41
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+    /**
+     *  The DataBindingBase class is the base class for custom data binding
+     *  implementations that can be cross-compiled.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class DataBindingBase
+	{
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function DataBindingBase()
+		{
+		}
+		
+        /**
+         *  Get a property from an object.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected function getProperty(obj:Object, propName:String):*
+        {
+            return obj[propName];
+        }
+        
+        /**
+         *  Set a property on an object.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected function setProperty(obj:Object, propName:String, value:*):void
+        {
+            obj[propName] = value;
+        }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0fba10b8/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js
new file mode 100644
index 0000000..75313c3
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js
@@ -0,0 +1,65 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.core.DataBindingBase');
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.core.DataBindingBase = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.DataBindingBase.prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'DataBindingBase',
+                qName: 'org.apache.flex.core.DataBindingBase'}] };
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @return {Object} value The value of the property.
+ */
+org.apache.flex.core.DataBindingBase.prototype.getProperty =
+    function(obj, propName) {
+  if (typeof obj['get_' + propName] === 'function') {
+    return obj['get_' + propName]();
+  }
+  return obj[propName];
+};
+
+
+/**
+ * @expose
+ * @param {Object} obj The object.
+ * @param {string} propName The name of the property.
+ * @param {Object} value The value of the property.
+ */
+org.apache.flex.core.DataBindingBase.prototype.setProperty =
+function(obj, propName, value) {
+  if (typeof obj['set_' + propName] === 'function') {
+    obj['set_' + propName](value);
+  } else {
+    obj[propName] = value;
+  }
+};
+