You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/04/18 15:26:38 UTC

[15/50] git commit: [flex-asjs] [refs/heads/feature/maven-migration] - Starting on XML tests

Starting on XML tests


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

Branch: refs/heads/feature/maven-migration
Commit: dbcc3b118507769026dfda03ca5689993669272e
Parents: 1ffb32f
Author: Harbs <ha...@in-tools.com>
Authored: Wed Apr 6 18:23:33 2016 -0700
Committer: Harbs <ha...@in-tools.com>
Committed: Wed Apr 6 18:23:33 2016 -0700

----------------------------------------------------------------------
 frameworks/projects/XML/src/main/flex/XML.as    |   4 +
 manualtests/XMLTest/build.xml                   |  72 +++++++++++
 manualtests/XMLTest/src/MyInitialView.mxml      |  72 +++++++++++
 manualtests/XMLTest/src/README.txt              |  45 +++++++
 manualtests/XMLTest/src/ReflectionTest.mxml     |  40 ++++++
 .../XMLTest/src/controllers/MyController.as     |  52 ++++++++
 manualtests/XMLTest/src/models/MyModel.as       | 125 +++++++++++++++++++
 7 files changed, 410 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/frameworks/projects/XML/src/main/flex/XML.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/XML.as b/frameworks/projects/XML/src/main/flex/XML.as
index 26d185b..27a7094 100644
--- a/frameworks/projects/XML/src/main/flex/XML.as
+++ b/frameworks/projects/XML/src/main/flex/XML.as
@@ -734,6 +734,8 @@ package
 				5. Return list
 			*/
 			var i:int;
+			if(!name)
+				name = "*";
 			name = toXMLName(name);
 			var list:XMLList = new XMLList();
 			if(name.isAttribute)
