You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2014/07/30 14:57:38 UTC
[1/2] git commit: [flex-asjs] [refs/heads/VF2JS] - Add temporary copy
of FlexJS 'org.apache.flex.utils.Language' class.
Repository: flex-asjs
Updated Branches:
refs/heads/VF2JS fb32fd9a5 -> a0d97304a
Add temporary copy of FlexJS 'org.apache.flex.utils.Language' class.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a0d97304
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a0d97304
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a0d97304
Branch: refs/heads/VF2JS
Commit: a0d97304ad2d92bc6df4bb2fda2ecd1c053338b4
Parents: c755b3e
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Jul 30 14:56:40 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Jul 30 14:57:20 2014 +0200
----------------------------------------------------------------------
.../VF2JS/src/org/apache/flex/utils/Language.js | 186 +++++++++++++++++++
1 file changed, 186 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0d97304/frameworks/js/VF2JS/src/org/apache/flex/utils/Language.js
----------------------------------------------------------------------
diff --git a/frameworks/js/VF2JS/src/org/apache/flex/utils/Language.js b/frameworks/js/VF2JS/src/org/apache/flex/utils/Language.js
new file mode 100644
index 0000000..619edb1
--- /dev/null
+++ b/frameworks/js/VF2JS/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;
+};
[2/2] git commit: [flex-asjs] [refs/heads/VF2JS] - Add preliminary
VF2JS 'Spark' Application class.
Posted by er...@apache.org.
Add preliminary VF2JS 'Spark' Application class.
Signed-off-by: Erik de Bruin <er...@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/c755b3e6
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c755b3e6
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c755b3e6
Branch: refs/heads/VF2JS
Commit: c755b3e633c646fdbd72087ca038e2ef38b83087
Parents: fb32fd9
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Jul 30 14:55:58 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Jul 30 14:57:20 2014 +0200
----------------------------------------------------------------------
.../VF2JS/src/vf2js_s/components/Application.js | 30 ++++++++++++++++++++
1 file changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c755b3e6/frameworks/js/VF2JS/src/vf2js_s/components/Application.js
----------------------------------------------------------------------
diff --git a/frameworks/js/VF2JS/src/vf2js_s/components/Application.js b/frameworks/js/VF2JS/src/vf2js_s/components/Application.js
new file mode 100644
index 0000000..247b13c
--- /dev/null
+++ b/frameworks/js/VF2JS/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 erikdebruin@apache.org (Erik de Bruin)
+ */
+
+'use strict';
+
+goog.provide('vf2js_s.components.Application');
+
+
+
+/**
+ * @constructor
+ */
+vf2js_s.components.Application = function() {};