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/12/17 08:54:23 UTC

[13/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - Back port of jQuery.

Back port of jQuery.


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

Branch: refs/heads/develop
Commit: 426fa5593555fe3fec2e78089988c490b2ec176f
Parents: 0943952
Author: Peter Ent <pe...@apache.org>
Authored: Thu Dec 3 16:08:34 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Dec 3 16:08:34 2015 -0500

----------------------------------------------------------------------
 .../src/org/apache/flex/jquery/Application.as   |  12 ++
 .../as/src/org/apache/flex/jquery/CheckBox.as   |   1 +
 .../src/org/apache/flex/jquery/RadioButton.as   |  14 ++
 .../as/src/org/apache/flex/jquery/TextButton.as |  23 ++++
 .../org/apache/flex/jquery/ToggleTextButton.as  |  61 +--------
 frameworks/projects/JQuery/build.xml            | 131 +++++++++++--------
 .../projects/JQuery/compile-asjs-config.xml     |  87 ++++++++++++
 frameworks/projects/JQuery/compile-config.xml   |   4 +-
 8 files changed, 223 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/Application.as b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/Application.as
index 88e21b3..6cb9229 100644
--- a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/Application.as
+++ b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/Application.as
@@ -21,6 +21,18 @@ package org.apache.flex.jquery
     import org.apache.flex.core.Application;
 	import org.apache.flex.core.IFlexInfo;
 	
+	/*
+	FalconJX will inject html into the index.html file.  Surround with
+	"inject_html" tag as follows:
+	
+	<inject_html>
+	<link rel="stylesheet"
+	href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
+	<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
+	<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
+	</inject_html>
+	*/
+	
 	public class Application extends org.apache.flex.core.Application implements IFlexInfo
 	{
 		public function Application()

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/CheckBox.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/CheckBox.as b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/CheckBox.as
index 9b9cb71..0a98dcd 100644
--- a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/CheckBox.as
+++ b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/CheckBox.as
@@ -22,5 +22,6 @@ package org.apache.flex.jquery
 	
 	public class CheckBox extends org.apache.flex.html.CheckBox 
 	{
+		
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/RadioButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/RadioButton.as b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/RadioButton.as
index e7b64a9..7a9c9e6 100644
--- a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/RadioButton.as
+++ b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/RadioButton.as
@@ -20,7 +20,21 @@ package org.apache.flex.jquery
 {
 	import org.apache.flex.html.RadioButton;
 	
+	COMPILE::AS3
 	public class RadioButton extends org.apache.flex.html.RadioButton
 	{
+		
+	}
+
+	COMPILE::JS
+	public class RadioButton extends org.apache.flex.html.RadioButton
+	{
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			
+			var input:HTMLInputElement = element.childNodes.item(0) as HTMLInputElement;
+			$(input).button();
+		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/TextButton.as b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/TextButton.as
index 43d7dc8..e2c750c 100644
--- a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/TextButton.as
+++ b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/TextButton.as
@@ -20,11 +20,34 @@ package org.apache.flex.jquery
 {
 	import org.apache.flex.html.TextButton;
 	
+	COMPILE::JS {
+		import org.apache.flex.core.WrappedHTMLElement;
+	}
+	
 	public class TextButton extends org.apache.flex.html.TextButton
 	{
 		public function TextButton()
 		{
 			super();
 		}
+	
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			element = document.createElement('button') as WrappedHTMLElement;
+			element.setAttribute('type', 'button');
+			
+			positioner = element;
+			positioner.style.position = 'relative';
+			element.flexjs_wrapper = this;
+			return element;
+		}
+		
+		COMPILE::JS
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			$(element).button();
+		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/ToggleTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/ToggleTextButton.as b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/ToggleTextButton.as
index b76846c..af14a87 100644
--- a/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/ToggleTextButton.as
+++ b/frameworks/projects/JQuery/as/src/org/apache/flex/jquery/ToggleTextButton.as
@@ -18,26 +18,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.jquery
 {
-	import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IToggleButtonModel;
-	import org.apache.flex.core.IUIBase;
-	import org.apache.flex.core.UIButtonBase;
-	import org.apache.flex.core.ValuesManager;
-	import org.apache.flex.events.IEventDispatcher;
-	
-    //--------------------------------------
-    //  Events
-    //--------------------------------------
-    
-    /**
-     *  Dispatched when the user clicks on a button.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-	[Event(name="click", type="org.apache.flex.events.Event")]
+	import org.apache.flex.html.ToggleTextButton;
 
     /**
      *  The ToggleButton class is a TextButton that supports
@@ -48,42 +29,14 @@ package org.apache.flex.jquery
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public class ToggleTextButton extends TextButton implements IStrand, IEventDispatcher, IUIBase
+	public class ToggleTextButton extends org.apache.flex.html.ToggleTextButton
 	{
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		public function ToggleTextButton()
+        
+		COMPILE::JS
+		override public function addedToParent():void
 		{
-			super();
+			super.addedToParent();
+			$(element).button();
 		}
-        
-        /**
-         *  <code>true</code> if the Button is selected.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function get selected():Boolean
-        {
-            return IToggleButtonModel(model).selected;
-        }
-        
-        /**
-         *  @private
-         */
-        public function set selected(value:Boolean):void
-        {
-            IToggleButtonModel(model).selected = value;
-        }
-        
-        
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/build.xml b/frameworks/projects/JQuery/build.xml
index 61b2ac9..ce63aeb 100644
--- a/frameworks/projects/JQuery/build.xml
+++ b/frameworks/projects/JQuery/build.xml
@@ -19,7 +19,7 @@
 -->
 
 
-<project name="JQuery" default="main" basedir=".">
+<project name="jQuery" default="main" basedir=".">
     <property name="FLEXJS_HOME" location="../../.."/>
     
     <property file="${FLEXJS_HOME}/env.properties"/>
@@ -28,35 +28,23 @@
     <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
     <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
     <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
-    <property name="gjslint" value="gjslint" />
-    <property name="jshint" value="jshint" />
-    <condition property="no.lint" value="true">
-        <os family="windows"/>
-    </condition>
-    
-    <target name="main" depends="clean,compile,test" description="Clean build of JQuery.swc">
+
+    <target name="main" depends="clean,compile,test" description="Clean build of jQuery.swc">
     </target>
-    
-    <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of JQuery.swc">
+
+    <target name="all" depends="clean,compile-asjs,compile-extern-swc,copy-js,compile,test" description="Full build of jQuery.swc">
     </target>
-    
+
     <target name="test" unless="is.jenkins">
         <!-- no tests yet
          <ant dir="as/tests" />
-         <ant dir="asjs/tests" />
-         -->
-    </target>
-    
-    <target name="test-js" unless="is.jenkins">
-        <!-- no tests yet
-         <ant dir="js/tests" />
          -->
     </target>
     
     <target name="clean">
         <delete failonerror="false">
             <fileset dir="${FLEXJS_HOME}/frameworks/libs">
-                <include name="JQuery.swc"/>
+                <include name="jQuery.swc"/>
             </fileset>
         </delete>
         <delete failonerror="false">
@@ -71,9 +59,11 @@
     </path>
 
     <target name="compile" description="Compiles .as files into .swc">
-        <echo message="Compiling libs/JQuery.swc"/>
+        <echo message="Compiling libs/jQuery.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="${basedir}/js/out" />
 
         <!-- Load the <compc> task. We can't do this at the <project> level -->
         <!-- because targets that run before flexTasks.jar gets built would fail. -->
@@ -82,7 +72,7 @@
             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 JQueryClasses.as,
+            listed in jQueryClasses.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.
@@ -91,51 +81,84 @@
             into the file bundles.properties in this directory.
         -->
         <compc fork="true"
-               output="${FLEXJS_HOME}/frameworks/libs/JQuery.swc">
+               output="${FLEXJS_HOME}/frameworks/libs/jQuery.swc">
             <jvmarg line="${compc.jvm.args}"/>
             <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 jQuery"/>
+        <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" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/jquery/out/bin/jquery-1.9.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/jQuery.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/jQuery.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" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/jquery/out/bin/jquery-1.9.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" >
+    <target name="copy-js">
         <copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
-            <fileset dir="${basedir}/js/src">
-                <include name="**/**" />
+            <fileset dir="${basedir}/js/out">
+                <include name="**/**"/>
             </fileset>
         </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/426fa559/frameworks/projects/JQuery/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/compile-asjs-config.xml b/frameworks/projects/JQuery/compile-asjs-config.xml
new file mode 100644
index 0000000..3f88534
--- /dev/null
+++ b/frameworks/projects/JQuery/compile-asjs-config.xml
@@ -0,0 +1,87 @@
+<!--
+
+  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.
+
+-->
+<flex-config>
+
+    <compiler>
+        <accessible>false</accessible>
+        
+        <external-library-path>
+            <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+        </external-library-path>
+        
+		<mxml>
+			<children-as-data>true</children-as-data>
+		</mxml>
+		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+        <keep-as3-metadata>
+          <name>Bindable</name>
+          <name>Managed</name>
+          <name>ChangeEvent</name>
+          <name>NonCommittingChangeEvent</name>
+          <name>Transient</name>
+        </keep-as3-metadata>
+	  
+        <locale/>
+        
+        <library-path>
+            <!-- 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>../../externs/Binding.swc</path-element>
+            <path-element>../../externs/Core.swc</path-element>
+            <path-element>../../externs/Graphics.swc</path-element>
+            <path-element>../../externs/Collections.swc</path-element>
+            <path-element>../../externs/HTML.swc</path-element>
+        </library-path>
+        
+        <namespaces>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/jquery</uri>
+                <manifest>jquery-manifest.xml</manifest>
+            </namespace>
+        </namespaces>
+        
+        <source-path>
+            <path-element>as/src</path-element>
+        </source-path>
+        
+        <warn-no-constructor>false</warn-no-constructor>
+    </compiler>
+    
+    <include-file>
+    </include-file>
+
+    <include-sources>
+    </include-sources>
+    
+    <include-classes>
+        <class>HTMLClasses</class>
+    </include-classes>
+    
+    <include-namespaces>
+        <uri>library://ns.apache.org/flexjs/jquery</uri>
+    </include-namespaces>
+        
+    <target-player>${playerglobal.version}</target-player>
+	
+
+</flex-config>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426fa559/frameworks/projects/JQuery/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/JQuery/compile-config.xml b/frameworks/projects/JQuery/compile-config.xml
index 59f2bfb..7c3e1e7 100644
--- a/frameworks/projects/JQuery/compile-config.xml
+++ b/frameworks/projects/JQuery/compile-config.xml
@@ -65,8 +65,8 @@
         <path>as/defaults.css</path>
     </include-file>
     <include-file>
-        <name>js/src/*</name>
-        <path>js/src/*</path>
+        <name>js/out/*</name>
+        <path>js/out/*</path>
     </include-file>
 
     <include-classes>