You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by al...@apache.org on 2020/10/02 21:01:57 UTC
[royale-asjs] branch develop updated: CruxQuickStartMX added
This is an automated email from the ASF dual-hosted git repository.
alinakazi 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 321d0a9 CruxQuickStartMX added
321d0a9 is described below
commit 321d0a9b2dee68ae1144792b8237d2b4824a5410
Author: alinakazi <AL...@GMAIL.COM>
AuthorDate: Sat Oct 3 02:01:48 2020 +0500
CruxQuickStartMX added
---
.../crux/CruxQuickStartMX/CruxQuickStartMX.as3proj | 114 +++++++++++++++++++++
examples/crux/CruxQuickStartMX/asconfig.json | 31 ++++++
examples/crux/CruxQuickStartMX/build.xml | 56 ++++++++++
examples/crux/CruxQuickStartMX/pom.xml | 88 ++++++++++++++++
.../src/main/config/compile-app-config.xml | 59 +++++++++++
.../main/resources/assets/apache-royale-logo.svg | 20 ++++
.../src/main/resources/assets/royale_spheres.png | Bin 0 -> 64663 bytes
.../crux-jewel-example-index-template.html | 30 ++++++
.../main/resources/crux-jewel-example-styles.css | 26 +++++
.../src/main/royale/CruxQuickStartMX.mxml | 65 ++++++++++++
.../main/royale/crux/quickstart/config/Beans.mxml | 28 +++++
.../crux/quickstart/controller/UserController.as | 81 +++++++++++++++
.../main/royale/crux/quickstart/event/UserEvent.as | 36 +++++++
.../src/main/royale/crux/quickstart/model/User.as | 38 +++++++
.../royale/crux/quickstart/service/UserService.as | 57 +++++++++++
.../royale/crux/quickstart/view/MainContent.mxml | 28 +++++
.../main/royale/crux/quickstart/view/UserForm.mxml | 87 ++++++++++++++++
.../CruxQuickStartMX/src/main/royale/tracer.as | 46 +++++++++
18 files changed, 890 insertions(+)
diff --git a/examples/crux/CruxQuickStartMX/CruxQuickStartMX.as3proj b/examples/crux/CruxQuickStartMX/CruxQuickStartMX.as3proj
new file mode 100644
index 0000000..a0fd8c9
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/CruxQuickStartMX.as3proj
@@ -0,0 +1,114 @@
+<?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 fps="60"/>
+ <movie height="600"/>
+ <movie disabled="False"/>
+ <movie background="#FFFFFF"/>
+ <movie path="bin-debug/CruxQuickStartMX.swf"/>
+ <movie width="800"/>
+ <movie platform="Flash Player"/>
+ <movie version="11"/>
+ <movie input=""/>
+ </output>
+ <!-- Other classes to be compiled into your SWF -->
+ <jsOutput>
+ <option path=""/>
+ </jsOutput>
+ <classpaths>
+ <class path="src/main/royale"/>
+ </classpaths>
+ <moonshineResourcePaths></moonshineResourcePaths>
+ <moonshineNativeExtensionPaths></moonshineNativeExtensionPaths>
+ <build>
+ <option es="False"/>
+ <option verboseStackTraces="False"/>
+ <option customSDK=""/>
+ <option loadConfig=""/>
+ <option optimize="False"/>
+ <option staticLinkRSL="False"/>
+ <option antBuildPath="build/build.xml"/>
+ <option showActionScriptWarnings="True"/>
+ <option compilerConstants=""/>
+ <option locale=""/>
+ <option linkReport=""/>
+ <option showDeprecationWarnings="True"/>
+ <option showUnusedTypeSelectorWarnings="True"/>
+ <option showBindingWarnings="True"/>
+ <option strict="True"/>
+ <option accessible="False"/>
+ <option useNetwork="True"/>
+ <option allowSourcePathOverlap="False"/>
+ <option useResourceBundleMetadata="True"/>
+ <option benchmark="False"/>
+ <option warnings="True"/>
+ </build>
+ <mavenBuild>
+ <option mavenBuildPath=""/>
+ <option settingsFilePath=""/>
+ <option commandLine=""/>
+ <actions>
+ <action action="install" actionName="Build"/>
+ <action action="clean package" actionName="Clean and package"/>
+ <action action="clean" actionName="Clean"/>
+ <action action="clean install" actionName="Clean and Build"/>
+ <action action="war:exploded" actionName="Exploded"/>
+ </actions>
+ </mavenBuild>
+ <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/CruxQuickStartMX.mxml"/>
+ </compileTargets>
+ <hiddenPaths></hiddenPaths>
+ <preBuildCommand>null</preBuildCommand>
+ <postBuildCommand alwaysRun="False">null</postBuildCommand>
+ <trustSVNCertificate>False</trustSVNCertificate>
+ <options>
+ <option isPrimeFacesVisualEditor="False"/>
+ <option defaultBuildTargets=""/>
+ <option visualEditorExportPath=""/>
+ <option showHiddenPaths="False"/>
+ <option isRoyale="True"/>
+ <option testMovie=""/>
+ <option testMovieCommand=""/>
+ <option isExportedToExistingSource="False"/>
+ </options>
+ <moonshineRunCustomization>
+ <option customUrlToLaunch=""/>
+ <option deviceSimulator="null"/>
+ <option targetPlatform="2"/>
+ <option urlToLaunch=""/>
+ <option projectType="2"/>
+ <option launchMethod="Simulator"/>
+ <deviceSimulator>null</deviceSimulator>
+ <certAndroid>null</certAndroid>
+ <certIos>null</certIos>
+ <certIosProvisioning>null</certIosProvisioning>
+ </moonshineRunCustomization>
+</project>
\ No newline at end of file
diff --git a/examples/crux/CruxQuickStartMX/asconfig.json b/examples/crux/CruxQuickStartMX/asconfig.json
new file mode 100644
index 0000000..23426a3
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/asconfig.json
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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","SWF"],
+ "source-map": true
+ },
+ "additionalOptions": "-remove-circulars -js-output-optimization=skipAsCoercions",
+ "files":
+ [
+ "src/main/royale/HelloWorld.mxml"
+ ]
+}
diff --git a/examples/crux/CruxQuickStartMX/build.xml b/examples/crux/CruxQuickStartMX/build.xml
new file mode 100644
index 0000000..8b65e70
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/build.xml
@@ -0,0 +1,56 @@
+<?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="CruxQuickStartMX" default="main" basedir=".">
+ <property name="ROYALE_HOME" location="../../.."/>
+ <property name="example" value="CruxQuickStartMX" />
+
+ <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-js-only" 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>
+
+ <target name="examine" depends="build_example.get.browser">
+ <property name="which" value="debug" />
+ <echo message="Make sure label appears."/>
+ <exec executable="${browser}" dir="${basedir}/bin-${which}" failonerror="true">
+ <arg value="${basedir}/bin-${which}/${example}.html"/>
+ </exec>
+ <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/crux/CruxQuickStartMX/pom.xml b/examples/crux/CruxQuickStartMX/pom.xml
new file mode 100644
index 0000000..0814255
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/pom.xml
@@ -0,0 +1,88 @@
+<?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.royale.examples</groupId>
+ <artifactId>examples-crux</artifactId>
+ <version>0.9.8-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>CruxQuickStartMX</artifactId>
+ <version>0.9.8-SNAPSHOT</version>
+ <packaging>swf</packaging>
+
+ <name>Apache Royale: Examples: Crux: CruxQuickStartMX</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.royale.compiler</groupId>
+ <artifactId>royale-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <mainClass>CruxQuickStartMX.mxml</mainClass>
+ <targets>${royale.targets}</targets>
+ <debug>false</debug>
+ <additionalCompilerOptions>
+ -js-default-initializers=true;
+ -source-map=true;
+ -compiler.exclude-defaults-css-files=MXRoyale-${royale.framework.version}-js.swc:defaults.css;
+ -keep-as3-metadata+=Inject,Dispatcher,EventHandler,PostConstruct,PreDestroy,ViewAdded,ViewRemoved,Bindable,Transient;
+ -keep-code-with-metadata=Inject;
+ </additionalCompilerOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>MXRoyale</artifactId>
+ <version>0.9.8-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>option-with-swf</id>
+
+ <properties>
+ <!-- no point building the swf target -->
+ <royale.targets>JSRoyale</royale.targets>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>MXRoyale</artifactId>
+ <version>0.9.8-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>swf</classifier>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+<properties /></project>
diff --git a/examples/crux/CruxQuickStartMX/src/main/config/compile-app-config.xml b/examples/crux/CruxQuickStartMX/src/main/config/compile-app-config.xml
new file mode 100644
index 0000000..cd61a65
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/config/compile-app-config.xml
@@ -0,0 +1,59 @@
+<!--
+
+ 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.
+
+-->
+<royale-config>
+ <js-output-optimization>
+ <optimization>skipAsCoercions</optimization>
+ </js-output-optimization>
+ <js-default-initializers>true</js-default-initializers>
+
+ <compiler>
+ <targets>
+
+ <target>MXRoyale</target>
+ </targets>
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Transient</name>
+
+ <name>Inject</name>
+ <name>Dispatcher</name>
+ <name>EventHandler</name>
+ <name>PostConstruct</name>
+ <name>PreDestroy</name>
+ <name>ViewAdded</name>
+ <name>ViewRemoved</name>
+ </keep-as3-metadata>
+ <keep-code-with-metadata>
+ <name>Inject</name>
+ </keep-code-with-metadata>
+
+ <js-library-path append="true">
+ <path-element>../../../../../../frameworks/js/libs/BasicJS.swc</path-element>
+ <path-element>../../../../../../frameworks/js/libs/CruxJS.swc</path-element>
+ <path-element>../../../../../../frameworks/js/libs/MXRoyaleJS.swc</path-element>
+ </js-library-path>
+ <!--<library-path append="true">
+ <path-element>../../../../../../frameworks/libs/Basic.swc</path-element>
+ <path-element>../../../../../../frameworks/libs/Crux.swc</path-element>
+ <path-element>../../../../../../frameworks/libs/MXRoyale.swc</path-element>
+ </library-path>-->
+
+
+ </compiler>
+</royale-config>
diff --git a/examples/crux/CruxQuickStartMX/src/main/resources/assets/apache-royale-logo.svg b/examples/crux/CruxQuickStartMX/src/main/resources/assets/apache-royale-logo.svg
new file mode 100644
index 0000000..2447298
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/resources/assets/apache-royale-logo.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ 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 svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 180 180" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g><path d="M34.727,161.312l-5.923,0l0,-21.483l10.563,0c0.994,0 1.954,0.117 2.879,0.351c0.925,0.23 [...]
\ No newline at end of file
diff --git a/examples/crux/CruxQuickStartMX/src/main/resources/assets/royale_spheres.png b/examples/crux/CruxQuickStartMX/src/main/resources/assets/royale_spheres.png
new file mode 100644
index 0000000..64a814c
Binary files /dev/null and b/examples/crux/CruxQuickStartMX/src/main/resources/assets/royale_spheres.png differ
diff --git a/examples/crux/CruxQuickStartMX/src/main/resources/crux-jewel-example-index-template.html b/examples/crux/CruxQuickStartMX/src/main/resources/crux-jewel-example-index-template.html
new file mode 100644
index 0000000..c14b6e9
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/resources/crux-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, maximum-scale=1.0, user-scalable=no" />
+ <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/crux/CruxQuickStartMX/src/main/resources/crux-jewel-example-styles.css b/examples/crux/CruxQuickStartMX/src/main/resources/crux-jewel-example-styles.css
new file mode 100644
index 0000000..c2fc9c5
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/resources/crux-jewel-example-styles.css
@@ -0,0 +1,26 @@
+/*
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+*/
+
+@namespace "http://www.w3.org/1999/xhtml";
+@namespace mx "library://ns.apache.org/royale/mx";
+
+
+
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/CruxQuickStartMX.mxml b/examples/crux/CruxQuickStartMX/src/main/royale/CruxQuickStartMX.mxml
new file mode 100644
index 0000000..8ab04e3
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/CruxQuickStartMX.mxml
@@ -0,0 +1,65 @@
+<!--
+
+ 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.
+
+-->
+<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.apache.org/royale/mx"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ xmlns:crux="library://ns.apache.org/royale/crux"
+ xmlns:view="crux.quickstart.view.*"
+ xmlns:config="crux.quickstart.config.*"
+ initialize="setUp()">
+
+ <fx:Script>
+ <![CDATA[
+ public function setUp():void
+ {
+ tracer('application setUp stub');
+ }
+ ]]>
+ </fx:Script>
+
+ <mx:beads>
+ <!-- support for simulated stage events in javascript (needed for Crux view processing)-->
+ <!-- packageExclusionFilter="_default_" avoids dispatching events for royale framework classes.
+ we can expect they will not have Crux metadata tags in any of them, so we would only avoid this
+ if we needed to use stage-like events for other reasons to emulate flash outside Crux...
+ -->
+ <crux:JSStageEvents packageExclusionFilter="_default_"/>
+ <!-- BeanProviders simply contain the non-display objects that Crux should process. -->
+ <crux:Crux>
+
+ <crux:beanProviders>
+ <config:Beans />
+ </crux:beanProviders>
+
+ <crux:config>
+ <!-- The eventPackages value tells Crux the path to your Event classes,
+ and viewPackages is an optional value that speeds up the processing of display classes. -->
+ <crux:CruxConfig
+ eventPackages="crux.quickstart.event.*"
+ viewPackages="crux.quickstart.view.*"/>
+ </crux:config>
+ </crux:Crux>
+ </mx:beads>
+
+ <mx:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </mx:valuesImpl>
+
+ <view:UserForm id="userForm" />
+</mx:Application>
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/config/Beans.mxml b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/config/Beans.mxml
new file mode 100644
index 0000000..634f33a
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/config/Beans.mxml
@@ -0,0 +1,28 @@
+<!--
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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.
+ */
+// Apache Royale Crux example based on https://github.com/swiz/swiz-examples/tree/master/SwizQuickStartExample-Flex4
+-->
+<crux:BeanProvider
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:crux="library://ns.apache.org/royale/crux"
+ xmlns:service="crux.quickstart.service.*"
+ xmlns:controller="crux.quickstart.controller.*">
+
+ <service:UserService id="userService"/>
+ <controller:UserController id="userController"/>
+
+</crux:BeanProvider>
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/controller/UserController.as b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/controller/UserController.as
new file mode 100644
index 0000000..a5f3e6d
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/controller/UserController.as
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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 crux.quickstart.controller
+{
+ import crux.quickstart.model.User;
+ import crux.quickstart.service.UserService;
+
+ import mx.rpc.events.ResultEvent;
+
+ import org.apache.royale.crux.utils.services.ServiceHelper;
+ import mx.controls.Alert;
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class UserController
+ {
+ [Inject]
+ public var userService : UserService;
+
+ [Inject]
+ /**
+ * Crux will automatically create any Bean for the built-in helper classes
+ * if one has not been defined.
+ */
+ public var serviceHelper : ServiceHelper;
+
+ [Bindable]
+ public var currentUser : User;
+
+
+ [PostConstruct]
+ /**
+ * [PostConstruct] methods are invoked after all dependencies are injected.
+ * In this example, we set up a default user after the bean is created.
+ */
+ public function createDefaultUser() : void
+ {
+ trace('[PostConstruct] executing createDefaultUser in UserController');
+ currentUser = new User();
+ }
+
+
+ [EventHandler( event="UserEvent.SAVE_USER_REQUESTED", properties="user" )]
+ /**
+ * Perform a server request to save the user
+ */
+ public function saveUser( user : User ) : void
+ {
+ trace('[EventHandler] executing saveUser in UserController via EventHandler processing');
+ serviceHelper.executeServiceCall( userService.saveUser( user ), handleSaveUserResult );
+ }
+
+ /**
+ * Handle the server call result
+ */
+ private function handleSaveUserResult( event : ResultEvent ) : void
+ {
+ currentUser = event.result as User;
+ // Show an Alert just to make it obvious that the save was successful.
+ Alert.show( 'User saved successfully! id:' + currentUser.id, 'Success' );
+ }
+
+ }
+}
+
+
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/event/UserEvent.as b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/event/UserEvent.as
new file mode 100644
index 0000000..589c2a8
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/event/UserEvent.as
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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 crux.quickstart.event
+{
+ import crux.quickstart.model.User;
+ import org.apache.royale.events.Event;
+
+ public class UserEvent extends Event
+ {
+ public static const SAVE_USER_REQUESTED : String = "saveUser";
+ public var user : User;
+
+ /**
+ * This is just a normal Royale event which will be dispatched from a view instance.
+ * The only thing to note is that we set 'bubbles' to true, so that the event will bubble
+ * up the 'display' list, allowing Crux to listen for your events.
+ */
+ public function UserEvent( type:String )
+ {
+ super( type, true );
+ }
+ }
+}
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/model/User.as b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/model/User.as
new file mode 100644
index 0000000..b4dec85
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/model/User.as
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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 crux.quickstart.model
+{
+
+ [Bindable]
+ public class User
+ {
+ public var id : int;
+ public var firstName : String;
+ public var lastName : String;
+ public var email : String;
+
+
+ public function clone():User{
+ var usr:User = new User();
+ usr.id = id;
+ usr.firstName = firstName;
+ usr.lastName = lastName;
+ usr.email = email;
+ return usr;
+ }
+
+ }
+}
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/service/UserService.as b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/service/UserService.as
new file mode 100644
index 0000000..7f8cfc5
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/service/UserService.as
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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 crux.quickstart.service
+{
+ import crux.quickstart.model.User;
+
+ import mx.rpc.AsyncToken;
+
+ import org.apache.royale.crux.utils.services.MockDelegateHelper;
+ import org.apache.royale.events.IEventDispatcher;
+
+ public class UserService
+ {
+ [Dispatcher]
+ /**
+ * The [Dispatcher] metadata tag instructs Crux to inject an event dispatcher.
+ * Event's dispatched via this dispatcher can trigger event mediators.
+ */
+ public var dispatcher : IEventDispatcher;
+
+ /**
+ * To avoid a live server dependency, we use a Crux
+ * helper class to let us create fake AsyncTokens
+ */
+ private var mockHelper : MockDelegateHelper;
+
+ public function UserService()
+ {
+ mockHelper = new MockDelegateHelper();
+ }
+
+ /**
+ * In a real app, we'd invoke a RemoteObject, HTTPService, etc.
+ * For this simple example, we'll set a random ID on the returned User
+ * to simulate the process of saving a User.
+ */
+ public function saveUser( user : User ) : AsyncToken
+ {
+ user = user.clone();//clone it to simulate a different object being returned from the server
+ user.id = Math.round( Math.random() * 100 );
+ return mockHelper.createMockResult( user );
+ }
+ }
+}
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/MainContent.mxml b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/MainContent.mxml
new file mode 100644
index 0000000..a66b4c0
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/MainContent.mxml
@@ -0,0 +1,28 @@
+<?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.
+
+-->
+<mx:View
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.apache.org/royale/mx"
+ xmlns:view="crux.quickstart.view.*">
+
+
+ <view:UserForm id="userForm" />
+
+</mx:View>
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/UserForm.mxml b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/UserForm.mxml
new file mode 100644
index 0000000..f613c0b
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/crux/quickstart/view/UserForm.mxml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2010 Swiz Framework Contributors
+ *
+ * Licensed 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. 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.
+ */
+// Apache Royale Crux example based on https://github.com/swiz/swiz-examples/tree/master/SwizQuickStartExample-Flex4
+-->
+<mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.apache.org/royale/mx"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ >
+
+ <mx:beads>
+ <js:ContainerDataBinding/>
+ </mx:beads>
+
+ <fx:Script>
+ <![CDATA[
+ import crux.quickstart.event.UserEvent;
+ import crux.quickstart.model.User;
+
+ [Bindable]
+
+ /**
+ * We could inject the whole controller instance, but we only need
+ * one property from the controller, the current user, so we just
+ * inject that property.
+ * Using setter style binding below instead of direct property binding Injection here (for variety in example)
+ */
+ public var user : User;
+
+ //example of setter style binding Injection
+ [Inject( source = "userController.currentUser", bind = "true" )]
+ public function setUser(val:User):void{
+ this.user = val;
+ }
+
+ /**
+ * Handle the user hitting the save button. We capture the form data
+ * and dispatch a standard Royale event. No Crux-specific events or
+ * special central dispatcher needed!
+ */
+ private function saveUser() : void
+ {
+ user.firstName = firstName.text;
+ user.lastName = lastName.text;
+ user.email = email.text;
+ var event : UserEvent = new UserEvent( UserEvent.SAVE_USER_REQUESTED );
+ event.user = user;
+ dispatchEvent( event );
+ }
+ ]]>
+ </fx:Script>
+
+ <mx:Form>
+ <mx:FormHeading label="User Form (Crux Quickstart Example)"/>
+ <mx:FormItem label="User ID: ">
+ <mx:Label localId="userId" text="{isNaN( user.id ) ? 'N/A' : user.id}" />
+ </mx:FormItem>
+ <mx:FormItem label="First Name: ">
+ <mx:TextInput id="firstName" text="{user.firstName}" />
+ </mx:FormItem>
+ <mx:FormItem label="Last Name: ">
+ <mx:TextInput id="lastName" text="{user.lastName}" />
+ </mx:FormItem>
+ <mx:FormItem label="Email: ">
+ <mx:TextInput id="email" text="{user.email}" />
+ </mx:FormItem>
+ <mx:FormItem>
+ <mx:Button label="Save" click="saveUser()" />
+ </mx:FormItem>
+ </mx:Form>
+
+</mx:Panel>
+
diff --git a/examples/crux/CruxQuickStartMX/src/main/royale/tracer.as b/examples/crux/CruxQuickStartMX/src/main/royale/tracer.as
new file mode 100644
index 0000000..57e2f89
--- /dev/null
+++ b/examples/crux/CruxQuickStartMX/src/main/royale/tracer.as
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 {
+
+ public function tracer(...args):void
+ {
+
+ COMPILE::JS {
+ args.unshift('[JS]');
+ console.log.apply(console, args);
+ }
+ COMPILE::SWF{
+ import flash.external.ExternalInterface;
+
+ if (ExternalInterface.available)
+ {
+ try
+ {
+ args.unshift('[SWF]');
+ const method:String = 'console.log.apply';
+ ExternalInterface.call(method, null, args);
+ } catch (e:Error)
+ {
+ }
+ }
+ }
+ }
+
+
+}