You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/03/18 21:09:35 UTC
git commit: [flex-asjs] [refs/heads/develop] - Improved JavaScript
side of FlexJS with better handling for MXML component files based on
Container. Added get_currentTarget() to Event.js.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 6684cf7da -> 2d0d52a97
Improved JavaScript side of FlexJS with better handling for MXML component files based on Container. Added get_currentTarget() to Event.js.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2d0d52a9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2d0d52a9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2d0d52a9
Branch: refs/heads/develop
Commit: 2d0d52a97d2ae188a705e963420cc8cabb3df50b
Parents: 6684cf7
Author: Peter Ent <pe...@apache.org>
Authored: Tue Mar 18 16:09:21 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Tue Mar 18 16:09:21 2014 -0400
----------------------------------------------------------------------
.../src/org/apache/flex/core/ContainerBase.js | 100 +++++++++++++++++++
.../FlexJS/src/org/apache/flex/events/Event.js | 9 ++
.../flex/html/staticControls/Container.js | 6 +-
.../apache/flex/html/staticControls/Panel.js | 2 +-
.../FlexJS/src/org/apache/flex/utils/UIUtils.js | 48 +++++++++
5 files changed, 161 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d0d52a9/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js
new file mode 100644
index 0000000..1b41fd0
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js
@@ -0,0 +1,100 @@
+/**
+ * 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.core.ContainerBase');
+
+goog.require('org.apache.flex.core.UIBase');
+
+
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.core.UIBase}
+ */
+org.apache.flex.core.ContainerBase = function() {
+ this.mxmlProperties = null;
+ goog.base(this);
+};
+goog.inherits(org.apache.flex.core.ContainerBase,
+ org.apache.flex.core.UIBase);
+
+
+/**
+ * @expose
+ */
+org.apache.flex.core.ContainerBase.prototype.mxmlContent = null;
+
+
+/**
+ * @expose
+ * @type {Array}
+ */
+org.apache.flex.core.ContainerBase.prototype.mxmlProperties = null;
+
+
+/**
+ * @expose
+ * @type {Array}
+ */
+org.apache.flex.core.ContainerBase.prototype.mxmlDescriptor = null;
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.ContainerBase.prototype.FLEXJS_CLASS_INFO =
+ { names: [{ name: 'ContainerBase',
+ qName: 'org.apache.flex.core.ContainerBase'}] };
+
+
+/**
+ * @override
+ */
+org.apache.flex.core.ContainerBase.prototype.addedToParent = function() {
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLProperties(this, this.get_MXMLProperties());
+ goog.base(this, 'addedToParent');
+ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this, this, this.get_MXMLDescriptor());
+
+ this.dispatchEvent('initComplete');
+ this.dispatchEvent('childrenAdded');
+};
+
+
+/**
+ * @expose
+ * @return {Array} An array of properties.
+ */
+org.apache.flex.core.ContainerBase.prototype.get_MXMLProperties = function() {
+ return this.mxmlProperties;
+};
+
+
+/**
+ * @expose
+ * @return {Array} An array of descriptors.
+ */
+org.apache.flex.core.ContainerBase.prototype.get_MXMLDescriptor = function() {
+ return this.mxmlDescriptor;
+};
+
+
+/**
+ * @expose
+ * @param {Array} data Property name/value pairs for this instance.
+ */
+org.apache.flex.core.ContainerBase.prototype.generateMXMLAttributes = function(data) {
+ this.mxmlProperties = data;
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d0d52a9/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
index f530106..cc54395 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
@@ -74,3 +74,12 @@ org.apache.flex.events.Event.prototype.init = function(type) {
org.apache.flex.events.Event.prototype.get_target = function() {
return this.target;
};
+
+
+/**
+ * @expose
+ * @return {Object|undefined} The event currentTarget.
+ */
+org.apache.flex.events.Event.prototype.get_currentTarget = function() {
+ return this.currentTarget;
+};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d0d52a9/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Container.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Container.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Container.js
index b2edc29..22a3840 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Container.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Container.js
@@ -14,19 +14,19 @@
goog.provide('org.apache.flex.html.staticControls.Container');
-goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.core.ContainerBase');
/**
* @constructor
- * @extends {org.apache.flex.core.UIBase}
+ * @extends {org.apache.flex.core.ContainerBase}
*/
org.apache.flex.html.staticControls.Container = function() {
goog.base(this);
};
goog.inherits(org.apache.flex.html.staticControls.Container,
- org.apache.flex.core.UIBase);
+ org.apache.flex.core.ContainerBase);
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d0d52a9/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
index 40bf262..a5af58b 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Panel.js
@@ -137,7 +137,7 @@ org.apache.flex.html.staticControls.Panel.prototype.createElement =
*/
org.apache.flex.html.staticControls.Panel.prototype.addedToParent =
function() {
-
+ goog.base(this, 'addedToParent');
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d0d52a9/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.js
new file mode 100644
index 0000000..edf18bc
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.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.UIUtils');
+
+
+
+/**
+ * @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 xpos = (relativeTo.get_width() - item.get_width()) / 2;
+ var ypos = (relativeTo.get_height() - item.get_height()) / 2;
+ item.set_x(xpos);
+ item.set_y(ypos);
+};