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 2015/11/04 20:47:45 UTC
[1/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - move asjs
to as
Repository: flex-asjs
Updated Branches:
refs/heads/core_js_to_as 3a3efe9a3 -> 4b60eaa11
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as b/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
deleted file mode 100644
index 5d35cea..0000000
--- a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
+++ /dev/null
@@ -1,333 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.binding
-{
- import org.apache.flex.binding.ConstantBinding;
- import org.apache.flex.binding.GenericBinding;
- import org.apache.flex.binding.PropertyWatcher;
- import org.apache.flex.binding.SimpleBinding;
- import org.apache.flex.binding.WatcherBase;
- import org.apache.flex.core.DataBindingBase;
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The ViewBaseDataBinding class implements databinding for
- * ViewBase instances. Different classes can have
- * different databinding implementation that optimize for
- * the different lifecycles. For example, an item renderer
- * databinding implementation can wait to execute databindings
- * until the data property is set.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class MXMLBeadViewBaseDataBinding extends DataBindingBase implements IBead
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function MXMLBeadViewBaseDataBinding()
- {
- super();
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler);
- }
-
- private function initCompleteHandler(event:Event):void
- {
- var fieldWatcher:Object;
- var sb:SimpleBinding;
- if (!("_bindings" in _strand))
- return;
- var bindingData:Array = _strand["_bindings"];
- var n:int = bindingData[0];
- var bindings:Array = [];
- var i:int;
- var index:int = 1;
- for (i = 0; i < n; i++)
- {
- var binding:Object = {};
- binding.source = bindingData[index++];
- binding.destFunc = bindingData[index++];
- binding.destination = bindingData[index++];
- bindings.push(binding);
- }
- var watchers:Object = decodeWatcher(bindingData.slice(index));
- for (i = 0; i < n; i++)
- {
- binding = bindings[i];
- if (binding.source is Array)
- {
- if (binding.source[0] in _strand)
- {
- if (binding.source.length == 2 && binding.destination.length == 2)
- {
- var destObject:Object;
- var destination:IStrand;
- // can be simplebinding or constantbinding
- var modelWatcher:Object = watchers.watcherMap[binding.source[0]];
- fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]];
- 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)
- {
- var cb:ConstantBinding = 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 if (binding.source is String)
- {
- fieldWatcher = watchers.watcherMap[binding.source];
- if (fieldWatcher.eventNames is String)
- {
- sb = new SimpleBinding();
- sb.destinationPropertyName = binding.destination[1];
- sb.eventName = fieldWatcher.eventNames as String;
- sb.sourcePropertyName = binding.source;
- 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
- {
- makeGenericBinding(binding, i, watchers);
- }
- }
- }
-
- private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
- {
- var gb:GenericBinding = new GenericBinding();
- gb.setDocument(_strand);
- gb.destinationData = binding.destination;
- gb.destinationFunction = binding.destFunc;
- gb.source = binding.source;
- setupWatchers(gb, index, watchers.watchers, null);
- }
-
- private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
- {
- var n:int = watchers.length;
- for (var i:int = 0; i < n; i++)
- {
- var watcher:Object = watchers[i];
- 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)
- {
- case "property":
- {
- var pw:PropertyWatcher = new PropertyWatcher(this,
- watcher.propertyName,
- watcher.eventNames,
- watcher.getterFunction);
- watcher.watcher = pw;
- if (parentWatcher)
- pw.parentChanged(parentWatcher.value);
- else
- pw.parentChanged(_strand);
- if (parentWatcher)
- parentWatcher.addChild(pw);
- if (watcher.children == null)
- pw.addBinding(gb);
- break;
- }
- }
- if (watcher.children)
- {
- setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
- }
- }
- }
- }
-
- private function decodeWatcher(bindingData:Array):Object
- {
- var watcherMap:Object = {};
- var watchers:Array = [];
- var n:int = bindingData.length;
- var index:int = 0;
- var watcherData:Object;
- // FalconJX adds an extra null to the data so make sure
- // we have enough data for a complete watcher otherwise
- // say we are done
- while (index < n - 2)
- {
- var watcherIndex:int = bindingData[index++];
- var type:int = bindingData[index++];
- switch (type)
- {
- case 0:
- {
- watcherData = { type: "function" };
- watcherData.functionName = bindingData[index++];
- watcherData.paramFunction = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- break;
- }
- case 1:
- {
- watcherData = { type: "static" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherData.parentObj = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 2:
- {
- watcherData = { type: "property" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 3:
- {
- watcherData = { type: "xml" };
- watcherData.propertyName = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- }
- watcherData.children = bindingData[index++];
- if (watcherData.children != null)
- {
- watcherData.children = decodeWatcher(watcherData.children);
- }
- watcherData.index = watcherIndex;
- watchers.push(watcherData);
- }
- return { watchers: watchers, watcherMap: watcherMap };
- }
-
- private var deferredBindings:Object = {};
- private function deferredBindingsHandler(event:Event):void
- {
- for (var p:String in deferredBindings)
- {
- if (_strand[p] != null)
- {
- var destination:IStrand = _strand[p] as IStrand;
- destination.addBead(deferredBindings[p]);
- delete deferredBindings[p];
- }
- }
- }
-
- }
-}
\ No newline at end of file
[6/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - get build
to stop copying handwritten js files
Posted by ah...@apache.org.
get build to stop copying handwritten js files
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c9d8f52b
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c9d8f52b
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c9d8f52b
Branch: refs/heads/core_js_to_as
Commit: c9d8f52b6342215380e32e8385b3d1c5a4dd876c
Parents: 2297170
Author: Alex Harui <ah...@apache.org>
Authored: Wed Nov 4 11:47:05 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Nov 4 11:47:05 2015 -0800
----------------------------------------------------------------------
frameworks/build.xml | 15 +++------------
frameworks/projects/Binding/build.xml | 3 ---
frameworks/projects/Binding/compile-config.xml | 1 -
frameworks/projects/Collections/build.xml | 2 +-
frameworks/projects/HTML/build.xml | 3 ---
5 files changed, 4 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c9d8f52b/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index 42c6978..765476e 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -95,16 +95,13 @@
</target>
<target name="compile-asjs" description="Cross-compiles all SWCs">
- <ant dir="${basedir}/projects/Binding" target="compile-asjs"/>
<ant dir="${basedir}/projects/Charts" target="compile-asjs"/>
- <ant dir="${basedir}/projects/Collections" target="compile-asjs"/>
<ant dir="${basedir}/projects/CreateJS" target="compile-asjs"/>
<ant dir="${basedir}/projects/DragDrop" target="compile-asjs"/>
<ant dir="${basedir}/projects/Effects" target="compile-asjs"/>
<ant dir="${basedir}/projects/Formatters" target="compile-asjs"/>
<ant dir="${basedir}/projects/GoogleMaps" target="compile-asjs"/>
<ant dir="${basedir}/projects/Graphics" target="compile-asjs"/>
- <ant dir="${basedir}/projects/HTML" target="compile-asjs"/>
<ant dir="${basedir}/projects/HTML5" target="compile-asjs"/>
<ant dir="${basedir}/projects/JQuery" target="compile-asjs"/>
<ant dir="${basedir}/projects/Mobile" target="compile-asjs"/>
@@ -112,9 +109,7 @@
</target>
<target name="lint-js" description="Cross-compiles all SWCs">
- <ant dir="${basedir}/projects/Binding" target="lint-js"/>
<ant dir="${basedir}/projects/Charts" target="lint-js"/>
- <ant dir="${basedir}/projects/Collections" target="lint-js"/>
<ant dir="${basedir}/projects/CreateJS" target="lint-js"/>
<ant dir="${basedir}/projects/DragDrop" target="lint-js"/>
<ant dir="${basedir}/projects/Effects" target="lint-js"/>
@@ -122,7 +117,6 @@
<ant dir="${basedir}/projects/Formatters" target="lint-js"/>
<ant dir="${basedir}/projects/GoogleMaps" target="lint-js"/>
<ant dir="${basedir}/projects/Graphics" target="lint-js"/>
- <ant dir="${basedir}/projects/HTML" target="lint-js"/>
<ant dir="${basedir}/projects/HTML5" target="lint-js"/>
<ant dir="${basedir}/projects/JQuery" target="lint-js"/>
<ant dir="${basedir}/projects/Mobile" target="lint-js"/>
@@ -132,11 +126,8 @@
<target name="re-compile" description="Builds all SWCs which should pick up the JS files from asjs">
<!-- order may matter due to dependencies -->
<ant dir="${basedir}/projects/Graphics" target="compile"/>
- <ant dir="${basedir}/projects/Binding" target="compile"/>
- <ant dir="${basedir}/projects/HTML" target="compile"/>
<ant dir="${basedir}/projects/Flat" target="compile"/>
<ant dir="${basedir}/projects/Charts" target="compile"/>
- <ant dir="${basedir}/projects/Collections" target="compile"/>
<ant dir="${basedir}/projects/CreateJS" target="compile"/>
<ant dir="${basedir}/projects/DragDrop" target="compile"/>
<ant dir="${basedir}/projects/Effects" target="compile"/>
@@ -211,7 +202,7 @@
</target>
<target name="Binding" description="Clean build of Binding.swc">
- <ant dir="${basedir}/projects/Binding"/>
+ <ant dir="${basedir}/projects/Binding" target="all"/>
</target>
<target name="Charts" description="Clean build of Charts.swc">
@@ -223,7 +214,7 @@
</target>
<target name="Collections" description="Clean build of Collections.swc">
- <ant dir="${basedir}/projects/Collections"/>
+ <ant dir="${basedir}/projects/Collections" target="all"/>
</target>
<target name="CreateJS" description="Clean build of CreateJS.swc">
@@ -255,7 +246,7 @@
</target>
<target name="HTML" description="Clean build of HTML.swc">
- <ant dir="${basedir}/projects/HTML"/>
+ <ant dir="${basedir}/projects/HTML" target="all"/>
</target>
<target name="HTML5" description="Clean build of HTML5.swc">
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c9d8f52b/frameworks/projects/Binding/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/build.xml b/frameworks/projects/Binding/build.xml
index c8f9c5f..3c2bebe 100644
--- a/frameworks/projects/Binding/build.xml
+++ b/frameworks/projects/Binding/build.xml
@@ -164,9 +164,6 @@
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
- <fileset dir="${basedir}/js/src">
- <include name="**/**" />
- </fileset>
<fileset dir="${basedir}/js/out">
<include name="**/**" />
</fileset>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c9d8f52b/frameworks/projects/Binding/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/compile-config.xml b/frameworks/projects/Binding/compile-config.xml
index b2a4c59..e9e8515 100644
--- a/frameworks/projects/Binding/compile-config.xml
+++ b/frameworks/projects/Binding/compile-config.xml
@@ -54,7 +54,6 @@
<source-path>
<path-element>as/src</path-element>
- <path-element>asjs/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c9d8f52b/frameworks/projects/Collections/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Collections/build.xml b/frameworks/projects/Collections/build.xml
index 6dbe094..02a7112 100644
--- a/frameworks/projects/Collections/build.xml
+++ b/frameworks/projects/Collections/build.xml
@@ -162,7 +162,7 @@
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
- <fileset dir="${basedir}/js/src">
+ <fileset dir="${basedir}/js/out">
<include name="**/**" />
</fileset>
</copy>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c9d8f52b/frameworks/projects/HTML/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/build.xml b/frameworks/projects/HTML/build.xml
index d65a172..b98d7a8 100644
--- a/frameworks/projects/HTML/build.xml
+++ b/frameworks/projects/HTML/build.xml
@@ -166,9 +166,6 @@
<target name="lint-js" depends="gjslint, jshint, copy-js" />
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
- <fileset dir="${basedir}/js/src">
- <include name="**/**" />
- </fileset>
<fileset dir="${basedir}/js/out">
<include name="**/**" />
</fileset>
[2/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - move asjs
to as
Posted by ah...@apache.org.
move asjs to as
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f760c093
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f760c093
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f760c093
Branch: refs/heads/core_js_to_as
Commit: f760c09357689822aae62e32952b987500f4f3dc
Parents: 3a3efe9
Author: Alex Harui <ah...@apache.org>
Authored: Sun Nov 1 21:24:08 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Nov 1 21:24:08 2015 -0800
----------------------------------------------------------------------
.../flex/binding/ApplicationDataBinding.as | 334 ++++++++++++++++
.../apache/flex/binding/ContainerDataBinding.as | 382 +++++++++++++++++++
.../flex/binding/MXMLBeadViewBaseDataBinding.as | 333 ++++++++++++++++
.../flex/binding/ApplicationDataBinding.as | 334 ----------------
.../apache/flex/binding/ContainerDataBinding.as | 382 -------------------
.../flex/binding/MXMLBeadViewBaseDataBinding.as | 333 ----------------
6 files changed, 1049 insertions(+), 1049 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/as/src/org/apache/flex/binding/ApplicationDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/as/src/org/apache/flex/binding/ApplicationDataBinding.as b/frameworks/projects/Binding/as/src/org/apache/flex/binding/ApplicationDataBinding.as
new file mode 100644
index 0000000..4038645
--- /dev/null
+++ b/frameworks/projects/Binding/as/src/org/apache/flex/binding/ApplicationDataBinding.as
@@ -0,0 +1,334 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.binding
+{
+ import org.apache.flex.binding.ConstantBinding;
+ import org.apache.flex.binding.GenericBinding;
+ import org.apache.flex.binding.PropertyWatcher;
+ import org.apache.flex.binding.SimpleBinding;
+ import org.apache.flex.binding.WatcherBase;
+ import org.apache.flex.core.DataBindingBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ApplicationDataBinding class implements databinding for
+ * Application instances. Different classes can have
+ * different databinding implementation that optimize for
+ * the different lifecycles. For example, an item renderer
+ * databinding implementation can wait to execute databindings
+ * until the data property is set.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ApplicationDataBinding extends DataBindingBase implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ApplicationDataBinding()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(_strand).addEventListener("viewChanged", initCompleteHandler);
+ }
+
+ private function initCompleteHandler(event:Event):void
+ {
+ var fieldWatcher:Object;
+ var sb:SimpleBinding;
+ if (!("_bindings" in _strand))
+ return;
+ var bindingData:Array = _strand["_bindings"];
+ var n:int = bindingData[0];
+ var bindings:Array = [];
+ var i:int;
+ var index:int = 1;
+ for (i = 0; i < n; i++)
+ {
+ var binding:Object = {};
+ binding.source = bindingData[index++];
+ binding.destFunc = bindingData[index++];
+ binding.destination = bindingData[index++];
+ bindings.push(binding);
+ }
+ var watchers:Object = decodeWatcher(bindingData.slice(index));
+ for (i = 0; i < n; i++)
+ {
+ binding = bindings[i];
+ if (binding.source is Array)
+ {
+ if (binding.source[0] in _strand)
+ {
+ if (binding.source.length == 2 && binding.destination.length == 2)
+ {
+ // simple component.property binding
+ var destObject:Object;
+ var destination:IStrand;
+ // can be simplebinding or constantbinding
+ var compWatcher:Object = watchers.watcherMap[binding.source[0]];
+ fieldWatcher = compWatcher.children.watcherMap[binding.source[1]];
+ 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)
+ {
+ var cb:ConstantBinding = 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 if (binding.source is String)
+ {
+ fieldWatcher = watchers.watcherMap[binding.source];
+ if (fieldWatcher.eventNames is String)
+ {
+ sb = new SimpleBinding();
+ sb.destinationPropertyName = binding.destination[1];
+ sb.eventName = fieldWatcher.eventNames as String;
+ sb.sourcePropertyName = binding.source;
+ 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
+ {
+ makeGenericBinding(binding, i, watchers);
+ }
+ }
+ }
+
+ private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
+ {
+ var gb:GenericBinding = new GenericBinding();
+ gb.setDocument(_strand);
+ gb.destinationData = binding.destination;
+ gb.destinationFunction = binding.destFunc;
+ gb.source = binding.source;
+ setupWatchers(gb, index, watchers.watchers, null);
+ }
+
+ private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
+ {
+ var n:int = watchers.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var watcher:Object = watchers[i];
+ 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)
+ {
+ case "property":
+ {
+ var pw:PropertyWatcher = new PropertyWatcher(this,
+ watcher.propertyName,
+ watcher.eventNames,
+ watcher.getterFunction);
+ watcher.watcher = pw;
+ if (parentWatcher)
+ pw.parentChanged(parentWatcher.value);
+ else
+ pw.parentChanged(_strand);
+ if (parentWatcher)
+ parentWatcher.addChild(pw);
+ if (watcher.children == null)
+ pw.addBinding(gb);
+ break;
+ }
+ }
+ if (watcher.children)
+ {
+ setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
+ }
+ }
+ }
+ }
+
+ private function decodeWatcher(bindingData:Array):Object
+ {
+ var watcherMap:Object = {};
+ var watchers:Array = [];
+ var n:int = bindingData.length;
+ var index:int = 0;
+ var watcherData:Object;
+ // FalconJX adds an extra null to the data so make sure
+ // we have enough data for a complete watcher otherwise
+ // say we are done
+ while (index < n - 2)
+ {
+ var watcherIndex:int = bindingData[index++];
+ var type:int = bindingData[index++];
+ switch (type)
+ {
+ case 0:
+ {
+ watcherData = { type: "function" };
+ watcherData.functionName = bindingData[index++];
+ watcherData.paramFunction = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ break;
+ }
+ case 1:
+ {
+ watcherData = { type: "static" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherData.parentObj = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 2:
+ {
+ watcherData = { type: "property" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 3:
+ {
+ watcherData = { type: "xml" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ }
+ watcherData.children = bindingData[index++];
+ if (watcherData.children != null)
+ {
+ watcherData.children = decodeWatcher(watcherData.children);
+ }
+ watcherData.index = watcherIndex;
+ watchers.push(watcherData);
+ }
+ return { watchers: watchers, watcherMap: watcherMap };
+ }
+
+ private var deferredBindings:Object = {};
+ private function deferredBindingsHandler(event:Event):void
+ {
+ for (var p:String in deferredBindings)
+ {
+ if (_strand[p] != null)
+ {
+ var destination:IStrand = _strand[p] as IStrand;
+ destination.addBead(deferredBindings[p]);
+ delete deferredBindings[p];
+ }
+ }
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/as/src/org/apache/flex/binding/ContainerDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/as/src/org/apache/flex/binding/ContainerDataBinding.as b/frameworks/projects/Binding/as/src/org/apache/flex/binding/ContainerDataBinding.as
new file mode 100644
index 0000000..d138d60
--- /dev/null
+++ b/frameworks/projects/Binding/as/src/org/apache/flex/binding/ContainerDataBinding.as
@@ -0,0 +1,382 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.binding
+{
+ import org.apache.flex.binding.ChainBinding;
+ import org.apache.flex.binding.ConstantBinding;
+ import org.apache.flex.binding.GenericBinding;
+ import org.apache.flex.binding.PropertyWatcher;
+ import org.apache.flex.binding.SimpleBinding;
+ import org.apache.flex.binding.WatcherBase;
+ import org.apache.flex.core.DataBindingBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ContainerDataBinding class implements databinding for
+ * Container instances. Different classes can have
+ * different databinding implementation that optimize for
+ * the different lifecycles. For example, an item renderer
+ * databinding implementation can wait to execute databindings
+ * until the data property is set.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerDataBinding extends DataBindingBase implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerDataBinding()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler);
+ }
+
+ private function initCompleteHandler(event:Event):void
+ {
+ var fieldWatcher:Object;
+ var sb:SimpleBinding;
+ var cb:ConstantBinding;
+ if (!("_bindings" in _strand))
+ return;
+ var bindingData:Array = _strand["_bindings"];
+ var n:int = bindingData[0];
+ var bindings:Array = [];
+ var i:int;
+ var index:int = 1;
+ for (i = 0; i < n; i++)
+ {
+ var binding:Object = {};
+ binding.source = bindingData[index++];
+ binding.destFunc = bindingData[index++];
+ binding.destination = bindingData[index++];
+ bindings.push(binding);
+ }
+ var watchers:Object = decodeWatcher(bindingData.slice(index));
+ for (i = 0; i < n; i++)
+ {
+ binding = bindings[i];
+ if (binding.source is Array)
+ {
+ if (binding.source[0] in _strand)
+ {
+ var destObject:Object;
+ var destination:IStrand;
+ var compWatcher:Object;
+ if (binding.source.length == 2 && binding.destination.length == 2)
+ {
+ // simple component.property binding
+ // can be simplebinding or constantbinding
+ compWatcher = watchers.watcherMap[binding.source[0]];
+ fieldWatcher = compWatcher.children.watcherMap[binding.source[1]];
+ 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
+ {
+ compWatcher = watchers.watcherMap[binding.source[0]];
+ var chb:ChainBinding = new ChainBinding();
+ chb.destination = binding.destination;
+ chb.source = binding.source;
+ chb.watcherChain = compWatcher;
+ chb.setDocument(_strand);
+ _strand.addBead(chb);
+ }
+ }
+ }
+ else if (binding.source is String && binding.destination is Array)
+ {
+ fieldWatcher = watchers.watcherMap[binding.source];
+ if (fieldWatcher == null)
+ {
+ cb = new ConstantBinding();
+ cb.destinationPropertyName = binding.destination[1];
+ cb.sourcePropertyName = binding.source;
+ cb.setDocument(_strand);
+ if (binding.destination[0] == "this")
+ destObject = _strand;
+ else
+ 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 if (fieldWatcher.eventNames is String)
+ {
+ sb = new SimpleBinding();
+ sb.destinationPropertyName = binding.destination[1];
+ sb.eventName = fieldWatcher.eventNames as String;
+ sb.sourcePropertyName = binding.source;
+ 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
+ {
+ makeGenericBinding(binding, i, watchers);
+ }
+ }
+ }
+
+ private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
+ {
+ var gb:GenericBinding = new GenericBinding();
+ gb.setDocument(_strand);
+ gb.destinationData = binding.destination;
+ gb.destinationFunction = binding.destFunc;
+ gb.source = binding.source;
+ if (watchers.watchers.length)
+ setupWatchers(gb, index, watchers.watchers, null);
+ else
+ {
+ // should be a constant expression.
+ // the value doesn't matter as GenericBinding
+ // should get the value from the source
+ gb.valueChanged(null);
+ }
+ }
+
+ private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
+ {
+ var n:int = watchers.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var watcher:Object = watchers[i];
+ 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)
+ {
+ case "property":
+ {
+ var pw:PropertyWatcher = new PropertyWatcher(this,
+ watcher.propertyName,
+ watcher.eventNames,
+ watcher.getterFunction);
+ watcher.watcher = pw;
+ if (parentWatcher)
+ pw.parentChanged(parentWatcher.value);
+ else
+ pw.parentChanged(_strand);
+ if (parentWatcher)
+ parentWatcher.addChild(pw);
+ if (watcher.children == null)
+ pw.addBinding(gb);
+ break;
+ }
+ }
+ if (watcher.children)
+ {
+ setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
+ }
+ }
+ }
+ }
+
+ private function decodeWatcher(bindingData:Array):Object
+ {
+ var watcherMap:Object = {};
+ var watchers:Array = [];
+ var n:int = bindingData.length;
+ var index:int = 0;
+ var watcherData:Object;
+ // FalconJX adds an extra null to the data so make sure
+ // we have enough data for a complete watcher otherwise
+ // say we are done
+ while (index < n - 2)
+ {
+ var watcherIndex:int = bindingData[index++];
+ var type:int = bindingData[index++];
+ switch (type)
+ {
+ case 0:
+ {
+ watcherData = { type: "function" };
+ watcherData.functionName = bindingData[index++];
+ watcherData.paramFunction = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ break;
+ }
+ case 1:
+ {
+ watcherData = { type: "static" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherData.parentObj = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 2:
+ {
+ watcherData = { type: "property" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 3:
+ {
+ watcherData = { type: "xml" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ }
+ watcherData.children = bindingData[index++];
+ if (watcherData.children != null)
+ {
+ watcherData.children = decodeWatcher(watcherData.children);
+ }
+ watcherData.index = watcherIndex;
+ watchers.push(watcherData);
+ }
+ return { watchers: watchers, watcherMap: watcherMap };
+ }
+
+ private var deferredBindings:Object = {};
+ private function deferredBindingsHandler(event:Event):void
+ {
+ for (var p:String in deferredBindings)
+ {
+ if (_strand[p] != null)
+ {
+ var destination:IStrand = _strand[p] as IStrand;
+ destination.addBead(deferredBindings[p]);
+ delete deferredBindings[p];
+ }
+ }
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/as/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/as/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as b/frameworks/projects/Binding/as/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
new file mode 100644
index 0000000..5d35cea
--- /dev/null
+++ b/frameworks/projects/Binding/as/src/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as
@@ -0,0 +1,333 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.binding
+{
+ import org.apache.flex.binding.ConstantBinding;
+ import org.apache.flex.binding.GenericBinding;
+ import org.apache.flex.binding.PropertyWatcher;
+ import org.apache.flex.binding.SimpleBinding;
+ import org.apache.flex.binding.WatcherBase;
+ import org.apache.flex.core.DataBindingBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ViewBaseDataBinding class implements databinding for
+ * ViewBase instances. Different classes can have
+ * different databinding implementation that optimize for
+ * the different lifecycles. For example, an item renderer
+ * databinding implementation can wait to execute databindings
+ * until the data property is set.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MXMLBeadViewBaseDataBinding extends DataBindingBase implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MXMLBeadViewBaseDataBinding()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler);
+ }
+
+ private function initCompleteHandler(event:Event):void
+ {
+ var fieldWatcher:Object;
+ var sb:SimpleBinding;
+ if (!("_bindings" in _strand))
+ return;
+ var bindingData:Array = _strand["_bindings"];
+ var n:int = bindingData[0];
+ var bindings:Array = [];
+ var i:int;
+ var index:int = 1;
+ for (i = 0; i < n; i++)
+ {
+ var binding:Object = {};
+ binding.source = bindingData[index++];
+ binding.destFunc = bindingData[index++];
+ binding.destination = bindingData[index++];
+ bindings.push(binding);
+ }
+ var watchers:Object = decodeWatcher(bindingData.slice(index));
+ for (i = 0; i < n; i++)
+ {
+ binding = bindings[i];
+ if (binding.source is Array)
+ {
+ if (binding.source[0] in _strand)
+ {
+ if (binding.source.length == 2 && binding.destination.length == 2)
+ {
+ var destObject:Object;
+ var destination:IStrand;
+ // can be simplebinding or constantbinding
+ var modelWatcher:Object = watchers.watcherMap[binding.source[0]];
+ fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]];
+ 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)
+ {
+ var cb:ConstantBinding = 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 if (binding.source is String)
+ {
+ fieldWatcher = watchers.watcherMap[binding.source];
+ if (fieldWatcher.eventNames is String)
+ {
+ sb = new SimpleBinding();
+ sb.destinationPropertyName = binding.destination[1];
+ sb.eventName = fieldWatcher.eventNames as String;
+ sb.sourcePropertyName = binding.source;
+ 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
+ {
+ makeGenericBinding(binding, i, watchers);
+ }
+ }
+ }
+
+ private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
+ {
+ var gb:GenericBinding = new GenericBinding();
+ gb.setDocument(_strand);
+ gb.destinationData = binding.destination;
+ gb.destinationFunction = binding.destFunc;
+ gb.source = binding.source;
+ setupWatchers(gb, index, watchers.watchers, null);
+ }
+
+ private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
+ {
+ var n:int = watchers.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var watcher:Object = watchers[i];
+ 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)
+ {
+ case "property":
+ {
+ var pw:PropertyWatcher = new PropertyWatcher(this,
+ watcher.propertyName,
+ watcher.eventNames,
+ watcher.getterFunction);
+ watcher.watcher = pw;
+ if (parentWatcher)
+ pw.parentChanged(parentWatcher.value);
+ else
+ pw.parentChanged(_strand);
+ if (parentWatcher)
+ parentWatcher.addChild(pw);
+ if (watcher.children == null)
+ pw.addBinding(gb);
+ break;
+ }
+ }
+ if (watcher.children)
+ {
+ setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
+ }
+ }
+ }
+ }
+
+ private function decodeWatcher(bindingData:Array):Object
+ {
+ var watcherMap:Object = {};
+ var watchers:Array = [];
+ var n:int = bindingData.length;
+ var index:int = 0;
+ var watcherData:Object;
+ // FalconJX adds an extra null to the data so make sure
+ // we have enough data for a complete watcher otherwise
+ // say we are done
+ while (index < n - 2)
+ {
+ var watcherIndex:int = bindingData[index++];
+ var type:int = bindingData[index++];
+ switch (type)
+ {
+ case 0:
+ {
+ watcherData = { type: "function" };
+ watcherData.functionName = bindingData[index++];
+ watcherData.paramFunction = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ break;
+ }
+ case 1:
+ {
+ watcherData = { type: "static" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherData.parentObj = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 2:
+ {
+ watcherData = { type: "property" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.eventNames = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherData.getterFunction = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ case 3:
+ {
+ watcherData = { type: "xml" };
+ watcherData.propertyName = bindingData[index++];
+ watcherData.bindings = bindingData[index++];
+ watcherMap[watcherData.propertyName] = watcherData;
+ break;
+ }
+ }
+ watcherData.children = bindingData[index++];
+ if (watcherData.children != null)
+ {
+ watcherData.children = decodeWatcher(watcherData.children);
+ }
+ watcherData.index = watcherIndex;
+ watchers.push(watcherData);
+ }
+ return { watchers: watchers, watcherMap: watcherMap };
+ }
+
+ private var deferredBindings:Object = {};
+ private function deferredBindingsHandler(event:Event):void
+ {
+ for (var p:String in deferredBindings)
+ {
+ if (_strand[p] != null)
+ {
+ var destination:IStrand = _strand[p] as IStrand;
+ destination.addBead(deferredBindings[p]);
+ delete deferredBindings[p];
+ }
+ }
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ApplicationDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ApplicationDataBinding.as b/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ApplicationDataBinding.as
deleted file mode 100644
index 4038645..0000000
--- a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ApplicationDataBinding.as
+++ /dev/null
@@ -1,334 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.binding
-{
- import org.apache.flex.binding.ConstantBinding;
- import org.apache.flex.binding.GenericBinding;
- import org.apache.flex.binding.PropertyWatcher;
- import org.apache.flex.binding.SimpleBinding;
- import org.apache.flex.binding.WatcherBase;
- import org.apache.flex.core.DataBindingBase;
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The ApplicationDataBinding class implements databinding for
- * Application instances. Different classes can have
- * different databinding implementation that optimize for
- * the different lifecycles. For example, an item renderer
- * databinding implementation can wait to execute databindings
- * until the data property is set.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ApplicationDataBinding extends DataBindingBase implements IBead
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ApplicationDataBinding()
- {
- super();
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- IEventDispatcher(_strand).addEventListener("viewChanged", initCompleteHandler);
- }
-
- private function initCompleteHandler(event:Event):void
- {
- var fieldWatcher:Object;
- var sb:SimpleBinding;
- if (!("_bindings" in _strand))
- return;
- var bindingData:Array = _strand["_bindings"];
- var n:int = bindingData[0];
- var bindings:Array = [];
- var i:int;
- var index:int = 1;
- for (i = 0; i < n; i++)
- {
- var binding:Object = {};
- binding.source = bindingData[index++];
- binding.destFunc = bindingData[index++];
- binding.destination = bindingData[index++];
- bindings.push(binding);
- }
- var watchers:Object = decodeWatcher(bindingData.slice(index));
- for (i = 0; i < n; i++)
- {
- binding = bindings[i];
- if (binding.source is Array)
- {
- if (binding.source[0] in _strand)
- {
- if (binding.source.length == 2 && binding.destination.length == 2)
- {
- // simple component.property binding
- var destObject:Object;
- var destination:IStrand;
- // can be simplebinding or constantbinding
- var compWatcher:Object = watchers.watcherMap[binding.source[0]];
- fieldWatcher = compWatcher.children.watcherMap[binding.source[1]];
- 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)
- {
- var cb:ConstantBinding = 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 if (binding.source is String)
- {
- fieldWatcher = watchers.watcherMap[binding.source];
- if (fieldWatcher.eventNames is String)
- {
- sb = new SimpleBinding();
- sb.destinationPropertyName = binding.destination[1];
- sb.eventName = fieldWatcher.eventNames as String;
- sb.sourcePropertyName = binding.source;
- 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
- {
- makeGenericBinding(binding, i, watchers);
- }
- }
- }
-
- private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
- {
- var gb:GenericBinding = new GenericBinding();
- gb.setDocument(_strand);
- gb.destinationData = binding.destination;
- gb.destinationFunction = binding.destFunc;
- gb.source = binding.source;
- setupWatchers(gb, index, watchers.watchers, null);
- }
-
- private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
- {
- var n:int = watchers.length;
- for (var i:int = 0; i < n; i++)
- {
- var watcher:Object = watchers[i];
- 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)
- {
- case "property":
- {
- var pw:PropertyWatcher = new PropertyWatcher(this,
- watcher.propertyName,
- watcher.eventNames,
- watcher.getterFunction);
- watcher.watcher = pw;
- if (parentWatcher)
- pw.parentChanged(parentWatcher.value);
- else
- pw.parentChanged(_strand);
- if (parentWatcher)
- parentWatcher.addChild(pw);
- if (watcher.children == null)
- pw.addBinding(gb);
- break;
- }
- }
- if (watcher.children)
- {
- setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
- }
- }
- }
- }
-
- private function decodeWatcher(bindingData:Array):Object
- {
- var watcherMap:Object = {};
- var watchers:Array = [];
- var n:int = bindingData.length;
- var index:int = 0;
- var watcherData:Object;
- // FalconJX adds an extra null to the data so make sure
- // we have enough data for a complete watcher otherwise
- // say we are done
- while (index < n - 2)
- {
- var watcherIndex:int = bindingData[index++];
- var type:int = bindingData[index++];
- switch (type)
- {
- case 0:
- {
- watcherData = { type: "function" };
- watcherData.functionName = bindingData[index++];
- watcherData.paramFunction = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- break;
- }
- case 1:
- {
- watcherData = { type: "static" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherData.parentObj = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 2:
- {
- watcherData = { type: "property" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 3:
- {
- watcherData = { type: "xml" };
- watcherData.propertyName = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- }
- watcherData.children = bindingData[index++];
- if (watcherData.children != null)
- {
- watcherData.children = decodeWatcher(watcherData.children);
- }
- watcherData.index = watcherIndex;
- watchers.push(watcherData);
- }
- return { watchers: watchers, watcherMap: watcherMap };
- }
-
- private var deferredBindings:Object = {};
- private function deferredBindingsHandler(event:Event):void
- {
- for (var p:String in deferredBindings)
- {
- if (_strand[p] != null)
- {
- var destination:IStrand = _strand[p] as IStrand;
- destination.addBead(deferredBindings[p]);
- delete deferredBindings[p];
- }
- }
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f760c093/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ContainerDataBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ContainerDataBinding.as b/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ContainerDataBinding.as
deleted file mode 100644
index d138d60..0000000
--- a/frameworks/projects/Binding/asjs/src/org/apache/flex/binding/ContainerDataBinding.as
+++ /dev/null
@@ -1,382 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.binding
-{
- import org.apache.flex.binding.ChainBinding;
- import org.apache.flex.binding.ConstantBinding;
- import org.apache.flex.binding.GenericBinding;
- import org.apache.flex.binding.PropertyWatcher;
- import org.apache.flex.binding.SimpleBinding;
- import org.apache.flex.binding.WatcherBase;
- import org.apache.flex.core.DataBindingBase;
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The ContainerDataBinding class implements databinding for
- * Container instances. Different classes can have
- * different databinding implementation that optimize for
- * the different lifecycles. For example, an item renderer
- * databinding implementation can wait to execute databindings
- * until the data property is set.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ContainerDataBinding extends DataBindingBase implements IBead
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ContainerDataBinding()
- {
- super();
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler);
- }
-
- private function initCompleteHandler(event:Event):void
- {
- var fieldWatcher:Object;
- var sb:SimpleBinding;
- var cb:ConstantBinding;
- if (!("_bindings" in _strand))
- return;
- var bindingData:Array = _strand["_bindings"];
- var n:int = bindingData[0];
- var bindings:Array = [];
- var i:int;
- var index:int = 1;
- for (i = 0; i < n; i++)
- {
- var binding:Object = {};
- binding.source = bindingData[index++];
- binding.destFunc = bindingData[index++];
- binding.destination = bindingData[index++];
- bindings.push(binding);
- }
- var watchers:Object = decodeWatcher(bindingData.slice(index));
- for (i = 0; i < n; i++)
- {
- binding = bindings[i];
- if (binding.source is Array)
- {
- if (binding.source[0] in _strand)
- {
- var destObject:Object;
- var destination:IStrand;
- var compWatcher:Object;
- if (binding.source.length == 2 && binding.destination.length == 2)
- {
- // simple component.property binding
- // can be simplebinding or constantbinding
- compWatcher = watchers.watcherMap[binding.source[0]];
- fieldWatcher = compWatcher.children.watcherMap[binding.source[1]];
- 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
- {
- compWatcher = watchers.watcherMap[binding.source[0]];
- var chb:ChainBinding = new ChainBinding();
- chb.destination = binding.destination;
- chb.source = binding.source;
- chb.watcherChain = compWatcher;
- chb.setDocument(_strand);
- _strand.addBead(chb);
- }
- }
- }
- else if (binding.source is String && binding.destination is Array)
- {
- fieldWatcher = watchers.watcherMap[binding.source];
- if (fieldWatcher == null)
- {
- cb = new ConstantBinding();
- cb.destinationPropertyName = binding.destination[1];
- cb.sourcePropertyName = binding.source;
- cb.setDocument(_strand);
- if (binding.destination[0] == "this")
- destObject = _strand;
- else
- 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 if (fieldWatcher.eventNames is String)
- {
- sb = new SimpleBinding();
- sb.destinationPropertyName = binding.destination[1];
- sb.eventName = fieldWatcher.eventNames as String;
- sb.sourcePropertyName = binding.source;
- 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
- {
- makeGenericBinding(binding, i, watchers);
- }
- }
- }
-
- private function makeGenericBinding(binding:Object, index:int, watchers:Object):void
- {
- var gb:GenericBinding = new GenericBinding();
- gb.setDocument(_strand);
- gb.destinationData = binding.destination;
- gb.destinationFunction = binding.destFunc;
- gb.source = binding.source;
- if (watchers.watchers.length)
- setupWatchers(gb, index, watchers.watchers, null);
- else
- {
- // should be a constant expression.
- // the value doesn't matter as GenericBinding
- // should get the value from the source
- gb.valueChanged(null);
- }
- }
-
- private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void
- {
- var n:int = watchers.length;
- for (var i:int = 0; i < n; i++)
- {
- var watcher:Object = watchers[i];
- 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)
- {
- case "property":
- {
- var pw:PropertyWatcher = new PropertyWatcher(this,
- watcher.propertyName,
- watcher.eventNames,
- watcher.getterFunction);
- watcher.watcher = pw;
- if (parentWatcher)
- pw.parentChanged(parentWatcher.value);
- else
- pw.parentChanged(_strand);
- if (parentWatcher)
- parentWatcher.addChild(pw);
- if (watcher.children == null)
- pw.addBinding(gb);
- break;
- }
- }
- if (watcher.children)
- {
- setupWatchers(gb, index, watcher.children.watchers, watcher.watcher);
- }
- }
- }
- }
-
- private function decodeWatcher(bindingData:Array):Object
- {
- var watcherMap:Object = {};
- var watchers:Array = [];
- var n:int = bindingData.length;
- var index:int = 0;
- var watcherData:Object;
- // FalconJX adds an extra null to the data so make sure
- // we have enough data for a complete watcher otherwise
- // say we are done
- while (index < n - 2)
- {
- var watcherIndex:int = bindingData[index++];
- var type:int = bindingData[index++];
- switch (type)
- {
- case 0:
- {
- watcherData = { type: "function" };
- watcherData.functionName = bindingData[index++];
- watcherData.paramFunction = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- break;
- }
- case 1:
- {
- watcherData = { type: "static" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherData.parentObj = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 2:
- {
- watcherData = { type: "property" };
- watcherData.propertyName = bindingData[index++];
- watcherData.eventNames = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherData.getterFunction = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- case 3:
- {
- watcherData = { type: "xml" };
- watcherData.propertyName = bindingData[index++];
- watcherData.bindings = bindingData[index++];
- watcherMap[watcherData.propertyName] = watcherData;
- break;
- }
- }
- watcherData.children = bindingData[index++];
- if (watcherData.children != null)
- {
- watcherData.children = decodeWatcher(watcherData.children);
- }
- watcherData.index = watcherIndex;
- watchers.push(watcherData);
- }
- return { watchers: watchers, watcherMap: watcherMap };
- }
-
- private var deferredBindings:Object = {};
- private function deferredBindingsHandler(event:Event):void
- {
- for (var p:String in deferredBindings)
- {
- if (_strand[p] != null)
- {
- var destination:IStrand = _strand[p] as IStrand;
- destination.addBead(deferredBindings[p]);
- delete deferredBindings[p];
- }
- }
- }
-
- }
-}
\ No newline at end of file
[5/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean
build of Collections
Posted by ah...@apache.org.
clean build of Collections
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/22971702
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/22971702
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/22971702
Branch: refs/heads/core_js_to_as
Commit: 22971702996a8554d4e1dc8b821e2989298c8267
Parents: 352980b
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 2 10:32:56 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 2 10:32:56 2015 -0800
----------------------------------------------------------------------
.../apache/flex/collections/LazyCollection.as | 33 +++++--
frameworks/projects/Collections/build.xml | 91 +++++++++++++-------
.../Collections/compile-asjs-config.xml | 8 +-
.../projects/Collections/compile-config.xml | 4 +-
4 files changed, 92 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22971702/frameworks/projects/Collections/as/src/org/apache/flex/collections/LazyCollection.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Collections/as/src/org/apache/flex/collections/LazyCollection.as b/frameworks/projects/Collections/as/src/org/apache/flex/collections/LazyCollection.as
index 15948fe..edf965c 100644
--- a/frameworks/projects/Collections/as/src/org/apache/flex/collections/LazyCollection.as
+++ b/frameworks/projects/Collections/as/src/org/apache/flex/collections/LazyCollection.as
@@ -18,12 +18,16 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.collections
{
- import flash.events.Event;
- import flash.events.IEventDispatcher;
+ COMPILE::AS3
+ {
+ import flash.events.Event;
+ }
import org.apache.flex.core.IBead;
import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.collections.parsers.IInputParser;
import org.apache.flex.collections.converters.IItemConverter;
@@ -110,7 +114,7 @@ package org.apache.flex.collections
if (_inputParser != value)
{
_inputParser = value;
- dispatchEvent(new Event("inputParserChanged"));
+ dispatchEvent(new org.apache.flex.events.Event("inputParserChanged"));
}
}
@@ -139,7 +143,7 @@ package org.apache.flex.collections
if (_itemConverter != value)
{
_itemConverter = value;
- dispatchEvent(new Event("itemConverterChanged"));
+ dispatchEvent(new org.apache.flex.events.Event("itemConverterChanged"));
}
}
@@ -166,7 +170,7 @@ package org.apache.flex.collections
if (_id != value)
{
_id = value;
- dispatchEvent(new Event("idChanged"));
+ dispatchEvent(new org.apache.flex.events.Event("idChanged"));
}
}
@@ -183,7 +187,14 @@ package org.apache.flex.collections
public function set strand(value:IStrand):void
{
_strand = value;
- IEventDispatcher(_strand).addEventListener(Event.COMPLETE, completeHandler);
+ COMPILE::AS3
+ {
+ IEventDispatcher(_strand).addEventListener(flash.events.Event.COMPLETE, completeHandler);
+ }
+ COMPILE::JS
+ {
+ IEventDispatcher(_strand).addEventListener("complete", completeHandler);
+ }
}
/**
@@ -207,7 +218,15 @@ package org.apache.flex.collections
*/
protected var data:Array;
- private function completeHandler(event:Event):void
+ COMPILE::AS3
+ private function completeHandler(event:flash.events.Event):void
+ {
+ rawData = inputParser.parseItems(_strand["data"]);
+ data = new Array(rawData.length);
+ dispatchEvent(event);
+ }
+ COMPILE::JS
+ private function completeHandler(event:org.apache.flex.events.Event):void
{
rawData = inputParser.parseItems(_strand["data"]);
data = new Array(rawData.length);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22971702/frameworks/projects/Collections/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Collections/build.xml b/frameworks/projects/Collections/build.xml
index a2f2db7..6dbe094 100644
--- a/frameworks/projects/Collections/build.xml
+++ b/frameworks/projects/Collections/build.xml
@@ -37,7 +37,7 @@
<target name="main" depends="clean,compile,test" description="Clean build of Collections.swc">
</target>
- <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Binding.swc">
+ <target name="all" depends="clean,compile-asjs,compile-extern-swc,compile,copy-js,test-js" description="Full build of Collections.swc">
</target>
<target name="test" unless="is.jenkins">
@@ -95,14 +95,71 @@
<load-config filename="compile-config.xml" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-define=COMPILE::AS3,true" />
+ <arg value="-define=COMPILE::JS,false" />
</compc>
</target>
- <target name="compile-asjs" >
- <!-- nothing to cross-compile yet -->
+ <target name="compile-asjs">
+ <echo message="Cross-compiling Collections"/>
+ <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
+ <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
+ <jvmarg value="-Xmx384m" />
+ <jvmarg value="-Dsun.io.useCanonCaches=false" />
+ <jvmarg value="-Dflexcompiler=${FALCONJX_HOME}/../compiler" />
+ <jvmarg value="-Dflexlib=${FLEXJS_HOME}/frameworks" />
+ <arg value="+flexlib=${FLEX_HOME}/frameworks" />
+ <arg value="-js-output-type=FLEXJS" />
+ <arg value="-keep-asdoc" /><!-- allows compiler to see @flexjsignorecoercion annotations -->
+ <arg value="-output=${basedir}/js/out" />
+ <arg value="-load-config=${basedir}/compile-asjs-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
+ </java>
+ </target>
+
+ <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+ <echo message="Compiling externs/Collections.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <!-- make JS output folder now so include-file doesn't error -->
+ <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in CoreClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <compc fork="true"
+ output="${FLEXJS_HOME}/frameworks/externs/Collections.swc">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="compile-asjs-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
+ </compc>
</target>
- <target name="lint-js" depends="gjslint, jshint, copy-js" />
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
<fileset dir="${basedir}/js/src">
@@ -111,30 +168,4 @@
</copy>
</target>
- <target name="gjslint" unless="no.lint">
- <echo>running gjslint</echo>
- <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
- <arg value="--strict" />
- <arg value="--disable" />
- <arg value="006,100,214,300" />
- <!-- 006: wrong indentation -->
- <!-- 100: cannot have non-primitive value -->
- <!-- 214: @fileoverview tag missing description -->
- <!-- 300: missing newline at end of file -->
- <arg value="--max_line_length" />
- <arg value="120" />
- <arg value="-r" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
- <target name="jshint" unless="no.lint">
- <echo>running jshint</echo>
- <exec executable="${jshint}" dir="${basedir}" failonerror="true">
- <arg value="--config" />
- <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22971702/frameworks/projects/Collections/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Collections/compile-asjs-config.xml b/frameworks/projects/Collections/compile-asjs-config.xml
index 48d7dc0..b4766bb 100644
--- a/frameworks/projects/Collections/compile-asjs-config.xml
+++ b/frameworks/projects/Collections/compile-asjs-config.xml
@@ -22,7 +22,6 @@
<accessible>false</accessible>
<external-library-path>
- <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
</external-library-path>
<mxml>
@@ -46,12 +45,11 @@
<!-- asjscompc won't 'link' these classes in, but will list their requires
if these swcs are on the external-library-path then their requires
will not be listed -->
- <path-element>../../libs/Core.swc</path-element>
- <path-element>../../libs/Collections.swc</path-element>
+ <path-element>../../externs/Core.swc</path-element>
</library-path>
<source-path>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
@@ -61,7 +59,7 @@
</include-file>
<include-sources>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</include-sources>
<include-namespaces>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22971702/frameworks/projects/Collections/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Collections/compile-config.xml b/frameworks/projects/Collections/compile-config.xml
index fdb1921..c69da9b 100644
--- a/frameworks/projects/Collections/compile-config.xml
+++ b/frameworks/projects/Collections/compile-config.xml
@@ -60,8 +60,8 @@
</compiler>
<include-file>
- <name>js/src/*</name>
- <path>js/src/*</path>
+ <name>js/out/*</name>
+ <path>js/out/*</path>
</include-file>
<include-classes>
[7/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - get the
build to use cross-compiled Language class
Posted by ah...@apache.org.
get the build to use cross-compiled Language class
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4b60eaa1
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4b60eaa1
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4b60eaa1
Branch: refs/heads/core_js_to_as
Commit: 4b60eaa1176a5d9f465388560f10b60dbe04ab02
Parents: c9d8f52
Author: Alex Harui <ah...@apache.org>
Authored: Wed Nov 4 11:47:31 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Nov 4 11:47:31 2015 -0800
----------------------------------------------------------------------
frameworks/projects/Core/as/src/CoreClasses.as | 4 +
.../as/src/org/apache/flex/utils/Language.as | 123 +++++++++++--------
2 files changed, 77 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b60eaa1/frameworks/projects/Core/as/src/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/CoreClasses.as b/frameworks/projects/Core/as/src/CoreClasses.as
index 82e5df0..d1f22b8 100644
--- a/frameworks/projects/Core/as/src/CoreClasses.as
+++ b/frameworks/projects/Core/as/src/CoreClasses.as
@@ -142,6 +142,10 @@ internal class CoreClasses
import org.apache.flex.core.ParentDocumentBead; ParentDocumentBead;
import org.apache.flex.utils.CSSUtils; CSSUtils;
+ COMPILE::JS
+ {
+ import org.apache.flex.utils.Language; Language;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4b60eaa1/frameworks/projects/Core/as/src/org/apache/flex/utils/Language.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/utils/Language.as b/frameworks/projects/Core/as/src/org/apache/flex/utils/Language.as
index b8356b0..342d696 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/utils/Language.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/utils/Language.as
@@ -23,7 +23,15 @@ package org.apache.flex.utils
COMPILE::AS3
public class Language {}
- COMPILE::JS
+ COMPILE::JS
+ {
+ import goog.bind;
+ }
+
+ /**
+ * @flexjsignoreimport goog.bind
+ */
+ COMPILE::JS
public class Language
{
@@ -36,25 +44,24 @@ package org.apache.flex.utils
//--------------------------------------
/**
- * _as()
+ * as()
*
- * @export
- * @param {?} leftOperand The lefthand operand of the
+ * @param leftOperand The lefthand operand of the
* binary as operator in AS3.
- * @param {?} rightOperand The righthand operand of the
+ * @param rightOperand The righthand operand of the
* binary operator in AS3.
- * @param {?=} coercion The cast is a coercion,
- * throw expception if it fails.
- * @return {?} Returns the lefthand operand if it is of the
+ * @param coercion The cast is a coercion,
+ * throw exception if it fails.
+ * @return Returns the lefthand operand if it is of the
* type of the righthand operand, otherwise null.
*/
- static public function _as(leftOperand:Object, rightOperand:Object, coercion:* = null):Object
+ static public function as(leftOperand:Object, rightOperand:Object, coercion:* = null):Object
{
var error:Error, itIs:Boolean, message:String;
coercion = (coercion !== undefined) ? coercion : false;
- itIs = _is(leftOperand, rightOperand);
+ itIs = Language.is(leftOperand, rightOperand);
if (!itIs && coercion)
{
@@ -78,8 +85,7 @@ package org.apache.flex.utils
/**
* int()
*
- * @export
- * @param {?} value The value to be cast.
+ * @param value The value to be cast.
* @return {number}
*/
static public function _int(value:Number):Number
@@ -88,16 +94,15 @@ package org.apache.flex.utils
}
/**
- * _is()
+ * is()
*
- * @export
- * @param {?} leftOperand The lefthand operand of the
+ * @param leftOperand The lefthand operand of the
* binary as operator in AS3.
- * @param {?} rightOperand The righthand operand of the
+ * @param rightOperand The righthand operand of the
* binary operator in AS3.
* @return {boolean}
*/
- static public function _is(leftOperand:Object, rightOperand:Object):Boolean
+ static public function is(leftOperand:Object, rightOperand:Object):Boolean
{
var checkInterfaces:Function, superClass:Object;
@@ -110,7 +115,7 @@ package org.apache.flex.utils
}
checkInterfaces = function(left:Object):Boolean {
- var i:uint, interfaces:Array;
+ var i:int, interfaces:Array;
interfaces = left.FLEXJS_CLASS_INFO.interfaces;
for (i = interfaces.length - 1; i > -1; i--) {
@@ -127,8 +132,8 @@ package org.apache.flex.utils
return false;
};
- if ((rightOperand === String && typeof leftOperand === 'string') ||
- (leftOperand instanceof /** @type {Object} */(rightOperand)))
+ if ((rightOperand === String && typeof(leftOperand) === 'string') ||
+ (leftOperand instanceof (rightOperand)))
{
return true;
}
@@ -153,7 +158,8 @@ package org.apache.flex.utils
}
}
- superClass = leftOperand.constructor.superClass_;
+ superClass = leftOperand.constructor;
+ superClass = superClass.superClass_;
if (superClass)
{
@@ -166,7 +172,8 @@ package org.apache.flex.utils
return true;
}
}
- superClass = superClass.constructor.superClass_;
+ superClass = superClass.constructor;
+ superClass = superClass.superClass_;
}
}
@@ -176,9 +183,8 @@ package org.apache.flex.utils
/**
* postdecrement handles foo++
*
- * @export
- * @param {Object} obj The object with the getter/setter.
- * @param {string} prop The name of a property.
+ * @param obj The object with the getter/setter.
+ * @param prop The name of a property.
* @return {number}
*/
static public function postdecrement(obj:Object, prop:String):int
@@ -191,9 +197,8 @@ package org.apache.flex.utils
/**
* postincrement handles foo++
*
- * @export
- * @param {Object} obj The object with the getter/setter.
- * @param {string} prop The name of a property.
+ * @param obj The object with the getter/setter.
+ * @param prop The name of a property.
* @return {number}
*/
static public function postincrement(obj:Object, prop:String):int
@@ -206,9 +211,8 @@ package org.apache.flex.utils
/**
* predecrement handles ++foo
*
- * @export
- * @param {Object} obj The object with the getter/setter.
- * @param {string} prop The name of a property.
+ * @param obj The object with the getter/setter.
+ * @param prop The name of a property.
* @return {number}
*/
static public function predecrement(obj:Object, prop:String):int
@@ -221,9 +225,8 @@ package org.apache.flex.utils
/**
* preincrement handles --foo
*
- * @export
- * @param {Object} obj The object with the getter/setter.
- * @param {string} prop The name of a property.
+ * @param obj The object with the getter/setter.
+ * @param prop The name of a property.
* @return {number}
*/
static public function preincrement(obj:Object, prop:String):int
@@ -236,10 +239,9 @@ package org.apache.flex.utils
/**
* superGetter calls the getter on the given class' superclass.
*
- * @export
- * @param {Object} clazz The class.
- * @param {Object} pthis The this pointer.
- * @param {string} prop The name of the getter.
+ * @param clazz The class.
+ * @param pthis The this pointer.
+ * @param prop The name of the getter.
* @return {Object}
*/
static public function superGetter(clazz:Object, pthis:Object, prop:String):Object
@@ -249,7 +251,8 @@ package org.apache.flex.utils
while (superdesc == null)
{
- superClass = superClass.constructor.superClass_;
+ superClass = superClass.constructor;
+ superClass = superClass.superClass_;
superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
}
return superdesc.get.call(pthis);
@@ -258,11 +261,10 @@ package org.apache.flex.utils
/**
* superSetter calls the setter on the given class' superclass.
*
- * @export
- * @param {Object} clazz The class.
- * @param {Object} pthis The this pointer.
- * @param {string} prop The name of the getter.
- * @param {Object} value The value.
+ * @param clazz The class.
+ * @param pthis The this pointer.
+ * @param prop The name of the getter.
+ * @param value The value.
*/
static public function superSetter(clazz:Object, pthis:Object, prop:String, value:Object):void
{
@@ -271,7 +273,8 @@ package org.apache.flex.utils
while (superdesc == null)
{
- superClass = superClass.constructor.superClass_;
+ superClass = superClass.constructor;
+ superClass = superClass.superClass_;
superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
}
superdesc.set.apply(pthis, [value]);
@@ -280,10 +283,11 @@ package org.apache.flex.utils
static public function trace(...rest):void
{
var theConsole:*;
+ var windowConsole:* = window.console;
var msg:String = '';
- for (var i:uint = 0; i < rest.length; i++)
+ for (var i:int = 0; i < rest.length; i++)
{
if (i > 0)
msg += ' ';
@@ -292,8 +296,8 @@ package org.apache.flex.utils
theConsole = ["goog"]["global"]["console"];
- if (theConsole === undefined && window.console !== undefined)
- theConsole = window.console;
+ if (theConsole === undefined && windowConsole !== undefined)
+ theConsole = windowConsole;
try
{
@@ -311,13 +315,32 @@ package org.apache.flex.utils
/**
* uint()
*
- * @export
- * @param {?} value The value to be cast.
+ * @param value The value to be cast.
* @return {number}
*/
static public function uint(value:Number):Number
{
return value >>> 0;
}
+
+ /**
+ * caches closures and returns the one closure
+ *
+ * @param fn The method on the instance.
+ * @param object The instance.
+ * @param boundMethodName The name to use to cache the closure.
+ * @return The closure.
+ */
+ static public function closure(fn:Function, object:Object, boundMethodName:String):Function {
+ if (object.hasOwnProperty(boundMethodName)) {
+ return object[boundMethodName];
+ }
+ var boundMethod:Function = goog.bind(fn, object);
+ Object.defineProperty(object, boundMethodName, {
+ value: boundMethod
+ });
+ return boundMethod;
+ };
+
}
}
[3/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean
build of Binding
Posted by ah...@apache.org.
clean build of Binding
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3b15aba6
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3b15aba6
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3b15aba6
Branch: refs/heads/core_js_to_as
Commit: 3b15aba62b45de2a9d408cbfd9044f03405edaa8
Parents: f760c09
Author: Alex Harui <ah...@apache.org>
Authored: Sun Nov 1 21:25:19 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Nov 1 21:25:19 2015 -0800
----------------------------------------------------------------------
.../src/org/apache/flex/binding/WatcherBase.as | 28 +++++++++++++-
frameworks/projects/Binding/build.xml | 39 +++++---------------
.../projects/Binding/compile-asjs-config.xml | 7 ++--
3 files changed, 39 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3b15aba6/frameworks/projects/Binding/as/src/org/apache/flex/binding/WatcherBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/as/src/org/apache/flex/binding/WatcherBase.as b/frameworks/projects/Binding/as/src/org/apache/flex/binding/WatcherBase.as
index 7ec0805..58bee54 100644
--- a/frameworks/projects/Binding/as/src/org/apache/flex/binding/WatcherBase.as
+++ b/frameworks/projects/Binding/as/src/org/apache/flex/binding/WatcherBase.as
@@ -253,8 +253,22 @@ package org.apache.flex.binding
}
}
- if (allowedErrors.indexOf(error.errorID) == -1)
+ COMPILE::AS3
+ {
+ if (allowedErrors.indexOf(error.errorID) == -1)
+ throw error;
+ }
+ COMPILE::JS
+ {
+ var s:String = error.message;
+ n = allowedErrors.length;
+ for (i = 0; i < n; i++)
+ {
+ if (s.indexOf(allowedErrors[i]) != -1)
+ return;
+ }
throw error;
+ }
}
}
@@ -267,6 +281,7 @@ package org.apache.flex.binding
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
+ COMPILE::AS3
public static var allowedErrors:Array = [
1006, // Error #1006: Call attempted on an object that is not a function.
1009, // Error #1009: null has no properties.
@@ -274,7 +289,16 @@ package org.apache.flex.binding
1055, // Error #1055: - has no properties.
1069, // Error #1069: Property - not found on - and there is no default value
1507 // Error #1507: - invalid null argument.
- ];
+ ];
+ COMPILE::JS
+ public static var allowedErrors:Array = [
+ "Call attempted on an object that is not a function.",
+ "null has no properties.",
+ "undefined has no properties.",
+ "has no properties.",
+ "and there is no default value",
+ "invalid null argument."
+ ];
/**
* Certain errors classes are normal when executing an update, so we swallow all
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3b15aba6/frameworks/projects/Binding/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/build.xml b/frameworks/projects/Binding/build.xml
index b8151b9..e3ad23a 100644
--- a/frameworks/projects/Binding/build.xml
+++ b/frameworks/projects/Binding/build.xml
@@ -37,7 +37,7 @@
<target name="main" depends="clean,compile,test" description="Clean build of Binding.swc">
</target>
- <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Binding.swc">
+ <target name="all" depends="clean,compile-asjs,compile,test-js" description="Full build of Binding.swc">
</target>
<target name="test" unless="is.jenkins">
@@ -97,11 +97,13 @@
<load-config filename="compile-config.xml" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-define=COMPILE::AS3,true" />
+ <arg value="-define=COMPILE::JS,false" />
</compc>
</target>
- <target name="compile-asjs" >
- <echo message="Cross-compiling Binding/asjs"/>
+ <target name="compile-asjs">
+ <echo message="Cross-compiling Binding"/>
<echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
<java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
<jvmarg value="-Xmx384m" />
@@ -116,10 +118,14 @@
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
</java>
</target>
- <target name="lint-js" depends="gjslint, jshint, copy-js" />
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
<fileset dir="${basedir}/js/src">
@@ -131,29 +137,4 @@
</copy>
</target>
- <target name="gjslint" unless="no.lint">
- <echo>running gjslint</echo>
- <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
- <arg value="--strict" />
- <arg value="--disable" />
- <arg value="006,100,214,300" />
- <!-- 006: wrong indentation -->
- <!-- 100: cannot have non-primitive value -->
- <!-- 214: @fileoverview tag missing description -->
- <!-- 300: missing newline at end of file -->
- <arg value="--max_line_length" />
- <arg value="120" />
- <arg value="-r" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
- <target name="jshint" unless="no.lint">
- <echo>running jshint</echo>
- <exec executable="${jshint}" dir="${basedir}" failonerror="true">
- <arg value="--config" />
- <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3b15aba6/frameworks/projects/Binding/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/compile-asjs-config.xml b/frameworks/projects/Binding/compile-asjs-config.xml
index 8a0395b..b3de2fd 100644
--- a/frameworks/projects/Binding/compile-asjs-config.xml
+++ b/frameworks/projects/Binding/compile-asjs-config.xml
@@ -46,12 +46,11 @@
<!-- asjscompc won't 'link' these classes in, but will list their requires
if these swcs are on the external-library-path then their requires
will not be listed -->
- <path-element>../../libs/Core.swc</path-element>
- <path-element>../../libs/Binding.swc</path-element>
+ <path-element>../../externs/Core.swc</path-element>
</library-path>
<source-path>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
@@ -61,7 +60,7 @@
</include-file>
<include-sources>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</include-sources>
<include-namespaces>
[4/7] git commit: [flex-asjs] [refs/heads/core_js_to_as] - extern swc
Posted by ah...@apache.org.
extern swc
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/352980b9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/352980b9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/352980b9
Branch: refs/heads/core_js_to_as
Commit: 352980b99a890bec14900f9e0e59a215596812af
Parents: 3b15aba
Author: Alex Harui <ah...@apache.org>
Authored: Mon Nov 2 10:32:34 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Nov 2 10:32:34 2015 -0800
----------------------------------------------------------------------
frameworks/projects/Binding/build.xml | 38 +++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/352980b9/frameworks/projects/Binding/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Binding/build.xml b/frameworks/projects/Binding/build.xml
index e3ad23a..c8f9c5f 100644
--- a/frameworks/projects/Binding/build.xml
+++ b/frameworks/projects/Binding/build.xml
@@ -37,7 +37,7 @@
<target name="main" depends="clean,compile,test" description="Clean build of Binding.swc">
</target>
- <target name="all" depends="clean,compile-asjs,compile,test-js" description="Full build of Binding.swc">
+ <target name="all" depends="clean,compile-asjs,compile-extern-swc,compile,test-js" description="Full build of Binding.swc">
</target>
<target name="test" unless="is.jenkins">
@@ -126,6 +126,42 @@
</java>
</target>
+ <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+ <echo message="Compiling externs/Binding.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <!-- make JS output folder now so include-file doesn't error -->
+ <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in CoreClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <compc fork="true"
+ output="${FLEXJS_HOME}/frameworks/externs/Binding.swc">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="compile-asjs-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
+ </compc>
+ </target>
+
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
<fileset dir="${basedir}/js/src">