Repository: flex-asjs Updated Branches: refs/heads/develop cddbef2df -> 644f932fe
Initial VF2JS commit. Signed-off-by: Erik de Bruin <e...@ixsoftware.nl> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/644f932f Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/644f932f Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/644f932f Branch: refs/heads/develop Commit: 644f932feea2c7cdff23477337875e173550c323 Parents: cddbef2 Author: Erik de Bruin <e...@ixsoftware.nl> Authored: Fri Aug 1 13:12:44 2014 +0200 Committer: Erik de Bruin <e...@ixsoftware.nl> Committed: Fri Aug 1 13:12:44 2014 +0200 ---------------------------------------------------------------------- vf2js/README | 11 ++ vf2js/frameworks/as/build.properties | 27 +++ vf2js/frameworks/as/build.xml | 51 +++++ vf2js/frameworks/as/projects/vf2js_mx/build.xml | 64 +++++++ .../as/projects/vf2js_mx/compile-config.xml | 42 +++++ .../as/projects/vf2js_mx/manifest.xml | 29 +++ .../as/projects/vf2js_mx/src/VF2JSClasses.as | 31 ++++ .../vf2js_mx/src/vf2js_mx/components/Button.as | 29 +++ vf2js/frameworks/as/projects/vf2js_s/build.xml | 64 +++++++ .../as/projects/vf2js_s/compile-config.xml | 42 +++++ .../frameworks/as/projects/vf2js_s/manifest.xml | 30 +++ .../as/projects/vf2js_s/src/VF2JSClasses.as | 31 ++++ .../src/vf2js_s/components/Application.as | 35 ++++ .../vf2js_s/src/vf2js_s/components/Button.as | 33 ++++ .../js/src/org/apache/flex/utils/Language.js | 186 +++++++++++++++++++ .../js/src/vf2js_mx/components/Button.js | 24 +++ .../js/src/vf2js_s/components/Application.js | 30 +++ .../js/src/vf2js_s/components/Button.css | 17 ++ .../js/src/vf2js_s/components/Button.js | 163 ++++++++++++++++ .../js/src/vf2js_s/components/ButtonRenderer.js | 92 +++++++++ vf2js/frameworks/js/tests.html | 35 ++++ 21 files changed, 1066 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/README ---------------------------------------------------------------------- diff --git a/vf2js/README b/vf2js/README new file mode 100644 index 0000000..9e308ce --- /dev/null +++ b/vf2js/README @@ -0,0 +1,11 @@ +Hello World + +1. Take any Flex SDK install +2. add FalconJX +3. add VF2JS SWCs +4. add VF2JS JS framework +5. add Launch script +6. + +- add builds to build machine (for nightlies) +- add script to installer http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/build.properties ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/build.properties b/vf2js/frameworks/as/build.properties new file mode 100644 index 0000000..222c87c --- /dev/null +++ b/vf2js/frameworks/as/build.properties @@ -0,0 +1,27 @@ +################################################################################ +## +## 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. +## +################################################################################ + +# Flash player version for which player global swc to use +playerglobal.version=14.0 + +# JVM options for <compc> and <mxmlc> tasks +# -Xms64m: start out with a 64 MB heap +# -Xmx384m: allow the heap to grow to 384 MB +# -ea: enable Java assertions +jvm.args=-Xms64m -Xmx384m -ea -Dapple.awt.UIElement=true http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/build.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/build.xml b/vf2js/frameworks/as/build.xml new file mode 100644 index 0000000..84cb8f6 --- /dev/null +++ b/vf2js/frameworks/as/build.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project name="vf2js-frameworks-as" default="main" basedir="."> + + <property environment="env"/> + + <target name="main" depends="clean,compile" description="Clean build of all SWCs" /> + + <target name="compile" description="Builds all SWCs but not their resource bundles"> + <antcall target="vf2js_mx" /> + <antcall target="vf2js_s" /> + </target> + + <target name="clean" description="Cleans all artefacts"> + <ant dir="${basedir}/projects/vf2js_s" target="clean" /> + + <delete dir="${basedir}/libs" /> + </target> + + <target name="vf2js_mx" description="Clean build of vf2js_mx.swc"> + <ant dir="${basedir}/projects/vf2js_mx" /> + </target> + + <target name="vf2js_s" description="Clean build of vf2js_s.swc"> + <ant dir="${basedir}/projects/vf2js_s" /> + </target> + + <target name="copy-to-sdk" description="Copy SWCs to SDK"> + <copy todir="${env.FLEX_HOME}/frameworks/libs"> + <fileset dir="${env.VF2JS_HOME}/frameworks/as/libs" /> + </copy> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_mx/build.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_mx/build.xml b/vf2js/frameworks/as/projects/vf2js_mx/build.xml new file mode 100644 index 0000000..897b527 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_mx/build.xml @@ -0,0 +1,64 @@ +<?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="vf2js_mx" default="main" basedir="."> + + <property file="../../build.properties"/> + + <property environment="env"/> + <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> + <property name="FLEX_HOME" value="${env.FLEX_HOME}"/> + <property name="VF2JS_HOME" location="${env.VF2JS_HOME}"/> + + <target name="main" depends="clean,compile" description="Clean build of vf2js_mx.swc"> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${VF2JS_HOME}/frameworks/as/libs"> + <include name="vf2js_mx.swc"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/> + </path> + + <target name="compile" description="Compiles vf2js_mx.swc"> + <echo message="Compiling '${VF2JS_HOME}/frameworks/as/libs/vf2js_mx.swc'"/> + + <echo message="FALCON_HOME: ${FALCON_HOME}"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="VF2JS_HOME: ${VF2JS_HOME}"/> + + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + + <compc fork="true" output="${VF2JS_HOME}/frameworks/as/libs/vf2js_mx.swc"> + <jvmarg line="${jvm.args}"/> + <load-config filename="compile-config.xml" /> + <arg value="+PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+FLEX_HOME=${FLEX_HOME}" /> + </compc> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_mx/compile-config.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_mx/compile-config.xml b/vf2js/frameworks/as/projects/vf2js_mx/compile-config.xml new file mode 100644 index 0000000..b1eb49a --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_mx/compile-config.xml @@ -0,0 +1,42 @@ +<?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. + +--> +<flex-config> + <compiler> + <external-library-path> + <path-element>${PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element> + </external-library-path> + <namespaces> + <namespace> + <uri>http://flex.apache.org/vf2js_mx/ns</uri> + <manifest>manifest.xml</manifest> + </namespace> + </namespaces> + <source-path> + <path-element>src</path-element> + </source-path> + </compiler> + <include-namespaces> + <uri>http://flex.apache.org/vf2js_mx/ns</uri> + </include-namespaces> + <include-classes> + <class>VF2JSClasses</class> + </include-classes> + <target-player>${playerglobal.version}</target-player> +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_mx/manifest.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_mx/manifest.xml b/vf2js/frameworks/as/projects/vf2js_mx/manifest.xml new file mode 100644 index 0000000..7c86f72 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_mx/manifest.xml @@ -0,0 +1,29 @@ +<?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. + +--> + +<!-- + + VF2JS Components + +--> + +<componentPackage> + <component id="Button" class="vf2js_mx.components.Button"/> +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_mx/src/VF2JSClasses.as ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_mx/src/VF2JSClasses.as b/vf2js/frameworks/as/projects/vf2js_mx/src/VF2JSClasses.as new file mode 100644 index 0000000..e80ff0d --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_mx/src/VF2JSClasses.as @@ -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. +// +//////////////////////////////////////////////////////////////////////////////// + +package +{ + internal class VF2JSClasses + { + /** + * @private + * This class is used to link additional classes into experimental.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_mx/src/vf2js_mx/components/Button.as ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_mx/src/vf2js_mx/components/Button.as b/vf2js/frameworks/as/projects/vf2js_mx/src/vf2js_mx/components/Button.as new file mode 100644 index 0000000..d83cdfe --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_mx/src/vf2js_mx/components/Button.as @@ -0,0 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 vf2js_mx.components +{ + +public class Button +{ + + public function Button() {} + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/build.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/build.xml b/vf2js/frameworks/as/projects/vf2js_s/build.xml new file mode 100644 index 0000000..a84a0af --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/build.xml @@ -0,0 +1,64 @@ +<?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="vf2js_s" default="main" basedir="."> + + <property file="../../build.properties"/> + + <property environment="env"/> + <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> + <property name="FLEX_HOME" value="${env.FLEX_HOME}"/> + <property name="VF2JS_HOME" location="${env.VF2JS_HOME}"/> + + <target name="main" depends="clean,compile" description="Clean build of vf2js_s.swc"> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${VF2JS_HOME}/frameworks/as/libs"> + <include name="vf2js_s.swc"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/> + </path> + + <target name="compile" description="Compiles vf2js_s.swc"> + <echo message="Compiling '${VF2JS_HOME}/frameworks/as/libs/vf2js_s.swc'"/> + + <echo message="FALCON_HOME: ${FALCON_HOME}"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="VF2JS_HOME: ${VF2JS_HOME}"/> + + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + + <compc fork="true" output="${VF2JS_HOME}/frameworks/as/libs/vf2js_s.swc"> + <jvmarg line="${jvm.args}"/> + <load-config filename="compile-config.xml" /> + <arg value="+PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+FLEX_HOME=${FLEX_HOME}" /> + </compc> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/compile-config.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/compile-config.xml b/vf2js/frameworks/as/projects/vf2js_s/compile-config.xml new file mode 100644 index 0000000..22f63e2 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/compile-config.xml @@ -0,0 +1,42 @@ +<?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. + +--> +<flex-config> + <compiler> + <external-library-path> + <path-element>${PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element> + </external-library-path> + <namespaces> + <namespace> + <uri>http://flex.apache.org/vf2js_s/ns</uri> + <manifest>manifest.xml</manifest> + </namespace> + </namespaces> + <source-path> + <path-element>src</path-element> + </source-path> + </compiler> + <include-namespaces> + <uri>http://flex.apache.org/vf2js_s/ns</uri> + </include-namespaces> + <include-classes> + <class>VF2JSClasses</class> + </include-classes> + <target-player>${playerglobal.version}</target-player> +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/manifest.xml ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/manifest.xml b/vf2js/frameworks/as/projects/vf2js_s/manifest.xml new file mode 100644 index 0000000..7bf4f16 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/manifest.xml @@ -0,0 +1,30 @@ +<?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. + +--> + +<!-- + + VF2JS Components + +--> + +<componentPackage> + <component id="Application" class="vf2js_s.components.Application"/> + <component id="Button" class="vf2js_s.components.Button"/> +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/src/VF2JSClasses.as ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/src/VF2JSClasses.as b/vf2js/frameworks/as/projects/vf2js_s/src/VF2JSClasses.as new file mode 100644 index 0000000..e80ff0d --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/src/VF2JSClasses.as @@ -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. +// +//////////////////////////////////////////////////////////////////////////////// + +package +{ + internal class VF2JSClasses + { + /** + * @private + * This class is used to link additional classes into experimental.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Application.as ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Application.as b/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Application.as new file mode 100644 index 0000000..51e3fd9 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Application.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 vf2js_s.components +{ + +public class Application +{ + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + public function Application() {} + +} + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Button.as ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Button.as b/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Button.as new file mode 100644 index 0000000..1b66982 --- /dev/null +++ b/vf2js/frameworks/as/projects/vf2js_s/src/vf2js_s/components/Button.as @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 vf2js_s.components +{ + +public class Button +{ + + public function Button() {} + + public var label:String; + + public var x:Number; + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/org/apache/flex/utils/Language.js ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/org/apache/flex/utils/Language.js b/vf2js/frameworks/js/src/org/apache/flex/utils/Language.js new file mode 100644 index 0000000..619edb1 --- /dev/null +++ b/vf2js/frameworks/js/src/org/apache/flex/utils/Language.js @@ -0,0 +1,186 @@ +/** + * 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 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. + */ + +goog.provide('org.apache.flex.utils.Language'); + + + +/** + * @constructor + */ +org.apache.flex.utils.Language = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.utils.Language.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'Language', + qName: 'org.apache.flex.utils.Language'}] }; + + +/** + * as() + * + * @expose + * @param {?} leftOperand The lefthand operand of the + * binary as operator in AS3. + * @param {?} rightOperand The righthand operand of the + * binary operator in AS3. + * @param {?=} opt_coercion The cast is a coercion, + * throw expception if it fails. + * @return {?} Returns the lefthand operand if it is of the + * type of the righthand operand, otherwise null. + */ +org.apache.flex.utils.Language.as = function(leftOperand, rightOperand, opt_coercion) { + var error, itIs, message; + + opt_coercion = (opt_coercion !== undefined) ? opt_coercion : false; + + itIs = org.apache.flex.utils.Language.is(leftOperand, rightOperand); + + if (!itIs && opt_coercion) { + message = 'Type Coercion failed'; + if (TypeError) { + error = new TypeError(message); + } else { + error = new Error(message); + } + throw error; + } + + return (itIs) ? leftOperand : null; +}; + + +/** + * int() + * + * @expose + * @param {?} value The value to be cast. + * @return {number} + */ +org.apache.flex.utils.Language._int = function(value) { + return value >> 0; +}; + + +/** + * is() + * + * @expose + * @param {?} leftOperand The lefthand operand of the + * binary as operator in AS3. + * @param {?} rightOperand The righthand operand of the + * binary operator in AS3. + * @return {boolean} + */ +org.apache.flex.utils.Language.is = function(leftOperand, rightOperand) { + var checkInterfaces, superClass; + + // (erikdebruin) we intentionally DON'T do null checks on the + // [class].FLEXJS_CLASS_INFO property, as it MUST be + // declared for every FLEXJS JS (framework) class + + if (leftOperand && !rightOperand) { + return false; + } + + checkInterfaces = function(left) { + var i, interfaces; + + interfaces = left.FLEXJS_CLASS_INFO.interfaces; + for (i = interfaces.length - 1; i > -1; i--) { + if (interfaces[i] === rightOperand) { + return true; + } + + if (interfaces[i].prototype.FLEXJS_CLASS_INFO.interfaces) { + return checkInterfaces(new interfaces[i]()); + } + } + + return false; + }; + + if ((rightOperand === String && typeof leftOperand === 'string') || + (leftOperand instanceof /** @type {Object} */(rightOperand))) { + return true; + } + if ((rightOperand === Number && typeof leftOperand === 'number') || + (leftOperand instanceof /** @type {Object} */(rightOperand))) { + return true; + } + + if (leftOperand.FLEXJS_CLASS_INFO.interfaces) { + if (checkInterfaces(leftOperand)) { + return true; + } + } + + superClass = leftOperand.constructor.superClass_; + if (superClass) { + while (superClass && superClass.FLEXJS_CLASS_INFO) { + if (superClass.FLEXJS_CLASS_INFO.interfaces) { + if (checkInterfaces(superClass)) { + return true; + } + } + superClass = superClass.constructor.superClass_; + } + } + + return false; +}; + + +/** + * trace() + * + * @expose + * @param {string=} opt_value The message to be written to the console. + */ +org.apache.flex.utils.Language.trace = function(opt_value) { + var theConsole; + + opt_value = (opt_value !== undefined) ? opt_value : ''; + + theConsole = goog.global.console; + + if (theConsole === undefined && window.console !== undefined) + theConsole = window.console; + + try { + if (theConsole && theConsole.log) { + theConsole.log(opt_value); + } + } catch (e) { + // ignore; at least we tried ;-) + } +}; + + +/** + * uint() + * + * @expose + * @param {?} value The value to be cast. + * @return {number} + */ +org.apache.flex.utils.Language.uint = function(value) { + return value >>> 0; +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/vf2js_mx/components/Button.js ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/vf2js_mx/components/Button.js b/vf2js/frameworks/js/src/vf2js_mx/components/Button.js new file mode 100644 index 0000000..6e984b8 --- /dev/null +++ b/vf2js/frameworks/js/src/vf2js_mx/components/Button.js @@ -0,0 +1,24 @@ +/** + * 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 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. + */ + +'use strict'; + +goog.provide('vf2js_mx.components.Button'); + + + +/** + * @constructor + */ +vf2js_mx.components.Button = function() {}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/vf2js_s/components/Application.js ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/vf2js_s/components/Application.js b/vf2js/frameworks/js/src/vf2js_s/components/Application.js new file mode 100644 index 0000000..247b13c --- /dev/null +++ b/vf2js/frameworks/js/src/vf2js_s/components/Application.js @@ -0,0 +1,30 @@ +/** + * 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 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. + */ + +/** + * @fileoverview 'Spark' Application class. + * + * @author erikdebr...@apache.org (Erik de Bruin) + */ + +'use strict'; + +goog.provide('vf2js_s.components.Application'); + + + +/** + * @constructor + */ +vf2js_s.components.Application = function() {}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/vf2js_s/components/Button.css ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/vf2js_s/components/Button.css b/vf2js/frameworks/js/src/vf2js_s/components/Button.css new file mode 100644 index 0000000..4d05b32 --- /dev/null +++ b/vf2js/frameworks/js/src/vf2js_s/components/Button.css @@ -0,0 +1,17 @@ +/** + * 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 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. + */ + +.vf2js_s-components-buttonrenderer { + color: red; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/vf2js_s/components/Button.js ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/vf2js_s/components/Button.js b/vf2js/frameworks/js/src/vf2js_s/components/Button.js new file mode 100644 index 0000000..a0beed4 --- /dev/null +++ b/vf2js/frameworks/js/src/vf2js_s/components/Button.js @@ -0,0 +1,163 @@ +/** + * 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 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. + */ + +/** + * @fileoverview A 'Spark' button component. + * + * @author erikdebr...@apache.org (Erik de Bruin) + */ + +'use strict'; + +goog.provide('vf2js_s.components.Button'); + +goog.require('goog.ui.Control'); +goog.require('vf2js_s.components.ButtonRenderer'); + + + +/** + * @constructor + * + * @extends {goog.ui.Control} + */ +vf2js_s.components.Button = function() { + vf2js_s.components.Button.base(this, 'constructor'); +}; +goog.inherits(vf2js_s.components.Button, goog.ui.Control); + + +//------------------------------------------------------------------------------ +// +// Enums +// +//------------------------------------------------------------------------------ + + +/** + * IdFragment + * + * @enum {string} + */ +vf2js_s.components.Button.IdFragment = { + BUTTON: 'button' +}; + + +//------------------------------------------------------------------------------ +// +// Properties +// +//------------------------------------------------------------------------------ + + +//-------------------------------------- +// id +//-------------------------------------- + +/** + * @type {string} + */ +vf2js_s.components.Button.prototype.id; + + +//-------------------------------------- +// label +//-------------------------------------- + +/** + * @private + * + * @type {string} + */ +vf2js_s.components.Button.prototype.label_; + +/** + * @type {string} + */ +vf2js_s.components.Button.prototype.label; + +Object.defineProperty(vf2js_s.components.Button.prototype, 'label', { + get: function () { + return this.label_; + }, + set: function (value) { + var /** @type {Element} */ element; + + this.label_ = value; + + element = this.getElement(); + if (element) { + element.firstChild.value = this.label_; + } + } +}); + + +//------------------------------------------------------------------------------ +// +// Methods +// +//------------------------------------------------------------------------------ + + +/** + * enterDocument + * + * @inheritDoc + */ +vf2js_s.components.Button.prototype.enterDocument = function() { + vf2js_s.components.Button.base(this, 'enterDocument'); + + this.setId(this.id); + + this.label = this.label_; + + // - add handlers using 'this.getHandler()' +}; + + +/** + * exitDocument + * + * @inheritDoc + */ +vf2js_s.components.Button.prototype.exitDocument = function() { + vf2js_s.components.Button.base(this, 'exitDocument'); + + // - remove handlers that are not attached with 'this.getHandler()' +}; + + +/** + * disposeInternal + * + * @inheritDoc + */ +vf2js_s.components.Button.prototype.disposeInternal = function() { + vf2js_s.components.Button.base(this, 'disposeInternal'); + + // +}; + + +//------------------------------------------------------------------------------ +// +// Metadata +// +//------------------------------------------------------------------------------ + + +goog.ui.registry.setDefaultRenderer(vf2js_s.components.Button, + vf2js_s.components.ButtonRenderer); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/src/vf2js_s/components/ButtonRenderer.js ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/src/vf2js_s/components/ButtonRenderer.js b/vf2js/frameworks/js/src/vf2js_s/components/ButtonRenderer.js new file mode 100644 index 0000000..009e9b3 --- /dev/null +++ b/vf2js/frameworks/js/src/vf2js_s/components/ButtonRenderer.js @@ -0,0 +1,92 @@ +/** + * 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 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. + */ + +/** + * @fileoverview The renderer for 'Spark' button components. + * + * @author erikdebr...@apache.org (Erik de Bruin) + */ + +'use strict'; + +goog.provide('vf2js_s.components.ButtonRenderer'); + +goog.require('goog.ui.ControlRenderer'); + + + +/** + * @constructor + * + * @extends {goog.ui.ControlRenderer} + */ +vf2js_s.components.ButtonRenderer = function() { + vf2js_s.components.ButtonRenderer.base(this, 'constructor'); +}; +goog.inherits(vf2js_s.components.ButtonRenderer, goog.ui.ControlRenderer); +goog.addSingletonGetter(vf2js_s.components.ButtonRenderer); + + +//------------------------------------------------------------------------------ +// +// Static Constants +// +//------------------------------------------------------------------------------ + + +/** + * CSS_CLASS + * + * @const + * + * @type {string} + */ +vf2js_s.components.ButtonRenderer.CSS_CLASS = + 'vf2js_s-components-buttonrenderer'; + + +//------------------------------------------------------------------------------ +// +// Methods +// +//------------------------------------------------------------------------------ + + +/** + * getCssClass + * + * @inheritDoc + */ +vf2js_s.components.ButtonRenderer.prototype.getCssClass = function () { + return vf2js_s.components.ButtonRenderer.CSS_CLASS; +}; + + +/** + * createDom + * + * @inheritDoc + */ +vf2js_s.components.ButtonRenderer.prototype.createDom = function (button) { + var /** @type {?Element} */ element; + + element = vf2js_s.components.ButtonRenderer.base(this, 'createDom', button); + + element.appendChild( + goog.dom.createDom('input', { 'type': 'button' })); + + button.setElementInternal(element); + + return element; +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/644f932f/vf2js/frameworks/js/tests.html ---------------------------------------------------------------------- diff --git a/vf2js/frameworks/js/tests.html b/vf2js/frameworks/js/tests.html new file mode 100644 index 0000000..9bdcb83 --- /dev/null +++ b/vf2js/frameworks/js/tests.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge" > + + <script src="/Users/erik/Documents/ApacheFlex/dependencies/GoogleClosure/library/closure/goog/base.js"></script> + + <script src="/Users/erik/Documents/eclipse (kepler)/.metadata/.closure/Users/erik/Documents/ApacheFlex/dependencies/GoogleClosure/library.js"></script> + + <script src="/Users/erik/Documents/eclipse (kepler)/.metadata/.closure/Users/erik/Documents/ApacheFlex/git/flex-asjs/frameworks/js/VF2JS/src.js"></script> + + <script> + goog.require('vf2js_s.components.Button'); + </script> + +</head> +<body onload="init();"> + + <script> + + function init() { + var /** @type {vf2js_s.components.Button} */ button; + + button = new vf2js_s.components.Button(); + button.id = 'myBtn'; + button.label = 'helloWorld'; + button.render(); + } + + </script> + +</body> +</html> \ No newline at end of file