You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2017/01/26 22:00:44 UTC

flex-tourjs git commit: Added button examples.

Repository: flex-tourjs
Updated Branches:
  refs/heads/develop 8ba2f8b6e -> 678baa99b


Added button examples.


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

Branch: refs/heads/develop
Commit: 678baa99b9fbd8d077817825010c4ae95c04b7cb
Parents: 8ba2f8b
Author: Peter Ent <pe...@apache.org>
Authored: Thu Jan 26 17:00:41 2017 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Jan 26 17:00:41 2017 -0500

----------------------------------------------------------------------
 TourJS/src/main/resources/content.json          |  12 +-
 examples/build.xml                              |   4 +
 .../button/ImageButton/build.xml                |  51 ++++++++
 .../button/ImageButton/pom.xml                  | 129 +++++++++++++++++++
 .../ImageButton/src/main/flex/ImageButton.mxml  |  55 ++++++++
 .../ImageButton/src/main/flex/start-button.png  | Bin 0 -> 79225 bytes
 .../ImageButton/src/main/flex/stop-button.png   | Bin 0 -> 78831 bytes
 .../button/TextButton/build.xml                 |  46 +++++++
 .../TextButton/src/main/flex/TextButton.mxml    |  27 +++-
 9 files changed, 314 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/TourJS/src/main/resources/content.json