@@ -766,6 +768,8 @@ package
 		 */
 		public function elements(name:Object = "*"):XMLList
 		{
+			if(!name)
+				name = "*";
 			name = toXMLName(name);
 			var i:int;
 			var list:XMLList = new XMLList();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/build.xml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/build.xml b/manualtests/XMLTest/build.xml
new file mode 100644
index 0000000..6370e2d
--- /dev/null
+++ b/manualtests/XMLTest/build.xml
@@ -0,0 +1,72 @@
+<?xml version="1.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.
+
+-->
+
+
+<project name="xmltest" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../.."/>
+    <property name="example" value="ReflectionTest" />
+    
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+    <!-- use this to add keep metadata option -->
+    <property name="theme_arg" value="-keep-as3-metadata+=Event" />
+    <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+    type="file"
+    property="FALCON_HOME"
+    value="${env.FALCON_HOME}"/>
+    
+    <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
+    type="file"
+    property="FALCON_HOME"
+    value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
+    
+    <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+    type="file"
+    property="FALCONJX_HOME"
+    value="${env.FALCONJX_HOME}"/>
+    
+    <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
+    type="file"
+    property="FALCONJX_HOME"
+    value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
+    
+    <available file="${env.GOOG_HOME}/closure/goog/base.js"
+    type="file"
+    property="GOOG_HOME"
+    value="${env.GOOG_HOME}"/>
+    
+    <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
+    type="file"
+    property="GOOG_HOME"
+    value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
+    
+    <include file="${basedir}/../build_example.xml" />
+
+    <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of FlexJSUI.swc">
+    </target>
+    
+    <target name="clean">
+        <delete dir="${basedir}/bin" failonerror="false" />
+        <delete dir="${basedir}/bin-debug" failonerror="false" />
+        <delete dir="${basedir}/bin-release" failonerror="false" />
+    </target>
+
+</project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/MyInitialView.mxml b/manualtests/XMLTest/src/MyInitialView.mxml
new file mode 100644
index 0000000..0f9eab0
--- /dev/null
+++ b/manualtests/XMLTest/src/MyInitialView.mxml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<js:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+				xmlns:js="library://ns.apache.org/flexjs/basic"
+				xmlns:local="*" 
+				xmlns:models="models.*" 
+				xmlns:acc="org.apache.flex.html.accessories.*">
+	
+	<fx:Style>
+		.title {
+			font-size: 14pt;
+			font-weight: bold;
+		}
+
+	</fx:Style>
+	
+	<fx:Script>
+		<![CDATA[			
+			import org.apache.flex.core.IPopUpHost;
+			import org.apache.flex.events.Event;
+			import org.apache.flex.utils.UIUtils;
+						
+            import org.apache.flex.reflection.describeType;
+            import org.apache.flex.reflection.MetaDataArgDefinition;
+            import org.apache.flex.reflection.MetaDataDefinition;
+            import org.apache.flex.reflection.MethodDefinition;
+            import org.apache.flex.reflection.TypeDefinition;
+            
+            [Event(name="foo", type="org.apache.flex.events.Event")]
+            public function runTest():void
+            {
+                var metadata:Array;
+                var mtd:MetaDataDefinition;
+                var mtdarg:MetaDataArgDefinition;
+                var args:Array;
+                var j:int;
+                var m:int;
+                var xml1:XML = <foo baz="true"/>;
+                trace(xmll1);
+                trace(xml1.baz);
+
+            }
+		]]>
+	</fx:Script>
+	
+	<js:Container id="cont" width="600" height="700" x="50" y="50">
+		<js:beads>
+			<js:VerticalLayout />
+		</js:beads>
+		
+		<js:Label text="XML Test" className="title" />
+		<js:TextButton text="Test" click="runTest()" />
+	</js:Container>
+	
+</js:ViewBase>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/src/README.txt
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/README.txt b/manualtests/XMLTest/src/README.txt
new file mode 100644
index 0000000..f38df7f
--- /dev/null
+++ b/manualtests/XMLTest/src/README.txt
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+DESCRIPTION
+
+The FormExample application demonstrates several FlexJS components and how they
+can be aligned in a column, much like you would see in a form. 
+
+This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
+into JavaScript and HTML and run without Flash.
+
+The components are placed into a Container with a VerticalColumnLayout bead. This bead
+examines each of the children in the Container and aligns them in two columns.
+
+COMPONENTS and BEADS
+
+- Container
+- DateField
+- Label
+- TextInput
+
+- NonVirtualVerticalLayout
+- NumericOnlyTextInputBead
+- VerticalColumnLayout
+
+NOTES
+
+The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
+should be addressed in future releases of the Falcon JX compiler.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/src/ReflectionTest.mxml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/ReflectionTest.mxml b/manualtests/XMLTest/src/ReflectionTest.mxml
new file mode 100644
index 0000000..27e97b5
--- /dev/null
+++ b/manualtests/XMLTest/src/ReflectionTest.mxml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+				   xmlns:local="*"
+				   xmlns:models="models.*"
+                   xmlns:controllers="controllers.*"
+				   xmlns:js="library://ns.apache.org/flexjs/basic" 
+				   >
+	
+	<js:valuesImpl>
+		<js:SimpleCSSValuesImpl />
+	</js:valuesImpl>
+    <js:controller>
+        <controllers:MyController />
+    </js:controller>
+    <js:model>
+        <models:MyModel />
+    </js:model>
+	<js:initialView>
+		<local:MyInitialView />
+	</js:initialView>
+</js:Application>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/src/controllers/MyController.as
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/controllers/MyController.as b/manualtests/XMLTest/src/controllers/MyController.as
new file mode 100644
index 0000000..81eb963
--- /dev/null
+++ b/manualtests/XMLTest/src/controllers/MyController.as
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 controllers
+{
+	import org.apache.flex.events.Event;
+	
+	import org.apache.flex.core.Application;
+	import org.apache.flex.core.IDocument;
+    
+    import models.MyModel;
+    	
+	public class MyController implements IDocument
+	{
+		public function MyController(app:Application = null)
+		{
+			if (app)
+			{
+				this.app = app as ReflectionTest;
+				app.addEventListener("viewChanged", viewChangeHandler);
+			}
+		}
+		
+		private var app:ReflectionTest;
+		
+		private function viewChangeHandler(event:Event):void
+		{
+		}
+		        
+		public function setDocument(document:Object, id:String = null):void
+		{
+			this.app = document as ReflectionTest;
+			app.addEventListener("viewChanged", viewChangeHandler);
+		}
+
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dbcc3b11/manualtests/XMLTest/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/models/MyModel.as b/manualtests/XMLTest/src/models/MyModel.as
new file mode 100644
index 0000000..5a16d02
--- /dev/null
+++ b/manualtests/XMLTest/src/models/MyModel.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 models
+{
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	
+	public class MyModel extends EventDispatcher
+	{
+		public function MyModel()
+		{
+		}
+		
+		private var _requestedField:String = "Ask";
+		
+		[Bindable("requestedFieldChanged")]
+		public function get requestedField():String
+		{
+			return _requestedField;
+		}
+		
+		public function set requestedField(value:String):void
+		{
+			if (value != _requestedField)
+			{
+				_requestedField = value;
+				dispatchEvent(new Event("requestedFieldChanged"));
+				if (_responseData)
+					dispatchEvent(new Event("responseTextChanged"));
+			}
+		}
+		
+		[Bindable("responseTextChanged")]
+		public function get responseText():String
+		{
+			if (_responseData == null)
+				return "";
+			if (_responseData == "No Data")
+				return _responseData as String;
+			var s:String = _responseData[_requestedField];
+			if (s == null)
+			{
+				if (_requestedField == "Ask")
+					s = _responseData["Bid"];
+			}
+			return s;
+		}
+		
+		private var _responseData:Object;
+		
+		[Bindable("responseDataChanged")]
+		public function get responseData():Object
+		{
+			return _responseData;
+		}
+		
+		public function set responseData(value:Object):void
+		{
+			if (value != _responseData)
+			{
+				_responseData = value;
+				_allData = "";
+				dispatchEvent(new Event("responseDataChanged"));
+				dispatchEvent(new Event("responseTextChanged"));
+			}
+		}
+		
+		private var _allData:String = "";
+		
+		[Bindable("responseDataChanged")]
+		public function get allData():String
+		{
+			if (_allData == "" && _responseData != null)
+			{
+				for (var p:String in _responseData)
+				{
+					_allData += p + ": " + _responseData[p] + "\n";
+				}
+			}
+			return _allData;
+		}
+		
+		
+		private var _stockSymbol:String;
+		
+		[Bindable("stockSymbolChanged")]
+		public function get stockSymbol():String
+		{
+			return _stockSymbol;
+		}
+		
+		public function set stockSymbol(value:String):void
+		{
+			if (value != _stockSymbol)
+			{
+				_stockSymbol = value;
+				dispatchEvent(new Event("stockSymbolChanged"));
+			}
+		}
+
+        private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
+        [Bindable("__NoChangeEvent__")]
+        public function get strings():Array
+        {
+            return _strings;
+        }
+
+	}
+}
\ No newline at end of file