You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/08/15 20:22:38 UTC
[1/3] git commit: [flex-asjs] [refs/heads/develop] - initial module
example
Repository: flex-asjs
Updated Branches:
refs/heads/develop 683db92f4 -> ba3140bee
initial module example
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ba3140be
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ba3140be
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ba3140be
Branch: refs/heads/develop
Commit: ba3140beeeb9b66cd8175dae4253821daefc47f6
Parents: 8e7c653
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 15 13:19:00 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 15 13:19:34 2017 -0700
----------------------------------------------------------------------
examples/build.xml | 3 +
examples/flexjs/ModuleExample/MainApp/build.xml | 55 ++++++++++++
.../src/main/config/compile-app-config.xml | 24 +++++
.../MainApp/src/main/flex/MainApp.mxml | 34 +++++++
examples/flexjs/ModuleExample/Module/build.xml | 76 ++++++++++++++++
.../src/main/config/compile-app-config.xml | 26 ++++++
.../Module/src/main/flex/Module.mxml | 30 +++++++
examples/flexjs/ModuleExample/build.xml | 95 ++++++++++++++++++++
8 files changed, 343 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/build.xml
----------------------------------------------------------------------
diff --git a/examples/build.xml b/examples/build.xml
index 5913b78..9d7e3cd 100644
--- a/examples/build.xml
+++ b/examples/build.xml
@@ -97,6 +97,7 @@
<ant dir="${basedir}/flexjs/MobileMap"/>
<ant dir="${basedir}/flexjs/MobileStocks"/>
<ant dir="${basedir}/flexjs/MobileTrader"/>
+ <ant dir="${basedir}/flexjs/ModuleExample"/>
<ant dir="${basedir}/flexjs/ChartExample"/>
<ant dir="${basedir}/flexjs/StorageExample"/>
<ant dir="${basedir}/flexjs/StyleExample"/>
@@ -142,6 +143,7 @@
<ant dir="${basedir}/flexjs/MobileTrader" target="clean"/>
<ant dir="${basedir}/flexjs/MobileStocks" target="clean"/>
<ant dir="${basedir}/flexjs/MobileMap" target="clean"/>
+ <ant dir="${basedir}/flexjs/ModuleExample" target="clean"/>
<ant dir="${basedir}/flexjs/ChartExample" target="clean"/>
<ant dir="${basedir}/flexjs/StorageExample" target="clean"/>
<ant dir="${basedir}/flexjs/StyleExample" target="clean"/>
@@ -177,6 +179,7 @@
<ant dir="${basedir}/flexjs/MobileTrader" target="examine"/>
<ant dir="${basedir}/flexjs/MobileStocks" target="examine"/>
<ant dir="${basedir}/flexjs/MobileMap" target="examine"/>
+ <ant dir="${basedir}/flexjs/ModuleExample" target="examine"/>
<ant dir="${basedir}/flexjs/ChartExample" target="examine"/>
<ant dir="${basedir}/flexjs/StorageExample" target="examine"/>
<ant dir="${basedir}/flexjs/StyleExample" target="examine"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/MainApp/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/MainApp/build.xml b/examples/flexjs/ModuleExample/MainApp/build.xml
new file mode 100644
index 0000000..a69e99f
--- /dev/null
+++ b/examples/flexjs/ModuleExample/MainApp/build.xml
@@ -0,0 +1,55 @@
+<?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="MainApp" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../../.."/>
+ <property name="example" value="MainApp" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+
+ <include file="${basedir}/../../../build_example.xml" />
+
+ <!-- MainApp must be build before Module to generate variable and property maps -->
+ <target name="main" depends="clean,build_example.compile" 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>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/MainApp/src/main/config/compile-app-config.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/MainApp/src/main/config/compile-app-config.xml b/examples/flexjs/ModuleExample/MainApp/src/main/config/compile-app-config.xml
new file mode 100644
index 0000000..cb6846f
--- /dev/null
+++ b/examples/flexjs/ModuleExample/MainApp/src/main/config/compile-app-config.xml
@@ -0,0 +1,24 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<flex-config>
+ <js-compiler-option>
+ <option>--variable_map_output_file gccvars.txt</option>
+ <option>--property_map_output_file gccprops.txt</option>
+ </js-compiler-option>
+</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/MainApp/src/main/flex/MainApp.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/MainApp/src/main/flex/MainApp.mxml b/examples/flexjs/ModuleExample/MainApp/src/main/flex/MainApp.mxml
new file mode 100644
index 0000000..9e101bb
--- /dev/null
+++ b/examples/flexjs/ModuleExample/MainApp/src/main/flex/MainApp.mxml
@@ -0,0 +1,34 @@
+<?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" >
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <js:View>
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:Label text="Module Should Appear Below" />
+ <js:UIModuleLoader modulePath="modules" moduleName="Module" />
+ </js:View>
+ </js:initialView>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/Module/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/Module/build.xml b/examples/flexjs/ModuleExample/Module/build.xml
new file mode 100644
index 0000000..b9e5a18
--- /dev/null
+++ b/examples/flexjs/ModuleExample/Module/build.xml
@@ -0,0 +1,76 @@
+<?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="Module" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../../.."/>
+ <property name="example" value="Module" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+
+ <include file="${basedir}/../../../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}">
+ <mkdir dir="${basedir}/../MainApp/bin-debug/modules" />
+ <mkdir dir="${basedir}/../MainApp/bin/js-debug/modules" />
+ <mkdir dir="${basedir}/../MainApp/bin/js-release/modules" />
+ <replace file="${basedir}/bin/js-debug/Module__deps.js"
+ token="/Module.js"
+ value="/modules/Module.js" />
+ <copy file="${basedir}/bin-debug/Module.swf" todir="${basedir}/../MainApp/bin-debug/modules" failonerror="false" />
+ <copy todir="${basedir}/../MainApp/bin/js-debug/modules" failonerror="false">
+ <fileset dir="${basedir}/bin/js-debug">
+ <include name="*"/>
+ </fileset>
+ </copy>
+ <copy todir="${basedir}/../MainApp/bin/js-debug/org" failonerror="false">
+ <fileset dir="${basedir}/bin/js-debug/org">
+ <include name="**/**"/>
+ </fileset>
+ </copy>
+ <copy todir="${basedir}/../MainApp/bin/js-release/modules" failonerror="false">
+ <fileset dir="${basedir}/bin/js-release">
+ <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="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>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/Module/src/main/config/compile-app-config.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/Module/src/main/config/compile-app-config.xml b/examples/flexjs/ModuleExample/Module/src/main/config/compile-app-config.xml
new file mode 100644
index 0000000..f9aa67e
--- /dev/null
+++ b/examples/flexjs/ModuleExample/Module/src/main/config/compile-app-config.xml
@@ -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.
+
+-->
+<flex-config>
+ <js-compiler-option>
+ <option>--variable_map_input_file ../../../MainApp/bin/js-release/gccvars.txt</option>
+ <option>--property_map_input_file ../../../MainApp/bin/js-release/gccprops.txt</option>
+ <option>--variable_map_output_file modgccvars.txt</option>
+ <option>--property_map_output_file modgccprops.txt</option>
+ </js-compiler-option>
+</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/Module/src/main/flex/Module.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/Module/src/main/flex/Module.mxml b/examples/flexjs/ModuleExample/Module/src/main/flex/Module.mxml
new file mode 100644
index 0000000..949d445
--- /dev/null
+++ b/examples/flexjs/ModuleExample/Module/src/main/flex/Module.mxml
@@ -0,0 +1,30 @@
+<?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:UIModule xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic" >
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:Label text="This Label is in the module" />
+ <js:TextInput id="ti" text="This TextInput is also in the module" />
+</js:UIModule>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba3140be/examples/flexjs/ModuleExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ModuleExample/build.xml b/examples/flexjs/ModuleExample/build.xml
new file mode 100644
index 0000000..508ee87
--- /dev/null
+++ b/examples/flexjs/ModuleExample/build.xml
@@ -0,0 +1,95 @@
+<?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.
+
+-->
+
+<!-- Note:
+ If you modify this file you may have to make the same change in build_framework.xml.
+ build_framework.xml is renamed to build.xml when it is packaged.
+ It is used to build the frameworks directory from the zip file.
+-->
+<project name="ModuleExample" default="main" basedir=".">
+
+ <property name="FLEXJS_HOME" location=".."/>
+
+ <!-- Required for OSX 10.6 / Snow Leopard Performance. -->
+ <!-- Java 7 on Mac requires OSX 10.7.3 or higher and is 64-bit only -->
+ <!-- local.d32 is set/used in build.properties so this needs to be done first. -->
+ <condition property="local.d32" value="-d32">
+ <and>
+ <os family="mac"/>
+ <matches pattern="1.6.*" string="${java.version}"/>
+ <equals arg1="${sun.arch.data.model}" arg2="64"/>
+ <equals arg1="${os.arch}" arg2="x86_64"/>
+ </and>
+ </condition>
+
+ <!-- Property for the platform. -->
+ <condition property="isMac">
+ <os family="mac"/>
+ </condition>
+ <condition property="isWindows">
+ <os family="windows" />
+ </condition>
+ <condition property="isLinux">
+ <and>
+ <os family="unix"/>
+ <not>
+ <os family="mac"/>
+ </not>
+ </and>
+ </condition>
+
+ <target name="main" depends="check-compile-env,clean,prepare,compile"
+ description="Clean build of all examples"/>
+
+ <target name="check-compile-env" description="Check for the required environment variables">
+ </target>
+
+
+ <target name="prepare" depends="thirdparty-downloads"/>
+
+ <target name="thirdparty-downloads" unless="no.thirdparty-downloads" description="Downloads all the required thirdparty code.">
+ <!--<ant antfile="${basedir}/downloads.xml" dir="${basedir}"/>-->
+ </target>
+
+ <target name="compile" description="Compile Examples" >
+ <ant dir="${basedir}/MainApp/" inheritall="false"/>
+ <ant dir="${basedir}/Module" inheritall="false"/>
+ </target>
+
+ <!--
+ Cleanup
+ -->
+
+ <target name="super-clean" depends="thirdparty-clean,clean" description="Cleans everything including thirdparty downloads."/>
+
+ <target name="thirdparty-clean" unless="no.thirdparty-clean" description="Removes all thirdparty downloads.">
+ <!--<ant antfile="${basedir}/downloads.xml" target="clean" dir="${basedir}"/>-->
+ </target>
+
+ <target name="clean" description="Cleans all SWCs and their resource bundles">
+ <ant dir="${basedir}/MainApp" target="clean"/>
+ <ant dir="${basedir}/Module" target="clean"/>
+ </target>
+
+ <target name="examine" description="Cleans all SWCs and their resource bundles">
+ <ant dir="${basedir}/MainApp" target="examine"/>
+ </target>
+
+</project>
[2/3] git commit: [flex-asjs] [refs/heads/develop] - initialize
modules
Posted by ah...@apache.org.
initialize modules
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8e7c6532
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8e7c6532
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8e7c6532
Branch: refs/heads/develop
Commit: 8e7c65320d79cc0f66c9949c4362ac68ac5266bc
Parents: 020c1cb
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 15 13:17:00 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 15 13:19:34 2017 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/core/SimpleCSSValuesImpl.as | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8e7c6532/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
index 3c3f955..003ca12 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -81,16 +81,26 @@ package org.apache.flex.core
public function init(main:Object):void
{
var styleClassName:String;
+ var mainClassName:String;
+
var c:Class;
if (!values)
{
values = {};
mainClass = main;
- var mainClassName:String = getQualifiedClassName(mainClass);
+ mainClassName = getQualifiedClassName(mainClass);
styleClassName = "_" + mainClassName + "_Styles";
c = ApplicationDomain.currentDomain.getDefinition(styleClassName) as Class;
generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]);
}
+ else if (main is IFlexInfo)
+ {
+ mainClass = main;
+ mainClassName = getQualifiedClassName(mainClass);
+ styleClassName = "_" + mainClassName + "_Styles";
+ c = ApplicationDomain.currentDomain.getDefinition(styleClassName) as Class;
+ generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]);
+ }
c = main.constructor as Class;
generateCSSStyleDeclarations(c["factoryFunctions"], c["data"]);
if (hasEventListener("init"))
[3/3] git commit: [flex-asjs] [refs/heads/develop] - UIModule and
UIModuleLoader
Posted by ah...@apache.org.
UIModule and UIModuleLoader
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/020c1cb9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/020c1cb9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/020c1cb9
Branch: refs/heads/develop
Commit: 020c1cb9e4a825f228ced241728dd80e4cab8432
Parents: 683db92
Author: Alex Harui <ah...@apache.org>
Authored: Tue Aug 15 13:15:50 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Aug 15 13:19:34 2017 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/html/UIModule.as | 139 +++++++++++
.../flex/org/apache/flex/html/UIModuleLoader.as | 233 +++++++++++++++++++
.../Basic/src/main/resources/basic-manifest.xml | 3 +
3 files changed, 375 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/020c1cb9/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModule.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModule.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModule.as
new file mode 100644
index 0000000..4c7784f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModule.as
@@ -0,0 +1,139 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html
+{
+ COMPILE::SWF
+ {
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+ import org.apache.flex.core.IFlexInfo;
+ import org.apache.flex.core.IValuesImpl;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+
+ /**
+ * Indicates that the state change has completed. All properties
+ * that need to change have been changed, and all transitinos
+ * that need to run have completed. However, any deferred work
+ * may not be completed, and the screen may not be updated until
+ * code stops executing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the initialization of the container is complete.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the children of the container is have been added.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
+
+ /**
+ * The UIModule class is the base class for modules of user
+ * interface controls in FlexJS. It is usable as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIModule extends Group implements IFlexInfo
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIModule()
+ {
+ super();
+ }
+
+ private var _info:Object;
+
+ /**
+ * An Object containing information generated
+ * by the compiler that is useful at startup time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function info():Object
+ {
+ COMPILE::SWF
+ {
+ if (!_info)
+ {
+ var mainClassName:String = getQualifiedClassName(this);
+ var initClassName:String = "_" + mainClassName + "_FlexInit";
+ var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class;
+ _info = c.info();
+ }
+ }
+ return _info;
+ }
+
+ /**
+ * The org.apache.flex.core.IValuesImpl that is
+ * used by the loading application or module.
+ * A new instance is not created as the main
+ * one is shared but this adds the required
+ * depedencies for the JS compiler optimizer
+ * and adds the values for this module
+ *
+ * @see org.apache.flex.core.SimpleCSSValuesImpl
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set valuesImpl(value:IValuesImpl):void
+ {
+ ValuesManager.valuesImpl.init(this);
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/020c1cb9/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModuleLoader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModuleLoader.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModuleLoader.as
new file mode 100644
index 0000000..db4acee
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/UIModuleLoader.as
@@ -0,0 +1,233 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html
+{
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.utils.PointUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.events.Event;
+
+ COMPILE::SWF
+ {
+ import flash.display.Loader;
+ import flash.display.DisplayObjectContainer;
+ import flash.events.Event;
+ import flash.system.LoaderContext;
+ import flash.system.ApplicationDomain;
+ import flash.net.URLRequest;
+ }
+
+ COMPILE::JS
+ {
+ import goog.global;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The UIModuleLoader class can load a UIModule.
+ *
+ * @toplevel
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIModuleLoader extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIModuleLoader()
+ {
+ super();
+ }
+
+ private var _modulePath:String;
+
+ /**
+ * Path or URL of module. This is combined
+ * with the module name and a platform suffix
+ * to determine the actual path or URL of the
+ * module.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get modulePath():String
+ {
+ return _modulePath;
+ }
+
+ /**
+ * @private.
+ */
+ public function set modulePath(value:String):void
+ {
+ _modulePath = value;
+ }
+
+ private var _moduleName:String;
+
+ public function get moduleName():String
+ {
+ return _moduleName;
+ }
+
+ public function set moduleName(value:String):void
+ {
+ _moduleName = value;
+ }
+
+ COMPILE::SWF
+ private var swfLoader:Loader;
+
+ COMPILE::JS
+ private var jsLoader:WrappedHTMLElement;
+
+ COMPILE::JS
+ private var jsDepsLoader:WrappedHTMLElement;
+
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ if (_modulePath)
+ loadModule();
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ private function createLoader():void
+ {
+ COMPILE::SWF {
+ if (swfLoader != null) {
+ swfLoader.contentLoaderInfo.removeEventListener("complete", completeHandler);
+ }
+
+ swfLoader = new Loader();
+ swfLoader.contentLoaderInfo.addEventListener("complete", completeHandler);
+ }
+
+ COMPILE::JS {
+ var origin:Point = new Point(0,0);
+ var xlated:Point = PointUtils.localToGlobal(origin, parent);
+
+ if (goog.DEBUG)
+ {
+ if (jsDepsLoader == null) {
+ jsDepsLoader = document.createElement('script') as WrappedHTMLElement;
+ jsDepsLoader.onload = loadDepsHandler;
+ document.body.appendChild(jsDepsLoader);
+ }
+ }
+ else
+ {
+ if (jsLoader == null) {
+ jsLoader = document.createElement('script') as WrappedHTMLElement;
+ jsLoader.onload = loadHandler;
+ document.body.appendChild(jsLoader);
+ }
+ }
+ }
+ }
+
+ /**
+ * Load the module. Will be called automatically if modulePath
+ * is set as the UIModuleLoader is added to the display list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function loadModule():void
+ {
+ if (moduleInstance)
+ removeElement(moduleInstance);
+
+ createLoader();
+
+ COMPILE::SWF {
+ var url:URLRequest = new URLRequest(modulePath ? modulePath + "/" + moduleName + ".swf" :
+ moduleName + ".swf");
+ var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
+ swfLoader.load(url, loaderContext);
+ if (swfLoader.parent == null) {
+ addChild(swfLoader);
+ }
+ }
+
+ COMPILE::JS {
+ if (!goog.DEBUG)
+ jsLoader.setAttribute("src", modulePath ? modulePath + "/" + moduleName + ".js" :
+ moduleName + ".js");
+ else
+ {
+ // js-debug module loading requires that the __deps.js file has been tweaked
+ // so that the path to the module class is correct and that any
+ // framework js files have been copied into the same tree structure as
+ // the main apps framework js files
+ window["goog"]["ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING"] = true;
+ jsDepsLoader.setAttribute("src", modulePath ? modulePath + "/" + moduleName + "__deps.js" :
+ moduleName + "__deps.js");
+ }
+ }
+ }
+
+ private var moduleInstance:IUIBase;
+
+ COMPILE::SWF
+ protected function completeHandler(event:flash.events.Event):void
+ {
+ var c:Class = ApplicationDomain.currentDomain.getDefinition(moduleName) as Class;
+ moduleInstance = new c() as IUIBase;
+ addElement(moduleInstance);
+ }
+
+ COMPILE::JS
+ protected function loadDepsHandler():void
+ {
+ // wait for other scripts to load
+ if (window[moduleName] == null)
+ {
+ setTimeout(loadDepsHandler, 250);
+ }
+ else
+ loadHandler();
+
+ }
+
+ COMPILE::JS
+ protected function loadHandler():void
+ {
+ var c:Class = window[moduleName];
+ moduleInstance = new c() as IUIBase;
+ addElement(moduleInstance);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/020c1cb9/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 9df3370..a07fc40 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -174,4 +174,7 @@
<component id="TableCell" class="org.apache.flex.html.TableCell"/>
<component id="TableHeader" class="org.apache.flex.html.TableHeader"/>
+ <component id="UIModule" class="org.apache.flex.html.UIModule"/>
+ <component id="UIModuleLoader" class="org.apache.flex.html.UIModuleLoader"/>
+
</componentPackage>