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 2014/12/09 06:16:52 UTC

[05/31] git commit: [flex-asjs] [refs/heads/develop] - MXML containers are their own document

MXML containers are their own document


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f5c4df7a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f5c4df7a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f5c4df7a

Branch: refs/heads/develop
Commit: f5c4df7a7f760c6eec46a7cbeeef8afd86b6a300
Parents: 3dec3b0
Author: Alex Harui <ah...@apache.org>
Authored: Fri Nov 21 16:43:43 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Dec 8 20:47:40 2014 -0800

----------------------------------------------------------------------
 .../src/org/apache/flex/core/ContainerBase.js   | 36 +++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f5c4df7a/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
index 50212ac..eed7204 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ContainerBase.js
@@ -25,6 +25,15 @@ goog.require('org.apache.flex.core.UIBase');
 org.apache.flex.core.ContainerBase = function() {
   this.mxmlProperties = null;
   org.apache.flex.core.ContainerBase.base(this, 'constructor');
+
+  /**
+   * @private
+   * @type {boolean}
+   */
+  this.initialized_ = false;
+  
+  this.document = this;
+
 };
 goog.inherits(org.apache.flex.core.ContainerBase,
     org.apache.flex.core.UIBase);
@@ -65,10 +74,15 @@ org.apache.flex.core.ContainerBase.prototype.FLEXJS_CLASS_INFO =
  */
 org.apache.flex.core.ContainerBase.prototype.addedToParent = function() {
   org.apache.flex.core.ContainerBase.base(this, 'addedToParent');
-  org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this, this, this.get_MXMLDescriptor());
-
-  this.dispatchEvent('initBindings');
-  this.dispatchEvent('initComplete');
+  
+  if (!this.initialized_) {
+    org.apache.flex.utils.MXMLDataInterpreter.generateMXMLInstances(this.document,
+	    this, this.get_MXMLDescriptor());
+
+    this.dispatchEvent('initBindings');
+    this.dispatchEvent('initComplete');
+	this.initialized_ = true;
+  }
   this.dispatchEvent('childrenAdded');
 };
 
@@ -89,3 +103,17 @@ org.apache.flex.core.ContainerBase.prototype.generateMXMLAttributes = function(d
 org.apache.flex.core.ContainerBase.prototype.get_MXMLDescriptor = function() {
   return this.mxmlDescriptor;
 };
+
+
+/**
+ * @expose
+ * @param {Object} doc The document.
+ * @param {Array} desc The descriptor data;
+ */
+org.apache.flex.core.ContainerBase.prototype.setMXMLDescriptor =
+    function(doc, desc) {
+  this.mxmlDescriptor = desc;
+  this.document = doc;
+}
+
+