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 2015/04/15 23:43:27 UTC
[22/55] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - move
handwritten JS code to final home. Build scripts still need fixing up
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/events/MouseEvent.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/events/MouseEvent.js b/frameworks/projects/Core/js/src/org/apache/flex/events/MouseEvent.js
new file mode 100644
index 0000000..64e61d7
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/events/MouseEvent.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_events_MouseEvent');
+
+goog.require('goog.events.BrowserEvent');
+
+
+
+/**
+ * @constructor
+ * @extends {goog.events.BrowserEvent}
+ *
+ * This is a shim class. As long as you don't test
+ * with "is" or "as", your code should work even
+ * if the runtime is actually sending a native
+ * browser MouseEvent
+ */
+org_apache_flex_events_MouseEvent = function() {
+ org_apache_flex_events_MouseEvent.base(this, 'constructor');
+};
+goog.inherits(org_apache_flex_events_MouseEvent,
+ goog.events.BrowserEvent);
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.ROLL_OVER = 'rollover';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.ROLL_OUT = 'rollout';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.MOUSE_OVER = 'mouseover';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.MOUSE_OUT = 'mouseout';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.MOUSE_UP = 'mouseup';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.MOUSE_DOWN = 'mousedown';
+
+
+/**
+ * @type {string}
+ */
+org_apache_flex_events_MouseEvent.MOUSE_MOVE = 'mousemove';
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_events_MouseEvent.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'MouseEvent',
+ qName: 'org_apache_flex_events_MouseEvent' }] };
+
+
+/**
+ * @return {boolean}
+ */
+org_apache_flex_events_MouseEvent.installRollOverMixin = function() {
+ window.addEventListener(org_apache_flex_events_MouseEvent.MOUSE_OVER,
+ org_apache_flex_events_MouseEvent.mouseOverHandler);
+ return true;
+};
+
+
+/**
+ * @param {Event} e The event.
+ * RollOver/RollOut is entirely implemented in mouseOver because
+ * when a parent and child share an edge, you only get a mouseout
+ * for the child and not the parent and you need to send rollout
+ * to both. A similar issue exists for rollover.
+ */
+org_apache_flex_events_MouseEvent.mouseOverHandler = function(e) {
+ var j, m, outs, me, parent;
+ var target = e.target.flexjs_wrapper;
+ if (target === undefined)
+ return; // probably over the html tag
+ var targets = org_apache_flex_events_MouseEvent.targets;
+ var index = targets.indexOf(target);
+ if (index != -1) {
+ // get all children
+ outs = targets.slice(index + 1);
+ m = outs.length;
+ for (j = 0; j < m; j++) {
+ me = org_apache_flex_events_MouseEvent.makeMouseEvent(
+ org_apache_flex_events_MouseEvent.ROLL_OUT, e);
+ outs[j].element.dispatchEvent(me);
+ }
+ org_apache_flex_events_MouseEvent.targets = targets.slice(0, index + 1);
+ }
+ else {
+ var newTargets = [target];
+ if (target.hasOwnProperty('parent') === undefined)
+ parent = null;
+ else
+ parent = target.parent;
+ while (parent) {
+ index = targets.indexOf(parent);
+ if (index == -1) {
+ newTargets.unshift(parent);
+ if (parent.hasOwnProperty('parent') === undefined)
+ break;
+ parent = parent.parent;
+ }
+ else {
+ outs = targets.slice(index + 1);
+ m = outs.length;
+ for (j = 0; j < m; j++) {
+ me = org_apache_flex_events_MouseEvent.makeMouseEvent(
+ org_apache_flex_events_MouseEvent.ROLL_OUT, e);
+ outs[j].element.dispatchEvent(me);
+ }
+ targets = targets.slice(0, index + 1);
+ break;
+ }
+ }
+ var n = newTargets.length;
+ for (var i = 0; i < n; i++) {
+ me = org_apache_flex_events_MouseEvent.makeMouseEvent(
+ org_apache_flex_events_MouseEvent.ROLL_OVER, e);
+ newTargets[i].element.dispatchEvent(me);
+ }
+ org_apache_flex_events_MouseEvent.targets = targets.concat(newTargets);
+ }
+};
+
+
+/**
+ * @type {boolean}
+ */
+org_apache_flex_events_MouseEvent.rollOverMixin =
+ org_apache_flex_events_MouseEvent.installRollOverMixin();
+
+
+/**
+ * @type {Object}
+ */
+org_apache_flex_events_MouseEvent.targets = [];
+
+
+/**
+ * @param {string} type The event type.
+ * @param {Event} e The mouse event.
+ * @return {MouseEvent} The new event.
+ */
+org_apache_flex_events_MouseEvent.makeMouseEvent = function(type, e) {
+ var out = new MouseEvent(type);
+ out.initMouseEvent(type, false, false,
+ e.view, e.detail, e.screenX, e.screenY,
+ e.clientX, e.clientY, e.ctrlKey, e.altKey,
+ e.shiftKey, e.metaKey, e.button, e.relatedTarget);
+ return out;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/events/ValueChangeEvent.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/events/ValueChangeEvent.js b/frameworks/projects/Core/js/src/org/apache/flex/events/ValueChangeEvent.js
new file mode 100644
index 0000000..1ae2344
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/events/ValueChangeEvent.js
@@ -0,0 +1,119 @@
+/**
+ * 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_events_ValueChangeEvent');
+
+goog.require('goog.events.Event');
+
+
+
+/**
+ * @constructor
+ * @extends {goog.events.Event}
+ * @param {string} type The event type.
+ * @param {boolean} b The bubbles parameter.
+ * @param {boolean} c The cancelable parameter.
+ * @param {*} ov The old value.
+ * @param {*} nv The new value.
+ */
+org_apache_flex_events_ValueChangeEvent = function(type, b, c, ov, nv) {
+ org_apache_flex_events_ValueChangeEvent.base(this, 'constructor', type);
+
+ this.type = type;
+ this.oldValue = ov;
+ this.newValue = nv;
+};
+goog.inherits(org_apache_flex_events_ValueChangeEvent,
+ goog.events.Event);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ValueChangeEvent',
+ qName: 'org_apache_flex_events_ValueChangeEvent' }] };
+
+
+/**
+ * @expose
+ * @param {string} type The event type.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.init = function(type) {
+ this.type = type;
+};
+
+
+/**
+ * @expose
+ * @type {string} type The event type.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.type = '';
+
+
+/**
+ * @expose
+ * @type {*} oldValue The old value.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.oldValue = null;
+
+
+/**
+ * @expose
+ * @type {*} newValue The new value.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.newValue = null;
+
+
+/**
+ * @expose
+ * @type {string} propertyName The property that changed.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.propertyName = '';
+
+
+/**
+ * @expose
+ * @type {Object} source The object that changed.
+ */
+org_apache_flex_events_ValueChangeEvent.prototype.source = null;
+
+
+/**
+ * @expose
+ * @param {Object} source The object that changed.
+ * @param {string} name The property that changed.
+ * @param {*} oldValue The old value.
+ * @param {*} newValue The new value.
+ * @return {Object} An event object.
+ */
+org_apache_flex_events_ValueChangeEvent.createUpdateEvent =
+ function(source, name, oldValue, newValue)
+ {
+ var event = new org_apache_flex_events_ValueChangeEvent(
+ org_apache_flex_events_ValueChangeEvent.VALUE_CHANGE,
+ false, false, oldValue, newValue);
+ event.propertyName = name;
+ event.source = source;
+ return event;
+};
+
+
+/**
+ * @expose
+ * @type {string} VALUE_CHANGE The type of the event.
+ */
+org_apache_flex_events_ValueChangeEvent.VALUE_CHANGE = 'valueChange';
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/events/ValueEvent.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/events/ValueEvent.js b/frameworks/projects/Core/js/src/org/apache/flex/events/ValueEvent.js
new file mode 100644
index 0000000..acf5328
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/events/ValueEvent.js
@@ -0,0 +1,69 @@
+/**
+ * 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_events_ValueEvent');
+
+goog.require('goog.events.Event');
+
+
+
+/**
+ * @constructor
+ * @extends {goog.events.Event}
+ * @param {string} type The event type.
+ * @param {*} v The value.
+ */
+org_apache_flex_events_ValueEvent = function(type, v) {
+ org_apache_flex_events_ValueEvent.base(this, 'constructor', type);
+
+ this.type = type;
+ this.value = v;
+};
+goog.inherits(org_apache_flex_events_ValueEvent,
+ goog.events.Event);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_events_ValueEvent.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ValueEvent',
+ qName: 'org_apache_flex_events_ValueEvent' }] };
+
+
+/**
+ * @expose
+ * @param {string} type The event type.
+ */
+org_apache_flex_events_ValueEvent.prototype.init = function(type) {
+ this.type = type;
+};
+
+
+/**
+ * @expose
+ * @type {string} type The event type.
+ */
+org_apache_flex_events_ValueEvent.prototype.type = '';
+
+
+/**
+ * @expose
+ * @type {*} value The old value.
+ */
+org_apache_flex_events_ValueEvent.prototype.value = null;
+
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/events/utils/MouseUtils.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/events/utils/MouseUtils.js b/frameworks/projects/Core/js/src/org/apache/flex/events/utils/MouseUtils.js
new file mode 100644
index 0000000..f628125
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/events/utils/MouseUtils.js
@@ -0,0 +1,62 @@
+/**
+ * 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_events_utils_MouseUtils');
+
+
+/**
+ * @param {Object} event The event.
+ * @return {Object} class instance associated with the event.target.
+ */
+org_apache_flex_events_utils_MouseUtils.eventTarget = function(event) {
+ var target = event.target;
+ return target.flexjs_wrapper;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The x position of the mouse with respect to its parent.
+ */
+org_apache_flex_events_utils_MouseUtils.localX = function(event) {
+ return event.offsetX;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The y position of the mouse with respect to its parent.
+ */
+org_apache_flex_events_utils_MouseUtils.localY = function(event) {
+ return event.offsetY;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The x position of the mouse with respect to the screen.
+ */
+org_apache_flex_events_utils_MouseUtils.globalX = function(event) {
+ return event.clientX;
+};
+
+
+/**
+ * @param {Object} event The event.
+ * @return {number} The y position of the mouse with respect to the screen.
+ */
+org_apache_flex_events_utils_MouseUtils.globalY = function(event) {
+ return event.clientY;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/geom/Point.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/geom/Point.js b/frameworks/projects/Core/js/src/org/apache/flex/geom/Point.js
new file mode 100644
index 0000000..bb0a030
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/geom/Point.js
@@ -0,0 +1,56 @@
+/**
+ * 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_geom_Point');
+
+
+
+/**
+ * @constructor
+ * @param {number} x
+ * @param {number} y
+ */
+org_apache_flex_geom_Point = function(x, y) {
+
+ this.x = x;
+
+ this.y = y;
+
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_geom_Point.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'Point',
+ qName: 'org_apache_flex_geom_Point'}] };
+
+
+/**
+ * @expose
+ * The x coordinate.
+ * @type {number} value The x coordinate.
+ */
+org_apache_flex_geom_Point.prototype.x = 0;
+
+
+/**
+ * @expose
+ * The y coordinate.
+ * @type {number} value The y coordinate.
+ */
+org_apache_flex_geom_Point.prototype.y = 0;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/geom/Rectangle.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/geom/Rectangle.js b/frameworks/projects/Core/js/src/org/apache/flex/geom/Rectangle.js
new file mode 100644
index 0000000..5e7ebf6
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/geom/Rectangle.js
@@ -0,0 +1,78 @@
+/**
+ * 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_geom_Rectangle');
+
+
+
+/**
+ * @constructor
+ * @param {number} left
+ * @param {number} top
+ * @param {number} width
+ * @param {number} height
+ */
+org_apache_flex_geom_Rectangle = function(left, top, width, height) {
+
+ this.left = left;
+
+ this.top = top;
+
+ this.width = width;
+
+ this.height = height;
+
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_geom_Rectangle.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'Rectangle',
+ qName: 'org_apache_flex_geom_Rectangle'}] };
+
+
+/**
+ * @expose
+ * The left coordinate.
+ * @type {number} value The left coordinate.
+ */
+org_apache_flex_geom_Rectangle.prototype.left = 0;
+
+
+/**
+ * @expose
+ * The top coordinate.
+ * @type {number} value The top coordinate.
+ */
+org_apache_flex_geom_Rectangle.prototype.top = 0;
+
+
+/**
+ * @expose
+ * The width coordinate.
+ * @type {number} value The width coordinate.
+ */
+org_apache_flex_geom_Rectangle.prototype.width = 0;
+
+
+/**
+ * @expose
+ * The height coordinate.
+ * @type {number} value The height coordinate.
+ */
+org_apache_flex_geom_Rectangle.prototype.height = 9;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/svg/TextButton.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/svg/TextButton.js b/frameworks/projects/Core/js/src/org/apache/flex/svg/TextButton.js
new file mode 100644
index 0000000..8e109df
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/svg/TextButton.js
@@ -0,0 +1,89 @@
+/**
+ * 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_svg_TextButton');
+
+goog.require('org_apache_flex_core_UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_UIBase}
+ */
+org_apache_flex_svg_TextButton = function() {
+ org_apache_flex_svg_TextButton.base(this, 'constructor');
+};
+goog.inherits(org_apache_flex_svg_TextButton,
+ org_apache_flex_core_UIBase);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_svg_TextButton.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'TextButton',
+ qName: 'org_apache_flex_svg_TextButton'}] };
+
+
+/**
+ * @override
+ */
+org_apache_flex_svg_TextButton.prototype.createElement =
+ function() {
+ this.element = document.createElement('embed');
+ this.element.setAttribute('src', 'org/apache/flex/svg/assets/TextButton_Skin.svg');
+
+ this.positioner = this.element;
+
+ return this.element;
+};
+
+
+/**
+ * @override
+ */
+org_apache_flex_svg_TextButton.prototype.finalizeElement =
+ function() {
+ var listenersArray;
+ if (goog.events.hasListener(this.element, goog.events.EventType.CLICK)) {
+ listenersArray = goog.events.getListeners(this.element, goog.events.EventType.CLICK, false);
+
+ /* As we are assigning an actual function object instead of just the name,
+ make sure to use a unique name ('clickHandler') instead of a native
+ name, like 'click' or 'onclick'.
+
+ Note: use array notation for property assignment so the compiler doesn't
+ rename the property ;-)
+ */
+ this.element['clickHandler'] = listenersArray[0].listener;
+ }
+};
+
+
+Object.defineProperties(org_apache_flex_svg_TextButton.prototype, {
+ /** @expose */
+ text: {
+ /** @this {org_apache_flex_svg_TextButton} */
+ get: function() {
+ return this.element.getAttribute('label');
+ },
+ /** @this {org_apache_flex_svg_TextButton} */
+ set: function(value) {
+ this.element.setAttribute('label', value);
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/svg/assets/TextButton_Skin.svg
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/svg/assets/TextButton_Skin.svg b/frameworks/projects/Core/js/src/org/apache/flex/svg/assets/TextButton_Skin.svg
new file mode 100644
index 0000000..7986725
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/svg/assets/TextButton_Skin.svg
@@ -0,0 +1,279 @@
+<?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.
+
+-->
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="button" width="100%" height="100%"
+ onload="return init(evt)"
+ onmouseover="return handleMouseOver(evt)"
+ onmousedown="return handleMouseDown(evt)"
+ onmouseup="return handleMouseUp(evt)"
+ onmouseout="return handleMouseOut(evt)"
+ onclick="handleOnClick(evt)"
+ >
+ <style type="text/css">
+ .button {cursor: pointer;}
+ </style>
+
+ <script type="text/ecmascript">
+ <![CDATA[
+
+ var labelStr = "";
+ var clickHandler;
+
+ function init(event)
+ {
+ //Set Initial button state
+ document.getElementById("button_up").style.display="inline";
+ document.getElementById("button_over").style.display="none";
+ document.getElementById("button_down").style.display="none";
+
+ //Set label from the embed's frameElement.attributes values
+ labelStr = window.frameElement.attributes["label"].value;
+ var labelElement = document.getElementById("labelDisplay");
+ labelElement.firstChild.nodeValue = labelStr;
+
+ //Store callbacks
+ clickHandler = window.frameElement.clickHandler;
+ }
+
+ function handleMouseOver(event)
+ {
+ document.getElementById("button_up").style.display="none";
+ document.getElementById("button_over").style.display="inline";
+ document.getElementById("button_down").style.display="none";
+ }
+
+ function handleMouseDown(event)
+ {
+ document.getElementById("button_up").style.display="none";
+ document.getElementById("button_over").style.display="none";
+ document.getElementById("button_down").style.display="inline";
+ }
+
+ function handleMouseUp(event)
+ {
+ document.getElementById("button_up").style.display="none";
+ document.getElementById("button_over").style.display="inline";
+ document.getElementById("button_down").style.display="none";
+ }
+
+ function handleMouseOut(event)
+ {
+ document.getElementById("button_up").style.display="inline";
+ document.getElementById("button_over").style.display="none";
+ document.getElementById("button_down").style.display="none";
+ }
+
+ function handleOnClick(evt)
+ {
+ clickHandler(evt,this);
+ }
+
+ ]]></script>
+ <svg xmlns="http://www.w3.org/2000/svg" id="button_up" width="100%" height="100%" version="1.1" >
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="-1" right="-1" top="-1" bottom="-1">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientx63x32" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#000000" stop-opacity="0.01" />
+ <stop offset="1" stop-color="#000000" stop-opacity="0.07" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_shadow" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_up_idLinearGradientx63x32)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientx63x54" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#FFFFFF" stop-opacity="0.85" />
+ <stop offset="1" stop-color="#D8D8D8" stop-opacity="0.85" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_fill" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_up_idLinearGradientx63x54)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientx63x76" x1="0%" y1="100%" x2="0%" y2="0%">
+ <stop offset="0.0" stop-color="#000000" stop-opacity="0.0627" />
+ <stop offset="0.48" stop-color="#000000" stop-opacity="0.0099" />
+ <stop offset="0.48001" stop-color="#000000" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_lowlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_up_idLinearGradientx63x76)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientx63x100" gradientTransform="rotate(90)">
+ <stop offset="0.0" stop-color="#FFFFFF" stop-opacity="0.33" />
+ <stop offset="0.48" stop-color="#FFFFFF" stop-opacity="0.33" />
+ <stop offset="0.48001" stop-color="#FFFFFF" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_highlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_up_idLinearGradientx63x100)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientStrokex63x129" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#FFFFFF" />
+ <stop offset="1" stop-color="#D8D8D8" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_highlightStroke" rx="2" ry="2" width="100%" height="100%" fill="none" style="stroke-width:2;stroke:url(#button_up_idLinearGradientStrokex63x129)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="0" right="0" top="0" bottom="0">
+ <defs>
+ <linearGradient id="button_up_idLinearGradientStrokex63x205" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#000000" stop-opacity="0.5625" />
+ <stop offset="1" stop-color="#000000" stop-opacity="0.75" />
+ </linearGradient>
+ </defs>
+ <rect id="button_up_border" rx="2" ry="2" width="100%" height="100%" fill="none" style="stroke-width:2;stroke:url(#button_up_idLinearGradientStrokex63x205)" />
+ </svg>
+ </svg>
+
+ <svg xmlns="http://www.w3.org/2000/svg" id="button_over" width="100%" height="100%" version="1.1" >
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="-1" right="-1" top="-1" bottom="-1">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientx63x32" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#000000" stop-opacity="0.01" />
+ <stop offset="1" stop-color="#000000" stop-opacity="0.07" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_shadow" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_over_idLinearGradientx63x32)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientx63x54" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#BBBDBD" stop-opacity="0.85" />
+ <stop offset="1" stop-color="#9FA0A1" stop-opacity="0.85" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_fill" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_over_idLinearGradientx63x54)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientx63x76" x1="0%" y1="100%" x2="0%" y2="0%">
+ <stop offset="0.0" stop-color="#000000" stop-opacity="0.0627" />
+ <stop offset="0.48" stop-color="#000000" stop-opacity="0.0099" />
+ <stop offset="0.48001" stop-color="#000000" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_lowlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_over_idLinearGradientx63x76)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientx63x100" gradientTransform="rotate(90)">
+ <stop offset="0.0" stop-color="#FFFFFF" stop-opacity="0.22" />
+ <stop offset="0.48" stop-color="#FFFFFF" stop-opacity="0.22" />
+ <stop offset="0.48001" stop-color="#FFFFFF" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_highlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_over_idLinearGradientx63x100)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientStrokex63x129" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#FFFFFF" stop-opacity="0.22" />
+ <stop offset="1" stop-color="#D8D8D8" stop-opacity="0.22" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_highlightStroke" rx="2" ry="2" width="100%" height="100%" fill="none" style="stroke-width:2;stroke:url(#button_over_idLinearGradientStrokex63x129)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="0" right="0" top="0" bottom="0">
+ <defs>
+ <linearGradient id="button_over_idLinearGradientStrokex63x205" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#000000" stop-opacity="0.5625" />
+ <stop offset="1" stop-color="#000000" stop-opacity="0.75" />
+ </linearGradient>
+ </defs>
+ <rect id="button_over_border" width="100%" height="100%" rx="2" ry="2" fill="none" style="stroke-width:2;stroke:url(#button_over_idLinearGradientStrokex63x205)" />
+ </svg>
+ </svg>
+ <svg xmlns="http://www.w3.org/2000/svg" id="button_down" width="100%" height="100%" version="1.1" >
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="-1" right="-1" top="-1" bottom="-1">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientx63x32" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#FFFFFF" stop-opacity="0" />
+ <stop offset="1" stop-color="#FFFFFF" stop-opacity="0.5" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_shadow" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_down_idLinearGradientx63x32)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientx63x54" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#AAAAAA" stop-opacity="0.85" />
+ <stop offset="1" stop-color="#929496" stop-opacity="0.85" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_fill" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_down_idLinearGradientx63x54)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientx63x76" x1="0%" y1="100%" x2="0%" y2="0%">
+ <stop offset="0.0" stop-color="#000000" stop-opacity="0.0627" />
+ <stop offset="0.48" stop-color="#000000" stop-opacity="0.0099" />
+ <stop offset="0.48001" stop-color="#000000" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_lowlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_down_idLinearGradientx63x76)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientx63x100" gradientTransform="rotate(90)">
+ <stop offset="0.0" stop-color="#FFFFFF" stop-opacity="0.12" />
+ <stop offset="0.48" stop-color="#FFFFFF" stop-opacity="0.12" />
+ <stop offset="0.48001" stop-color="#FFFFFF" stop-opacity="0" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_highlight" rx="2" ry="2" width="100%" height="100%" style="fill:url(#button_down_idLinearGradientx63x100)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="1" right="1" top="1" bottom="1">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientStrokex63x149" gradientTransform="rotate(90)">
+ <stop offset="0.0" stop-color="#000000" stop-opacity="0.25" />
+ <stop offset="0.001" stop-color="#000000" stop-opacity="0.25" />
+ <stop offset="0.0011" stop-color="#000000" stop-opacity="0.07" />
+ <stop offset="0.965" stop-color="#000000" stop-opacity="0.07" />
+ <stop offset="0.9651" stop-color="#000000" stop-opacity="0.00" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_hldownstroke1" rx="2" ry="2" width="100%" height="100%" fill="none" style="stroke-width:2;stroke:url(#button_down_idLinearGradientStrokex63x149)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="2" right="2" top="2" bottom="2">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientStrokex63x182" gradientTransform="rotate(90)">
+ <stop offset="0.0" stop-color="#000000" stop-opacity="0.09" />
+ <stop offset="0.0001" stop-color="#000000" stop-opacity="0.00" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_hldownstroke2" rx="2" ry="2" width="100%" height="100%" fill="none" style="stroke-width:2;stroke:url(#button_down_idLinearGradientStrokex63x182)" />
+ </svg>
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" left="0" right="0" top="0" bottom="0">
+ <defs>
+ <linearGradient id="button_down_idLinearGradientStrokex63x205" gradientTransform="rotate(90)">
+ <stop offset="0" stop-color="#000000" stop-opacity="0.6375" />
+ <stop offset="1" stop-color="#000000" stop-opacity="0.85" />
+ </linearGradient>
+ </defs>
+ <rect id="button_down_border" width="100%" height="100%" rx="2" ry="2" fill="none" style="stroke-width:2;stroke:url(#button_down_idLinearGradientStrokex63x205)" />
+ </svg>
+ </svg>
+ <svg id="labelDisplaySVG" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" version="1.1" >
+ <text id="labelDisplay" text-anchor="middle" font-family="verdana" font-size="12" dy=".3em" x="50%" y="50%" > </text>
+ </svg>
+ <rect id="mouse_catcher" width="100%" height="100%" fill="none" pointer-events="all"/>
+</svg>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/BeadMetrics.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/BeadMetrics.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/BeadMetrics.js
new file mode 100644
index 0000000..98de8da
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/BeadMetrics.js
@@ -0,0 +1,48 @@
+/**
+ * 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_BeadMetrics');
+
+goog.require('org_apache_flex_core_UIMetrics');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_utils_BeadMetrics = function() {
+};
+
+
+/**
+ * @expose
+ * @param {org_apache_flex_core_IStrand} strand The strand whose bounds are required.
+ * @return {org_apache_flex_core_UIMetrics} The bounding box.
+ */
+org_apache_flex_utils_BeadMetrics.getMetrics = function(strand) {
+ var box = new org_apache_flex_core_UIMetrics();
+ var style = strand.element.style;
+ if (style['padding']) {
+ box.top = Number(style.padding);
+ box.left = Number(style.padding);
+ box.right = Number(style.padding);
+ box.bottom = Number(style.padding);
+ } else {
+ if (style['padding_top']) box.top = Number(style.padding_top);
+ if (style['padding_left']) box.left = Number(style.padding_left);
+ if (style['padding_right']) box.right = Number(style.padding_right);
+ if (style['padding_bottom']) box.bottom = Number(style.padding_bottom);
+ }
+ return box;
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/BinaryData.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/BinaryData.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/BinaryData.js
new file mode 100644
index 0000000..0437029
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/BinaryData.js
@@ -0,0 +1,223 @@
+/**
+ * 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_BinaryData');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_utils_BinaryData = function() {
+
+ /**
+ * @private
+ * @type {ArrayBuffer}
+ */
+ this.data_ = new ArrayBuffer();
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.position_ = 0;
+
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_BinaryData.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'BinaryData',
+ qName: 'org_apache_flex_utils_BinaryData'}] };
+
+
+Object.defineProperties(org_apache_flex_utils_BinaryData.prototype, {
+ /** @expose */
+ data: {
+ /** @this {org_apache_flex_utils_BinaryData} */
+ get: function() {
+ return this.data_;
+ }
+ },
+ /** @expose */
+ position: {
+ /** @this {org_apache_flex_utils_BinaryData} */
+ get: function() {
+ return this.position_;
+ },
+ /** @this {org_apache_flex_utils_BinaryData} */
+ set: function(value) {
+ this.position_ = value;
+ }
+ },
+ /** @expose */
+ length: {
+ /** @this {org_apache_flex_utils_BinaryData} */
+ get: function() {
+ return this.data_.byteLength;
+ }
+ },
+ /** @expose */
+ bytesAvailable: {
+ /** @this {org_apache_flex_utils_BinaryData} */
+ get: function() {
+ return this.data_.byteLength - this.position_;
+ }
+ }
+});
+
+
+/**
+ * @expose
+ * @param {number} b The byte to write.
+ */
+org_apache_flex_utils_BinaryData.prototype.writeByte = function(b) {
+ var view;
+
+ this.growBuffer(1);
+
+ view = new Int8Array(this.data_, this.position_, 1);
+ view[0] = b;
+ this.position_++;
+};
+
+
+/**
+ * @expose
+ * @param {number} s The 16-bit integer to write.
+ */
+org_apache_flex_utils_BinaryData.prototype.writeShort = function(s) {
+ var view;
+
+ this.growBuffer(2);
+
+ view = new Int16Array(this.data_, this.position_, 1);
+ view[0] = s;
+ this.position_ += 2;
+};
+
+
+/**
+ * @expose
+ * @param {number} num The 32-bit integer to write.
+ */
+org_apache_flex_utils_BinaryData.prototype.writeInt = function(num) {
+ var view;
+
+ this.growBuffer(4);
+
+ view = new Int32Array(this.data_, this.position_, 1);
+ view[0] = num;
+ this.position_ += 4;
+};
+
+
+/**
+ * @expose
+ * @param {number} num The 32-bit unsigned integer to write.
+ */
+org_apache_flex_utils_BinaryData.prototype.writeUnsignedInt =
+ function(num) {
+ var view;
+
+ this.growBuffer(4);
+
+ view = new Uint32Array(this.data_, this.position_, 1);
+ view[0] = num;
+ this.position_ += 4;
+};
+
+
+/**
+ * @expose
+ * @return {number} The byte that was read.
+ */
+org_apache_flex_utils_BinaryData.prototype.readByte = function() {
+ var view;
+
+ view = new Int8Array(this.data_, this.position_, 1);
+ this.position_++;
+ return view[0];
+};
+
+
+/**
+ * @expose
+ * @return {number} The 16-bit integer that was read.
+ */
+org_apache_flex_utils_BinaryData.prototype.readShort = function() {
+ var view;
+
+ view = new Int16Array(this.data_, this.position_, 1);
+ this.position_ += 2;
+ return view[0];
+};
+
+
+/**
+ * @expose
+ * @return {number} The 32-bit integer that was read.
+ */
+org_apache_flex_utils_BinaryData.prototype.readInteger = function() {
+ var view;
+
+ view = new Int32Array(this.data_, this.position_, 1);
+ this.position_ += 4;
+ return view[0];
+};
+
+
+/**
+ * @expose
+ * @return {number} The 32-bit unsigned integer that was read.
+ */
+org_apache_flex_utils_BinaryData.prototype.readUnsignedInteger =
+ function() {
+ var view;
+
+ view = new Uint32Array(this.data_, this.position_, 1);
+ this.position_ += 4;
+ return view[0];
+};
+
+
+/**
+ * @expose
+ * @param {number} extra The number of bytes to add to the buffer.
+ */
+org_apache_flex_utils_BinaryData.prototype.growBuffer = function(extra) {
+ var newBuffer, newView, view, i, n;
+
+ if (this.position_ >= this.data_.byteLength)
+ {
+ n = this.data_.byteLength;
+ newBuffer = new ArrayBuffer(n + extra);
+ newView = new Int8Array(newBuffer, 0, n);
+ view = new Int8Array(this.data_, 0, n);
+ for (i = 0; i < n; i++)
+ {
+ newView[i] = view[i];
+ }
+ this.data_ = newBuffer;
+ }
+};
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/EffectTimer.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/EffectTimer.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/EffectTimer.js
new file mode 100644
index 0000000..79d9d68
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/EffectTimer.js
@@ -0,0 +1,94 @@
+/**
+ * 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_EffectTimer');
+
+goog.require('org_apache_flex_core_IEffectTimer');
+goog.require('org_apache_flex_core_ValuesManager');
+goog.require('org_apache_flex_events_EventDispatcher');
+goog.require('org_apache_flex_events_ValueEvent');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_events_EventDispatcher}
+ * @suppress {checkTypes}
+ */
+org_apache_flex_utils_EffectTimer = function() {
+ org_apache_flex_utils_EffectTimer.base(this, 'constructor');
+
+ /**
+ * @protected
+ * @type {number}
+ */
+ this.timerInterval = -1;
+
+ /**
+ * @protected
+ * @type {number}
+ */
+ this._delay = org_apache_flex_core_ValuesManager.valuesImpl.getValue(this,
+ 'effectTimerInterval');
+
+};
+goog.inherits(org_apache_flex_utils_EffectTimer,
+ org_apache_flex_events_EventDispatcher);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_EffectTimer.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'EffectTimer',
+ qName: 'org_apache_flex_utils_EffectTimer'}],
+ interfaces: [org_apache_flex_core_IEffectTimer] };
+
+
+/**
+ * @expose
+ * Stops the timer.
+ */
+org_apache_flex_utils_EffectTimer.prototype.stop = function() {
+ clearInterval(this.timerInterval);
+ this.timerInterval = -1;
+};
+
+
+/**
+ * @expose
+ * Starts the timer.
+ * @return {number} The start time.
+ */
+org_apache_flex_utils_EffectTimer.prototype.start = function() {
+ this.timerInterval =
+ setInterval(goog.bind(this.timerHandler, this), this._delay);
+ var d = new Date();
+ return d.getTime();
+};
+
+
+/**
+ * @protected
+ */
+org_apache_flex_utils_EffectTimer.prototype.timerHandler =
+ function() {
+ var d = new Date();
+ this.dispatchEvent(new org_apache_flex_events_ValueEvent('update', d.getTime()));
+
+};
+
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/Language.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/Language.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/Language.js
new file mode 100644
index 0000000..b890dac
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/Language.js
@@ -0,0 +1,295 @@
+/**
+ * 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;
+
+ if (!leftOperand)
+ return false;
+
+ 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) {
+ var isit = checkInterfaces(new interfaces[i]());
+ if (isit) return true;
+ }
+ }
+
+ return false;
+ };
+
+ if ((rightOperand === String && typeof leftOperand === 'string') ||
+ (leftOperand instanceof /** @type {Object} */(rightOperand))) {
+ return true;
+ }
+ if (typeof leftOperand === 'string')
+ return false; // right was not String otherwise exit above
+ if (typeof leftOperand === 'number')
+ return rightOperand === Number;
+ if (rightOperand === Array && Array.isArray(leftOperand))
+ return true;
+ if (leftOperand.FLEXJS_CLASS_INFO === undefined)
+ return false; // could be a function but not an instance
+ 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 {...Object} var_args The message(s) to be written to the console.
+ */
+org_apache_flex_utils_Language.trace = function(var_args) {
+ var theConsole;
+
+ var msg = '';
+ for (var i = 0; i < arguments.length; i++) {
+ if (i > 0) msg += ' ';
+ msg += arguments[i];
+ }
+
+ theConsole = goog.global.console;
+
+ if (theConsole === undefined && window.console !== undefined)
+ theConsole = window.console;
+
+ try {
+ if (theConsole && theConsole.log) {
+ theConsole.log(msg);
+ }
+ } 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;
+};
+
+
+/**
+ * preincrement handles --foo
+ *
+ * @expose
+ * @param {Object} obj The object with the getter/setter.
+ * @param {string} prop The name of a property.
+ * @return {number}
+ */
+org_apache_flex_utils_Language.preincrement = function(obj, prop) {
+ var value = obj[prop] + 1;
+ obj[prop] = value;
+ return value;
+};
+
+
+/**
+ * predecrement handles ++foo
+ *
+ * @expose
+ * @param {Object} obj The object with the getter/setter.
+ * @param {string} prop The name of a property.
+ * @return {number}
+ */
+org_apache_flex_utils_Language.predecrement = function(obj, prop) {
+ var value = obj[prop] - 1;
+ obj[prop] = value;
+ return value;
+};
+
+
+/**
+ * postincrement handles foo++
+ *
+ * @expose
+ * @param {Object} obj The object with the getter/setter.
+ * @param {string} prop The name of a property.
+ * @return {number}
+ */
+org_apache_flex_utils_Language.postincrement = function(obj, prop) {
+ var value = obj[prop];
+ obj[prop] = value + 1;
+ return value;
+};
+
+
+/**
+ * postdecrement handles foo++
+ *
+ * @expose
+ * @param {Object} obj The object with the getter/setter.
+ * @param {string} prop The name of a property.
+ * @return {number}
+ */
+org_apache_flex_utils_Language.postdecrement = function(obj, prop) {
+ var value = obj[prop];
+ obj[prop] = value + 1;
+ return value;
+};
+
+
+/**
+ * superGetter calls the getter on the given class' superclass.
+ *
+ * @expose
+ * @param {Object} clazz The class.
+ * @param {Object} pthis The this pointer.
+ * @param {string} prop The name of the getter.
+ * @return {Object}
+ */
+org_apache_flex_utils_Language.superGetter = function(clazz, pthis, prop) {
+ var superClass = clazz.superClass_;
+ var superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
+ while (superdesc == null)
+ {
+ superClass = superClass.constructor.superClass_;
+ superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
+ }
+ return superdesc.get.call(pthis);
+};
+
+
+/**
+ * superSetter calls the setter on the given class' superclass.
+ *
+ * @expose
+ * @param {Object} clazz The class.
+ * @param {Object} pthis The this pointer.
+ * @param {string} prop The name of the getter.
+ * @param {Object} value The value.
+ */
+org_apache_flex_utils_Language.superSetter = function(clazz, pthis, prop, value) {
+ var superClass = clazz.superClass_;
+ var superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
+ while (superdesc == null)
+ {
+ superClass = superClass.constructor.superClass_;
+ superdesc = Object.getOwnPropertyDescriptor(superClass, prop);
+ }
+ superdesc.set.apply(pthis, [value]);
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/MXMLDataInterpreter.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/MXMLDataInterpreter.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/MXMLDataInterpreter.js
new file mode 100644
index 0000000..a254a35
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/MXMLDataInterpreter.js
@@ -0,0 +1,410 @@
+/**
+ * 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_MXMLDataInterpreter');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_utils_MXMLDataInterpreter = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_MXMLDataInterpreter.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'MXMLDataInterpreter',
+ qName: 'org_apache_flex_utils_MXMLDataInterpreter'}] };
+
+
+/**
+ * @param {Object} document The MXML object.
+ * @param {Array} data The data array.
+ * @return {Object} The generated object.
+ */
+org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject =
+ function(document, data) {
+ var assignComp, Cls, comp, generateMXMLArray, generateMXMLObject, i, id, j, m,
+ name, simple, value;
+
+ i = 0;
+ Cls = data[i++];
+ comp = new Cls();
+
+ generateMXMLArray =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray;
+ generateMXMLObject =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject;
+
+ if (comp.addBead)
+ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject(document, null, comp, data, i);
+ else {
+ m = data[i++]; // num props
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(document, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(document, value);
+ }
+
+ if (name === 'id') {
+ document[value] = comp;
+ id = value;
+ }
+
+ if (name == 'document' && !comp.document) {
+ comp.document = document;
+ }
+ else if (name === '_id') {
+ document[value] = comp;
+ id = value;
+ }
+ else if (name === 'id') {
+ try {
+ comp.id = value;
+ } catch (e) {}
+ }
+ else {
+ comp[name] = value;
+ }
+ }
+
+ if (typeof comp.setDocument === 'function') {
+ comp.setDocument(document, id);
+ }
+ }
+
+ return comp;
+};
+
+
+/**
+ * @expose
+ * @param {Object} document The MXML object.
+ * @param {Object} parent The parent object.
+ * @param {Array} data The data array.
+ * @return {Array} The generated array.
+ */
+org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray =
+ function(document, parent, data) {
+ var comps = [];
+
+ var n = data.length;
+ var i = 0;
+ while (i < n) {
+ var cls = data[i++];
+ var comp = new cls();
+
+ i = org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject(document, parent, comp, data, i);
+
+ comps.push(comp);
+ }
+ return comps;
+};
+
+
+/**
+ * @expose
+ * @param {Object} document The MXML object.
+ * @param {Object} parent The parent object.
+ * @param {Object} comp The component being initialized.
+ * @param {Array} data The data array.
+ * @param {number} i The offset into data.
+ * @return {number} The new offset into the data.
+ */
+org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject =
+ function(document, parent, comp, data, i) {
+ var bead, beadOffset, beads, children, Cls, generateMXMLArray,
+ generateMXMLObject, id, j, k, l, m, n, name, self, simple, value, dispatchBeadsAdded;
+
+ generateMXMLArray =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray;
+ generateMXMLObject =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject;
+
+ id = null;
+
+ m = data[i++]; // num props
+ if (m > 0 && data[0] === 'model') {
+ m--;
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(document, parent, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(document, value);
+ }
+
+ comp[name] = value;
+ }
+
+ beadOffset = i + (m - 1) * 3;
+ if (m > 0 && data[beadOffset] === 'beads') {
+ m--;
+ } else {
+ beadOffset = -1;
+ }
+
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(document, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(document, value);
+ }
+
+ if (name === 'id') {
+ id = value;
+ document[value] = comp;
+ }
+
+ if (name === 'document' && !comp.document) {
+ comp.document = document;
+ } else if (name === '_id') {
+ id = value; // and don't assign to comp
+ } else if (name === 'id') {
+ try {
+ comp.id = value;
+ } catch (e) {}
+ } else {
+ comp[name] = value;
+ }
+ }
+
+ if (beadOffset > -1)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(document, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(document, value);
+ }
+ comp[name] = value;
+ }
+
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(document, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(document, value);
+ }
+
+ if (comp.setStyle) {
+ comp.setStyle(name, value);
+ }
+ }
+
+ /*
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple === null)
+ value = generateMXMLArray(document, null, value, opt_recursive);
+ else if (simple === false)
+ value = generateMXMLObject(document, value);
+ comp.setStyle(name, value);
+ }
+ */
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ value = data[i++];
+
+ comp.addEventListener(name, goog.bind(value, document));
+ }
+
+ children = data[i++];
+ if (children && comp['setMXMLDescriptor']) {
+ comp['setMXMLDescriptor'](document, children);
+ }
+ if (parent && org_apache_flex_utils_Language.is(comp,
+ org_apache_flex_core_IUIBase)) {
+ parent.addElement(comp);
+ }
+
+ if (children) {
+ if (!comp['setMXMLDescriptor']) {
+ self = org_apache_flex_utils_MXMLDataInterpreter;
+ self.generateMXMLInstances(
+ document, comp, children);
+ if (typeof comp.childrenAdded === 'function')
+ comp.childrenAdded();
+ }
+ }
+
+ if (id) {
+ document[id] = comp;
+ }
+
+ if (typeof(comp.setDocument) === 'function') {
+ comp.setDocument(document, id);
+ }
+
+ if (goog.isFunction(comp.finalizeElement)) {
+ comp.finalizeElement();
+ }
+
+ return i;
+};
+
+
+/**
+ * @expose
+ * @param {Object} document The MXML object.
+ * @param {Object} parent The parent object.
+ * @param {Array} data The data array.
+ */
+org_apache_flex_utils_MXMLDataInterpreter.generateMXMLInstances =
+ function(document, parent, data) {
+ if (data) {
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray(
+ document, parent, data);
+ }
+};
+
+
+/**
+ * @expose
+ * @param {Object} host The MXML object.
+ * @param {Array} data The data array.
+ */
+org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties =
+ function(host, data) {
+ var bead, beadOffset, beads, generateMXMLArray, generateMXMLObject, i, id, j,
+ k, l, m, name, simple, value;
+
+ if (!data) {
+ return;
+ }
+
+ i = 0;
+ id = null;
+
+ generateMXMLArray =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLArray;
+ generateMXMLObject =
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject;
+
+ m = data[i++]; // num props
+ beadOffset = i + (m - 1) * 3;
+ if (m > 0 && data[beadOffset] === 'beads') {
+ m--;
+ } else {
+ beadOffset = -1;
+ }
+
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(host, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(host, value);
+ }
+
+ if (name === 'id') {
+ id = value;
+ }
+
+ if (name === '_id') {
+ id = value; // and don't assign
+ } else {
+ host[name] = value;
+ }
+ }
+
+ if (beadOffset > -1) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(host, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(host, value);
+ }
+
+ beads = value;
+ l = beads.length;
+ for (k = 0; k < l; k++) {
+ bead = beads[k];
+ host.addBead(bead);
+ }
+ }
+
+ m = data[i++]; // num styles
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+
+ if (simple === null) {
+ value = generateMXMLArray(host, null, value);
+ } else if (simple === false) {
+ value = generateMXMLObject(host, value);
+ }
+
+ host[name] = value;
+ }
+
+ /*
+ m = data[i++]; // num effects
+ for (j = 0; j < m; j++)
+ {
+ name = data[i++];
+ simple = data[i++];
+ value = data[i++];
+ if (simple === null)
+ value = generateMXMLArray(host, null, value, false);
+ else if (simple === false)
+ value = generateMXMLObject(host, value);
+ host[name] = value;
+ }
+ */
+
+ m = data[i++]; // num events
+ for (j = 0; j < m; j++) {
+ name = data[i++];
+ value = data[i++];
+ host.addEventListener(name, goog.bind(value, host));
+ }
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/MixinManager.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/MixinManager.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/MixinManager.js
new file mode 100644
index 0000000..6579489
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/MixinManager.js
@@ -0,0 +1,60 @@
+/**
+ * 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_MixinManager');
+
+
+
+/**
+ * @constructor
+ * @implements {org_apache_flex_core_IBead}
+ * Initialize mixins.
+ * Compiler may not be generating list of mixins right now.
+ */
+org_apache_flex_utils_MixinManager = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_MixinManager.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'MixinManager',
+ qName: 'org_apache_flex_utils_MixinManager'}],
+ interfaces: [org_apache_flex_core_IBead]};
+
+
+Object.defineProperties(org_apache_flex_utils_MixinManager.prototype, {
+ /** @expose */
+ strand: {
+ /** @this {org_apache_flex_utils_MixinManager} */
+ set: function(value) {
+ this.strand_ = value;
+
+ if (value) {
+ if (typeof(value.info) == 'function') {
+ var mixins = value.info()['mixins'];
+ if (mixins) {
+ var n = mixins.length;
+ for (var i = 0; i < n; i++) {
+ mixins[i].init(value);
+ }
+ }
+ }
+ }
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/PointUtils.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/PointUtils.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/PointUtils.js
new file mode 100644
index 0000000..f42aae7
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/PointUtils.js
@@ -0,0 +1,87 @@
+/**
+ * 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_PointUtils');
+
+goog.require('org_apache_flex_geom_Point');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_utils_PointUtils = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_PointUtils.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'PointUtils',
+ qName: 'org_apache_flex_utils_PointUtils' }] };
+
+
+/**
+ * @expose
+ * @param {org_apache_flex_geom_Point} point The Point to be converted.
+ * @param {Object} local The object used as reference.
+ * @return {org_apache_flex_geom_Point} The converted Point.
+ */
+org_apache_flex_utils_PointUtils.globalToLocal =
+ function(point, local) {
+ var x = point.x, y = point.y;
+ var element = local.element;
+
+ do {
+ x -= element.offsetLeft;
+ y -= element.offsetTop;
+ if (local.hasOwnProperty('parent')) {
+ local = local.parent;
+ element = local.element;
+ } else {
+ element = null;
+ }
+ }
+ while (element);
+ return new org_apache_flex_geom_Point(x, y);
+};
+
+
+/**
+ * @expose
+ * @param {org_apache_flex_geom_Point} point The Point to be converted.
+ * @param {Object} local The object used as reference.
+ * @return {org_apache_flex_geom_Point} The converted Point.
+ */
+org_apache_flex_utils_PointUtils.localToGlobal =
+ function(point, local) {
+ var x = point.x, y = point.y;
+ var element = local.element;
+
+ do {
+ x += element.offsetLeft;
+ y += element.offsetTop;
+ if (local.hasOwnProperty('parent')) {
+ local = local.parent;
+ element = local.element;
+ } else {
+ element = null;
+ }
+ }
+ while (element);
+ return new org_apache_flex_geom_Point(x, y);
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/Timer.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/Timer.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/Timer.js
new file mode 100644
index 0000000..5dcda3d
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/Timer.js
@@ -0,0 +1,147 @@
+/**
+ * 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_Timer');
+
+goog.require('org_apache_flex_events_EventDispatcher');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_events_EventDispatcher}
+ * @param {number} delay The delay.
+ * @param {number=} opt_repeatCount The repeatCount.
+ */
+org_apache_flex_utils_Timer = function(delay, opt_repeatCount) {
+ org_apache_flex_utils_Timer.base(this, 'constructor');
+
+ if (opt_repeatCount !== undefined) {
+ this._repeatCount = opt_repeatCount;
+ }
+
+ /**
+ * @protected
+ * @type {number}
+ */
+ this.timerInterval = -1;
+
+ /**
+ * @protected
+ * @type {number}
+ */
+ this._delay = delay;
+
+ /**
+ * @protected
+ * @type {number}
+ */
+ this._currentCount = 0;
+};
+goog.inherits(org_apache_flex_utils_Timer,
+ org_apache_flex_events_EventDispatcher);
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_Timer.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'Timer',
+ qName: 'org_apache_flex_utils_Timer'}] };
+
+
+/**
+ * @expose
+ * Stops the timer and sets currentCount = 0.
+ */
+org_apache_flex_utils_Timer.prototype.reset = function() {
+ this.stop();
+ this._currentCount = 0;
+};
+
+
+/**
+ * @expose
+ * Stops the timer.
+ */
+org_apache_flex_utils_Timer.prototype.stop = function() {
+ clearInterval(this.timerInterval);
+ this.timerInterval = -1;
+};
+
+
+/**
+ * @expose
+ * Starts the timer.
+ */
+org_apache_flex_utils_Timer.prototype.start = function() {
+ this.timerInterval =
+ setInterval(goog.bind(this.timerHandler, this), this._delay);
+};
+
+
+/**
+ * @protected
+ */
+org_apache_flex_utils_Timer.prototype.timerHandler =
+ function() {
+ this._currentCount++;
+ if (this._repeatCount > 0 && this._currentCount >= this._repeatCount) {
+ this.stop();
+ }
+
+ this.dispatchEvent(new org_apache_flex_events_Event('timer'));
+
+};
+
+Object.defineProperties(org_apache_flex_utils_Timer.prototype, {
+ /** @expose */
+ currentCount: {
+ /** @this {org_apache_flex_utils_Timer} */
+ get: function() {
+ return this._currentCount;
+ }
+ },
+ /** @expose */
+ running: {
+ /** @this {org_apache_flex_utils_Timer} */
+ get: function() {
+ return this.timerInterval !== -1;
+ }
+ },
+ /** @expose */
+ delay: {
+ /** @this {org_apache_flex_utils_Timer} */
+ get: function() {
+ return this._delay;
+ },
+ /** @this {org_apache_flex_utils_Timer} */
+ set: function(value) {
+ this._delay = value;
+ }
+ },
+ /** @expose */
+ repeatCount: {
+ /** @this {org_apache_flex_utils_Timer} */
+ get: function() {
+ return this._repeatCount;
+ },
+ /** @this {org_apache_flex_utils_Timer} */
+ set: function(value) {
+ this._repeatCount = value;
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/UIUtils.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/UIUtils.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/UIUtils.js
new file mode 100644
index 0000000..fe1eaaa
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/UIUtils.js
@@ -0,0 +1,84 @@
+/**
+ * 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_UIUtils');
+
+goog.require('org_apache_flex_core_IPopUpHost');
+goog.require('org_apache_flex_utils_Language');
+
+
+
+/**
+ * @constructor
+ */
+org_apache_flex_utils_UIUtils = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_UIUtils.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'UIUtils',
+ qName: 'org_apache_flex_utils_UIUtils' }] };
+
+
+/**
+ * @expose
+ * @param {Object} item The item to be centered.
+ * @param {Object} relativeTo The object used as reference.
+ */
+org_apache_flex_utils_UIUtils.center =
+ function(item, relativeTo) {
+
+ var rw = relativeTo.width;
+ if (isNaN(rw)) rw = window.innerWidth;
+ var rh = relativeTo.height;
+ if (isNaN(rh)) rh = window.innerHeight;
+
+ var xpos = (rw - item.width) / 2;
+ var ypos = (rh - item.height) / 2;
+ item.x = xpos;
+ item.y = ypos;
+};
+
+
+/**
+ * @expose
+ * @param {Object} start A component to start the search.
+ * @return {Object} A component that implements IPopUpHost.
+ */
+org_apache_flex_utils_UIUtils.findPopUpHost =
+ function(start) {
+
+ while (start != null && !org_apache_flex_utils_Language.is(start, org_apache_flex_core_IPopUpHost)) {
+ start = start.parent;
+ }
+
+ return start;
+};
+
+
+/**
+ * @expose
+ * @param {Object} popUp An IPopUpHost component looking to be removed.
+ */
+org_apache_flex_utils_UIUtils.removePopUp =
+ function(popUp) {
+
+ var p = popUp.parent;
+ p.removeElement(popUp);
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/Core/js/src/org/apache/flex/utils/ViewSourceContextMenuOption.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/utils/ViewSourceContextMenuOption.js b/frameworks/projects/Core/js/src/org/apache/flex/utils/ViewSourceContextMenuOption.js
new file mode 100644
index 0000000..5dae11a
--- /dev/null
+++ b/frameworks/projects/Core/js/src/org/apache/flex/utils/ViewSourceContextMenuOption.js
@@ -0,0 +1,47 @@
+/**
+ * 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_ViewSourceContextMenuOption');
+
+goog.require('org_apache_flex_events_EventDispatcher');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_events_EventDispatcher}
+ */
+org_apache_flex_utils_ViewSourceContextMenuOption = function() {
+ // no implementation in JS since ViewSource is already in menu
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org_apache_flex_utils_ViewSourceContextMenuOption.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ViewSourceContextMenuOption',
+ qName: 'org_apache_flex_utils_ViewSourceContextMenuOption'}] };
+
+
+Object.defineProperties(org_apache_flex_utils_ViewSourceContextMenuOption.prototype, {
+ /** @expose */
+ strand: {
+ /** @this {org_apache_flex_utils_ViewSourceContextMenuOption} */
+ set: function(value) {}
+ }
+});
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/CreateJS/js/src/createjs_externals.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/js/src/createjs_externals.js b/frameworks/projects/CreateJS/js/src/createjs_externals.js
new file mode 100644
index 0000000..7daaff1
--- /dev/null
+++ b/frameworks/projects/CreateJS/js/src/createjs_externals.js
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+
+/**
+ * This file is used to establish external APIs so the closure-compiler
+ * can resolve references and won't minify names
+ */
+function createjs() {}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/Application.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/Application.js b/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/Application.js
new file mode 100644
index 0000000..82ffdcc
--- /dev/null
+++ b/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/Application.js
@@ -0,0 +1,121 @@
+/**
+ * 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.
+ */
+
+// ------------------------------------------------------------------
+// createjs
+// ------------------------------------------------------------------
+
+// Bring in the createjs sources. You can use the minified versions for
+// better performance.
+//var mainjs = document.createElement('script');
+//mainjs.src = './createjs/easeljs-0.6.0.min.js';
+//document.head.appendChild(mainjs);
+
+// ------------------------------------------------------------------
+// end createjs
+// ------------------------------------------------------------------
+
+goog.provide('org_apache_flex_createjs_Application');
+
+goog.require('org_apache_flex_core_HTMLElementWrapper');
+goog.require('org_apache_flex_utils_MXMLDataInterpreter');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_core_HTMLElementWrapper}
+ */
+org_apache_flex_createjs_Application = function() {
+ org_apache_flex_createjs_Application.base(this, 'constructor');
+};
+goog.inherits(org_apache_flex_createjs_Application,
+ org_apache_flex_core_HTMLElementWrapper);
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org_apache_flex_createjs_Application.prototype.controller = null;
+
+
+/**
+ * @expose
+ * @type {org_apache_flex_createjs_core_ViewBase}
+ */
+org_apache_flex_createjs_Application.prototype.initialView = null;
+
+
+/**
+ * @expose
+ * @type {createjs.Stage}
+ */
+org_apache_flex_createjs_Application.prototype.stage = null;
+
+
+/**
+ * @expose
+ * @type {org_apache_flex_events_EventDispatcher}
+ */
+org_apache_flex_createjs_Application.prototype.model = null;
+
+
+/**
+ * @expose
+ * @type {org_apache_flex_core_SimpleValuesImpl}
+ */
+org_apache_flex_createjs_Application.prototype.valuesImpl = null;
+
+
+/**
+ * @expose
+ */
+org_apache_flex_createjs_Application.prototype.start = function() {
+ var body;
+
+ // For createjs, the application is the same as the canvas
+ // and it provides convenient access to the stage.
+
+ this.element = document.createElement('canvas');
+ this.element.id = 'flexjsCanvas';
+ this.element.width = 700;
+ this.element.height = 500;
+
+ body = document.getElementsByTagName('body')[0];
+ body.appendChild(this.element);
+
+ this.stage = new createjs.Stage('flexjsCanvas');
+
+ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties(this,
+ this.MXMLProperties);
+
+ this.dispatchEvent('initialize');
+
+ this.initialView.applicationModel = this.model;
+ this.addElement(this.initialView);
+
+ this.dispatchEvent('viewChanged');
+};
+
+
+/**
+ * @param {Object} c The child element.
+ */
+org_apache_flex_createjs_core_Application.prototype.addElement =
+ function(c) {
+ this.stage.addChild(c.element);
+ c.addedToParent();
+};
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b677c658/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/CheckBox.js b/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/CheckBox.js
new file mode 100644
index 0000000..06c89a8
--- /dev/null
+++ b/frameworks/projects/CreateJS/js/src/org/apache/flex/createjs/CheckBox.js
@@ -0,0 +1,130 @@
+/**
+ * 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_createjs_CheckBox');
+
+goog.require('org_apache_flex_createjs_core_UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org_apache_flex_createjs_core_UIBase}
+ */
+org_apache_flex_createjs_CheckBox = function() {
+ org_apache_flex_createjs_CheckBox.base(this, 'constructor');
+};
+goog.inherits(org_apache_flex_createjs_CheckBox,
+ org_apache_flex_createjs_core_UIBase);
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org_apache_flex_createjs_CheckBox.prototype.checkMark = null;
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org_apache_flex_createjs_CheckBox.prototype.checkMarkBackground =
+ null;
+
+
+/**
+ * @expose
+ * @type {Object}
+ */
+org_apache_flex_createjs_CheckBox.prototype.checkBoxLabel = null;
+
+
+/**
+ * @override
+ */
+org_apache_flex_createjs_CheckBox.prototype.createElement =
+ function() {
+ this.checkMarkBackground = new createjs.Shape();
+ this.checkMarkBackground.name = 'checkmarkbackground';
+ this.checkMarkBackground.graphics.beginFill('red').
+ drawRoundRect(0, 0, 40, 40, 8);
+ //this.checkMarkBackground.graphics.setStrokeStyle( 0 ).beginStroke('#000').
+ // drawRect( 0, 0, this.width, this.height);
+ //var hit = new createjs.Shape();
+ //hit.graphics.beginFill("#000").drawRect(0, 0, this.width, this.height);
+ //this.checkMarkBackground.hitArea = hit;
+
+ this.checkMark = new createjs.Shape();
+ this.checkMark.name = 'checkmark';
+ this.checkMark.graphics.beginFill('white').drawRoundRect(0, 0, 32, 32, 6);
+ this.checkMark.x = 4;
+ this.checkMark.y = 4;
+ this.checkMark.visible = this.selected;
+
+ this.checkBoxLabel = new createjs.Text('checkbox', '20px Arial', '#ff7700');
+ this.checkBoxLabel.name = 'label';
+ this.checkBoxLabel.textAlign = 'left';
+ this.checkBoxLabel.textBaseline = 'middle';
+ this.checkBoxLabel.x = 45;
+ this.checkBoxLabel.y = 40 / 2;
+
+ this.element = new createjs.Container();
+ this.element.name = 'checkbox';
+ this.element.addChild(this.checkMarkBackground, this.checkBoxLabel,
+ this.checkMark);
+ // use bind(this) to avoid loose scope
+ this.element.onClick = this.clickHandler.bind(this);
+
+ this.positioner = this.element;
+
+ return this.element;
+};
+
+
+Object.defineProperties(org_apache_flex_createjs_CheckBox.prototype, {
+ /** @expose */
+ text: {
+ /** @this {org_apache_flex_createjs_CheckBox} */
+ get: function() {
+ return this.checkBoxLabel.text;
+ },
+ /** @this {org_apache_flex_createjs_CheckBox} */
+ set: function(value) {
+ this.checkBoxLabel.text = value;
+ }
+ },
+ /** @expose */
+ selected: {
+ /** @this {org_apache_flex_createjs_CheckBox} */
+ get: function() {
+ return this.selected;
+ },
+ /** @this {org_apache_flex_createjs_CheckBox} */
+ set: function(value) {
+ this.checkMark.visible = this.selected = value;
+ this.element.getStage().update();
+ }
+ }
+});
+
+
+/**
+ * @expose
+ * @param {string|Object|goog.events.Event} event The event.
+ */
+org_apache_flex_createjs_CheckBox.prototype.clickHandler =
+ function(event) {
+ this.selected = !this.selected;
+};