You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/22 20:35:06 UTC

[royale-asjs] branch develop updated: New HTTPService Blog example

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8410373  New HTTPService Blog example
8410373 is described below

commit 8410373c5b28967d1e719d7726eac3b53de7210f
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Sep 22 22:34:58 2018 +0200

    New HTTPService Blog example
---
 ...ithub_external_data_through_HTTPService.as3proj | 95 +++++++++++++++++++++
 .../README.txt                                     | 28 +++++++
 .../asconfig.json                                  | 34 ++++++++
 .../build.xml                                      | 63 ++++++++++++++
 .../pom.xml                                        | 98 ++++++++++++++++++++++
 .../resources/jewel-example-index-template.html    | 30 +++++++
 ...g_Github_external_data_through_HTTPService.mxml | 60 +++++++++++++
 .../src/main/royale/services/GitHubService.as      |  4 +-
 .../src/main/royale/services/GitHubService.as      |  4 +-
 9 files changed, 412 insertions(+), 4 deletions(-)

diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/BE0011_Loading_Github_external_data_through_HTTPService.as3proj b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/BE0011_Loading_Github_external_data_through_HTTPService.as3proj
new file mode 100644
index 0000000..f904c84
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/BE0011_Loading_Github_external_data_through_HTTPService.as3proj
@@ -0,0 +1,95 @@
+<?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>
+  <output>
+    <movie disabled="False"/>
+    <movie path="bin-debug/BE0010_Customization_through_the_Royale_API.swf"/>
+    <movie version="11"/>
+    <movie input=""/>
+    <movie width="800"/>
+    <movie height="600"/>
+    <movie fps="60"/>
+    <movie background="#FFFFFF"/>
+    <movie platform="Flash Player"/>
+  </output>
+  &lt;!-- Other classes to be compiled into your SWF --&gt;
+  <classpaths>
+    <class path="src/main/royale"/>
+  </classpaths>
+  <moonshineResourcePaths></moonshineResourcePaths>
+  <moonshineNativeExtensionPaths></moonshineNativeExtensionPaths>
+  <build>
+    <option useResourceBundleMetadata="True"/>
+    <option showBindingWarnings="True"/>
+    <option warnings="True"/>
+    <option es="False"/>
+    <option verboseStackTraces="False"/>
+    <option additional="-theme=${royalelib}/themes/Jewel-Light-NoFlat-Primary-Blue-Theme/src/main/resources/defaults.css -html-template=src/main/resources/jewel-example-index-template.html"/>
+    <option loadConfig=""/>
+    <option linkReport=""/>
+    <option benchmark="False"/>
+    <option optimize="False"/>
+    <option showActionScriptWarnings="True"/>
+    <option staticLinkRSL="False"/>
+    <option locale=""/>
+    <option compilerConstants=""/>
+    <option showDeprecationWarnings="True"/>
+    <option antBuildPath="build/build.xml"/>
+    <option showUnusedTypeSelectorWarnings="True"/>
+    <option customSDK=""/>
+    <option strict="True"/>
+    <option accessible="False"/>
+    <option useNetwork="True"/>
+    <option allowSourcePathOverlap="False"/>
+  </build>
+  <includeLibraries></includeLibraries>
+  <libraryPaths></libraryPaths>
+  <externalLibraryPaths></externalLibraryPaths>
+  <rslPaths></rslPaths>
+  <intrinsics>
+    <element path="Library/AS3/frameworks/Flex4"/>
+    <element path="Library\AS3\frameworks\Flex4"/>
+  </intrinsics>
+  <library></library>
+  <compileTargets>
+    <compile path="src/main/royale/BE0010_Customization_through_the_Royale_API.mxml"/>
+  </compileTargets>
+  <hiddenPaths></hiddenPaths>
+  <preBuildCommand>null</preBuildCommand>
+  <postBuildCommand alwaysRun="False">null</postBuildCommand>
+  <options>
+    <option testMovie=""/>
+    <option showHiddenPaths="False"/>
+    <option testMovieCommand=""/>
+    <option defaultBuildTargets=""/>
+    <option isPrimeFacesVisualEditor="False"/>
+  </options>
+  <moonshineRunCustomization>
+    <option deviceSimulator="null"/>
+    <option targetPlatform="2"/>
+    <option launchMethod="Simulator"/>
+    <option urlToLaunch=""/>
+    <option projectType="2"/>
+    <deviceSimulator>null</deviceSimulator>
+    <certAndroid>null</certAndroid>
+    <certIos>null</certIos>
+    <certIosProvisioning>null</certIosProvisioning>
+  </moonshineRunCustomization>
+</project>
\ No newline at end of file
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/README.txt b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/README.txt
new file mode 100644
index 0000000..0ae715c
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/README.txt
@@ -0,0 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+
+Customization through the Royale API
+
+Learn how to use the powerful Royale APIs to get access to internals and customize to your needs in a Royale application.
+
+Source code of the code exposed in the following Apache Royale Blog Example post:
+
+https://royale.apache.org//customization-through-the-royale-api/
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/asconfig.json b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/asconfig.json
new file mode 100644
index 0000000..11e01f3
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/asconfig.json
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+{
+    "config": "royale",
+    "compilerOptions": {
+        "debug": false,
+        "targets": ["JSRoyale"],
+        "source-map": true,
+        "html-template": "src/main/resources/jewel-example-index-template.html",
+        "theme": "${royalelib}/themes/JewelTheme/src/main/resources/defaults.css"
+    },
+    "copySourcePathAssets": true,
+    "additionalOptions": "-remove-circulars -js-output-optimization=skipAsCoercions",
+    "files":
+    [
+        "src/main/royale/BE0011_Loading_Github_external_data_through_HTTPService.mxml"
+    ]
+}
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/build.xml b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/build.xml
new file mode 100644
index 0000000..835f21a
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/build.xml
@@ -0,0 +1,63 @@
+<?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="BE0010_Customization_through_the_Royale_API" default="main" basedir=".">
+    <property name="ROYALE_HOME" location="../../.."/>
+    <property name="example" value="App" />
+    
+    <property file="${ROYALE_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${ROYALE_HOME}/build.properties"/>
+    <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
+
+    <include file="${basedir}/../../build_example.xml" />
+    
+    <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}">
+        <mkdir dir="${basedir}/bin/js-debug/assets" />
+        <copy todir="${basedir}/bin/js-debug/assets" failonerror="false">
+            <fileset dir="${basedir}/src/main/resources/assets">
+                <include name="**" />
+            </fileset>
+        </copy>
+        <mkdir dir="${basedir}/bin/js-release/assets" />
+        <copy todir="${basedir}/bin/js-release/assets" failonerror="false">
+            <fileset dir="${basedir}/src/main/resources/assets">
+                <include name="**" />
+            </fileset>
+        </copy>
+    </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>
+
+    <target name="examine" depends="build_example.get.browser">
+        <property name="which" value="debug" />
+        <echo message="See various team members."/>
+        <exec executable="${browser}" dir="${basedir}/bin/js-${which}" failonerror="true">
+            <arg value="${basedir}/bin/js-${which}/index.html"/>
+        </exec>
+    </target>
+
+</project>
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/pom.xml b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/pom.xml
new file mode 100644
index 0000000..d03e1d7
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/pom.xml
@@ -0,0 +1,98 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.royale.examples</groupId>
+    <artifactId>examples-blog</artifactId>
+    <version>0.9.4-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>BE0011_Loading_Github_external_data_through_HTTPService</artifactId>
+  <version>0.9.4-SNAPSHOT</version>
+  <packaging>swf</packaging>
+
+  <name>Apache Royale: Examples: Blog: 0011: Loading Github external data through HTTPService</name>
+
+  <build>
+    <sourceDirectory>src/main/royale</sourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.royale.compiler</groupId>
+        <artifactId>royale-maven-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <mainClass>BE0011_Loading_Github_external_data_through_HTTPService.mxml</mainClass>
+          <targets>SWF, JSRoyale</targets>
+          <debug>false</debug>
+          <htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.adobe.flash.framework</groupId>
+      <artifactId>playerglobal</artifactId>
+      <version>${flash.version}</version>
+      <type>swc</type>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>Network</artifactId>
+      <version>0.9.4-SNAPSHOT</version>
+      <type>swc</type>
+      <classifier>swf</classifier>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>Network</artifactId>
+      <version>0.9.4-SNAPSHOT</version>
+      <type>swc</type>
+      <classifier>js</classifier>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>Jewel</artifactId>
+      <version>0.9.4-SNAPSHOT</version>
+      <type>swc</type>
+      <classifier>swf</classifier>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>Jewel</artifactId>
+      <version>0.9.4-SNAPSHOT</version>
+      <type>swc</type>
+      <classifier>js</classifier>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.royale.framework</groupId>
+      <artifactId>Jewel-Light-NoFlat-Primary-Red-Theme</artifactId>
+      <version>0.9.4-SNAPSHOT</version>
+      <type>swc</type>
+      <scope>theme</scope>
+      <classifier>js</classifier>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/resources/jewel-example-index-template.html b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/resources/jewel-example-index-template.html
new file mode 100644
index 0000000..140ba98
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/resources/jewel-example-index-template.html
@@ -0,0 +1,30 @@
+<!--
+  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.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta name="Custom Template for injecting custom style CSS">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
+    <link rel="stylesheet" type="text/css" href="${application}.css">
+    <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
+${head}
+</head>
+<body>
+${body}
+</body>
+</html>
diff --git a/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/BE0011_Loading_Github_external_data_through_HTTPService.mxml b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/BE0011_Loading_Github_external_data_through_HTTPService.mxml
new file mode 100644
index 0000000..b4db405
--- /dev/null
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/BE0011_Loading_Github_external_data_through_HTTPService.mxml
@@ -0,0 +1,60 @@
+<?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.
+
+-->
+<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+               xmlns:j="library://ns.apache.org/royale/jewel"
+               xmlns:js="library://ns.apache.org/royale/basic"
+               xmlns:html="library://ns.apache.org/royale/html"
+               xmlns:services="services.*">
+
+    <fx:Script>
+		<![CDATA[
+            public var github_url:String = "https://api.github.com/repos/apache/royale-asjs/contents/examples/royale/JewelExample/src/main/royale/AlertPlayGround.mxml";
+
+            public function dataReadyHandler(event:Event):void
+			{
+                sourceCodeTextHolder.text = event.target.data;
+			}
+		]]>
+	</fx:Script>
+
+    <services:GitHubService id="service" dataReady="dataReadyHandler(event)"/>
+
+    <j:initialView>
+        <j:View>
+            <js:beads>
+                <j:HorizontalCenteredLayout/>
+            </js:beads>
+
+            <j:Card percentWidth="90">
+                <html:H3 text="Loading Github external data through HTTPService"/>
+                
+                <html:Pre height="400" percentWidth="100" style="background-color: white">
+                    <js:beads>
+                        <j:ScrollingViewport/>
+                    </js:beads>
+                    <html:Code id="sourceCodeTextHolder"/>
+                </html:Pre>
+                
+                <j:Button text="Retrieve source code from github" click="service.sourceCodeUrl = github_url"/>
+             </j:Card>
+        </j:View>
+    </j:initialView>
+
+</j:Application>
\ No newline at end of file
diff --git a/examples/royale/JewelExample/src/main/royale/services/GitHubService.as b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/services/GitHubService.as
similarity index 96%
copy from examples/royale/JewelExample/src/main/royale/services/GitHubService.as
copy to examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/services/GitHubService.as
index 092ae71..666cf36 100644
--- a/examples/royale/JewelExample/src/main/royale/services/GitHubService.as
+++ b/examples/blog/BE0011_Loading_Github_external_data_through_HTTPService/src/main/royale/services/GitHubService.as
@@ -61,11 +61,11 @@ package services
         /**
          * The source code url we want to retrieve
          */
-        private function get sourceCodeUrl():String
+        public function get sourceCodeUrl():String
         {
         	return _sourceCodeUrl;
         }
-        private function set sourceCodeUrl(value:String):void
+        public function set sourceCodeUrl(value:String):void
         {
         	_sourceCodeUrl = value;
             service.url = sourceCodeUrl;
diff --git a/examples/royale/JewelExample/src/main/royale/services/GitHubService.as b/examples/royale/JewelExample/src/main/royale/services/GitHubService.as
index 092ae71..666cf36 100644
--- a/examples/royale/JewelExample/src/main/royale/services/GitHubService.as
+++ b/examples/royale/JewelExample/src/main/royale/services/GitHubService.as
@@ -61,11 +61,11 @@ package services
         /**
          * The source code url we want to retrieve
          */
-        private function get sourceCodeUrl():String
+        public function get sourceCodeUrl():String
         {
         	return _sourceCodeUrl;
         }
-        private function set sourceCodeUrl(value:String):void
+        public function set sourceCodeUrl(value:String):void
         {
         	_sourceCodeUrl = value;
             service.url = sourceCodeUrl;