----------------------------------------------------------------------
diff --git a/TourJS/src/main/resources/content.json b/TourJS/src/main/resources/content.json
index a649b61..7660d27 100644
--- a/TourJS/src/main/resources/content.json
+++ b/TourJS/src/main/resources/content.json
@@ -30,16 +30,12 @@
                  	  "title":"Button",
                  	  "description": "Describe the Button control",
                  	  "example": [
-                 	  		{"name": "plain.mxml", 
-                 	  		 "source":"content/visualComponents/generalComponents/alert/Alert/src/main/flex/Alert.mxml", 
+                 	  		{"name": "TextButton.mxml", 
+                 	  		 "source":"content/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml", 
                  	  		 "module_swf":"x/y/z", 
                  	  		 "module_js":"x/y/z"},
-                 	  		{"name": "toggle.mxml", 
-                 	  		 "source":"content/visualComponents/generalComponents/alert/Alert/src/main/flex/Alert.mxml", 
-                 	  		 "module_swf":"x/y/z", 
-                 	  		 "module_js":"x/y/z"},
-                 	  		{"name": "radio.mxml", 
-                 	  		 "source":"content/visualComponents/generalComponents/alert/Alert/src/main/flex/Alert.mxml", 
+                 	  		{"name": "ImageButton.mxml", 
+                 	  		 "source":"content/visualComponents/generalComponents/button/ImageButton/src/main/flex/ImageButton.mxml", 
                  	  		 "module_swf":"x/y/z", 
                  	  		 "module_js":"x/y/z"}
                  	  	]},

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/build.xml
----------------------------------------------------------------------
diff --git a/examples/build.xml b/examples/build.xml
index fa27030..bef2239 100644
--- a/examples/build.xml
+++ b/examples/build.xml
@@ -76,6 +76,8 @@
     <target name="compile" description="Compile Examples" >
         <ant dir="${basedir}/visualComponents/generalComponents/alert/Alert"/>
         <ant dir="${basedir}/visualComponents/generalComponents/alert/SimpleAlert"/>
+        <ant dir="${basedir}/visualComponents/generalComponents/button/TextButton"/>
+        <ant dir="${basedir}/visualComponents/generalComponents/button/ImageButton"/>
     </target>
 	   
     <!--
@@ -91,6 +93,8 @@
     <target name="clean" description="Cleans all SWCs and their resource bundles">
         <ant dir="${basedir}/visualComponents/generalComponents/alert/Alert" target="clean"/>
         <ant dir="${basedir}/visualComponents/generalComponents/alert/SimpleAlert" target="clean"/>
+        <ant dir="${basedir}/visualComponents/generalComponents/button/TextButton" target="clean"/>
+        <ant dir="${basedir}/visualComponents/generalComponents/button/ImageButton" target="clean"/>
     </target>
     
 </project>

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/ImageButton/build.xml
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/ImageButton/build.xml b/examples/visualComponents/generalComponents/button/ImageButton/build.xml
new file mode 100644
index 0000000..fc69906
--- /dev/null
+++ b/examples/visualComponents/generalComponents/button/ImageButton/build.xml
@@ -0,0 +1,51 @@
+<?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="button" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../../../../../../flex-asjs"/>
+    <property name="example" value="ImageButton" />
+    
+    <property file="${FLEXJS_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+    <property name="opt1_arg" value="-js-output-optimization=skipAsCoercions" />
+
+    <include file="${basedir}/../../../../build_example.xml" />
+    
+    <target name="copyfiles">
+    	<copy file="${basedir}/src/main/flex/start-button.png" todir="${basedir}/bin-debug" />
+    	<copy file="${basedir}/src/main/flex/stop-button.png" todir="${basedir}/bin-debug" />
+    </target>
+    
+    <target name="main" depends="clean,build_example.compile,build_example.compilejs,copyfiles" description="Clean build of ${example}">
+    </target>
+    
+    <target name="clean">
+        <delete dir="${basedir}/bin" failonerror="false" />
+        <delete dir="${basedir}/bin-debug" failonerror="false" />
+        <delete dir="${basedir}/bin-release" failonerror="false" />
+        <delete dir="${basedir}/target" failonerror="false" />
+    </target>
+
+    
+    
+</project>

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/ImageButton/pom.xml
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/ImageButton/pom.xml b/examples/visualComponents/generalComponents/button/ImageButton/pom.xml
new file mode 100644
index 0000000..8ca3aca
--- /dev/null
+++ b/examples/visualComponents/generalComponents/button/ImageButton/pom.xml
@@ -0,0 +1,129 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.flex.tourjs</groupId>
+    <artifactId>examples-tourjs</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+	<relativePath>../../../../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>TextButton</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>swf</packaging>
+
+  <name>Apache Flex - FlexJS: Examples: FlexJS: TextButton</name>
+
+  <build>
+    <sourceDirectory>src/main/flex</sourceDirectory>
+    <plugins>
+	<plugin>
+	  <groupId>org.apache.flex.flexjs.compiler</groupId>
+          <artifactId>flexjs-maven-plugin</artifactId>
+          <version>${version.flexjs}</version>
+          <extensions>true</extensions>
+          <configuration>
+            <flashVersion>${version.flash}</flashVersion>
+		    <debug>${compiler.debug}</debug>
+			<outputJavaScript>true</outputJavaScript>
+			<mainClass>TextButton.mxml</mainClass>
+          </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.flex.flexjs.compiler</groupId>
+              <artifactId>compiler-jx</artifactId>
+              <version>${version.flexjs}</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+		<executions>
+          <execution>
+            <id>package-javascript</id>
+            <phase>package</phase>
+            <goals>
+              <goal>war</goal>
+            </goals>
+          </execution>
+        </executions>
+		<configuration>
+          <warSourceDirectory>${compiler.output-dir}</warSourceDirectory>
+          <failOnMissingWebXml>false</failOnMissingWebXml>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+		<executions>
+          <execution>
+            <id>attach-war</id>
+            <phase>package</phase>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <artifacts>
+            <artifact>
+              <file>target/textbutton-0.1.0-SNAPSHOT.war</file>
+              <type>war</type>
+            </artifact>
+          </artifacts>
+        </configuration>
+      </plugin>
+    </plugins>
+	</build>
+  <dependencies>
+   <dependency>
+      <groupId>org.apache.flex.flexjs.framework</groupId>
+      <artifactId>Core</artifactId>
+      <version>${version.flexjs}</version>
+      <type>swc</type>
+    </dependency>
+	
+    <dependency>
+      <groupId>com.adobe.flash.framework</groupId>
+      <artifactId>playerglobal</artifactId>
+      <version>${version.flash}</version>
+      <type>swc</type>
+      <scope>provided</scope>
+    </dependency>
+	<dependency>
+      <groupId>org.apache.flex.flexjs.framework</groupId>
+      <artifactId>HTML</artifactId>
+      <version>${version.flexjs}</version>
+      <type>swc</type>
+    </dependency>
+	 <dependency>
+      <groupId>org.apache.flex.flexjs.framework</groupId>
+      <artifactId>Language</artifactId>
+      <version>${version.flexjs}</version>
+      <type>swc</type>
+    </dependency>
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/ImageButton.mxml
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/ImageButton.mxml b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/ImageButton.mxml
new file mode 100644
index 0000000..99227d7
--- /dev/null
+++ b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/ImageButton.mxml
@@ -0,0 +1,55 @@
+<?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:js="library://ns.apache.org/flexjs/basic" >
+    <fx:Script>
+    	<![CDATA[
+    		import org.apache.flex.html.SimpleAlert;
+    		
+    		private function startProcess():void {
+    			SimpleAlert.show("Process started!", mainView);
+    		}
+    		
+    		private function stopProcess():void {
+    			SimpleAlert.show("Process stopped!", mainView);
+    		}
+    		
+    	]]>
+    </fx:Script>
+    <fx:Style>
+    	@namespace js "library://ns.apache.org/flexjs/basic";
+    	
+    	js|ImageButton {
+    	    margin: 10px;
+    	}
+    </fx:Style>
+    <js:valuesImpl>
+        <js:SimpleCSSValuesImpl />
+    </js:valuesImpl>
+    <js:initialView>
+        <js:View id="mainView">
+        	<js:beads>
+        		<js:VerticalLayout />
+        	</js:beads>
+        	<js:ImageButton source="start-button.png" click="startProcess()" />
+        	<js:ImageButton source="stop-button.png" click="stopProcess()" />
+        </js:View>
+    </js:initialView>
+</js:Application>

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/start-button.png
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/start-button.png b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/start-button.png
new file mode 100644
index 0000000..37f612b
Binary files /dev/null and b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/start-button.png differ

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/stop-button.png
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/stop-button.png b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/stop-button.png
new file mode 100644
index 0000000..b434ef3
Binary files /dev/null and b/examples/visualComponents/generalComponents/button/ImageButton/src/main/flex/stop-button.png differ

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/TextButton/build.xml
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/TextButton/build.xml b/examples/visualComponents/generalComponents/button/TextButton/build.xml
new file mode 100644
index 0000000..499ad8a
--- /dev/null
+++ b/examples/visualComponents/generalComponents/button/TextButton/build.xml
@@ -0,0 +1,46 @@
+<?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="button" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../../../../../../flex-asjs"/>
+    <property name="example" value="TextButton" />
+    
+    <property file="${FLEXJS_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+    <property name="opt1_arg" value="-js-output-optimization=skipAsCoercions" />
+
+    <include file="${basedir}/../../../../build_example.xml" />
+    
+    <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+    </target>
+    
+    <target name="clean">
+        <delete dir="${basedir}/bin" failonerror="false" />
+        <delete dir="${basedir}/bin-debug" failonerror="false" />
+        <delete dir="${basedir}/bin-release" failonerror="false" />
+        <delete dir="${basedir}/target" failonerror="false" />
+    </target>
+
+    
+    
+</project>

http://git-wip-us.apache.org/repos/asf/flex-tourjs/blob/678baa99/examples/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml
----------------------------------------------------------------------
diff --git a/examples/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml b/examples/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml
index 95ec65c..556866c 100644
--- a/examples/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml
+++ b/examples/visualComponents/generalComponents/button/TextButton/src/main/flex/TextButton.mxml
@@ -19,12 +19,35 @@ limitations under the License.
 -->
 <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:js="library://ns.apache.org/flexjs/basic" >
+    <fx:Script>
+    	<![CDATA[
+    		import org.apache.flex.html.Alert;
+    		
+    		private function showAlert():void {
+    			Alert.show("This is a standard FlexJS alert. Do you wish to continue?", 
+    			           mainView, 
+    			           "Standard Alert", 
+    			           Alert.YES|Alert.NO);
+    		}
+    	]]>
+    </fx:Script>
+    <fx:Style>
+    	@namespace js "library://ns.apache.org/flexjs/basic";
+    	
+    	js|TextButton {
+    	    margin: 10px;
+    	}
+    </fx:Style>
     <js:valuesImpl>
         <js:SimpleCSSValuesImpl />
     </js:valuesImpl>
     <js:initialView>
-        <js:View>
-        	<js:TextButton text="Hello World!" />
+        <js:View id="mainView">
+        	<js:beads>
+        		<js:VerticalLayout />
+        	</js:beads>
+        	<js:TextButton text="Plain Text Button" />
+        	<js:TextButton text="Show Alert" click="showAlert()" />
         </js:View>
     </js:initialView>
 </js:Application>