Repository: flex-asjs
Updated Branches:
  refs/heads/develop 2d0d52a97 -> 02420b9a3


Changes to the SDK, mostly on the JavaScript side, to connect display parent 
chain using get_parent(). Included changes to enable pop-ups via UIUtils class. 
Added format bead support to JavaScript side of SDK.


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

Branch: refs/heads/develop
Commit: 02420b9a37e27ea79f9264f78f309651c14333f5
Parents: 2d0d52a
Author: Peter Ent <[email protected]>
Authored: Wed Mar 19 17:09:35 2014 -0400
Committer: Peter Ent <[email protected]>
Committed: Wed Mar 19 17:09:35 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/flex/core/PopUpManager.as    | 94 --------------------
 .../apache/flex/utils/MXMLDataInterpreter.as    |  6 +-
 .../src/org/apache/flex/utils/UIUtils.as        | 43 +++++++++
 .../src/org/apache/flex/core/IFormatBead.js     | 71 +++++++++++++++
 .../FlexJS/src/org/apache/flex/core/IParent.js  | 67 ++++++++++++++
 .../src/org/apache/flex/core/IPopUpHost.js      | 43 +++++++++
 .../FlexJS/src/org/apache/flex/core/ListBase.js |  1 +
 .../FlexJS/src/org/apache/flex/core/UIBase.js   | 12 +++
 .../FlexJS/src/org/apache/flex/core/ViewBase.js |  6 +-
 .../apache/flex/html/staticControls/Label.js    |  1 +
 .../apache/flex/html/staticControls/Panel.js    |  1 +
 .../supportClasses/NonVirtualDataGroup.js       |  8 +-
 .../apache/flex/utils/MXMLDataInterpreter.js    |  9 +-
 .../FlexJS/src/org/apache/flex/utils/UIUtils.js | 40 ++++++++-
 14 files changed, 299 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/PopUpManager.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/PopUpManager.as 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/PopUpManager.as
deleted file mode 100644
index ad24f41..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/PopUpManager.as
+++ /dev/null
@@ -1,94 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
-    import flash.display.DisplayObject;
-    import flash.display.DisplayObjectContainer;
-    import flash.events.Event;
-
-    /**
-     *  The PopUpManager ensures that children that implement the
-     *  IPopUp interface are layered over the other children.  Unlike
-     *  the Flex SDK, where the PopUpManager had APIs that you had to
-     *  use to add popups to the display list, this PopUpManager
-     *  monitors the children in a container.  It assumes that no
-     *  other container will obscure the container it is monitoring.
-     *  A more sophisticated PopUpManager could handle such a 
-     *  scenario, but most folks don't have overlapping top-level
-     *  "windows" in their user interfaces any more so a simpler
-     *  implementation will suffice for most applications.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-       public class PopUpManager implements IDocument
-       {
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function PopUpManager()
-               {
-               }
-
-        private var document:DisplayObjectContainer;
-        
-        /**
-         *  @copy org.apache.flex.core.IDocument#setDocument()
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function setDocument(document:Object, id:String = null):void
-        {
-            this.document = document as DisplayObjectContainer;
-            this.document.addEventListener(Event.ADDED, addedHandler);
-        }
-        
-        private function addedHandler(event:Event):void
-        {
-            if (event.target != document)
-                return;
-
-            var n:int = document.numChildren;
-            var lastPopUp:int = n - 1;
-            
-            for (var i:int = n - 1; i >= 0; i--)
-            {
-                var child:DisplayObject = document.getChildAt(n);
-                if (child is IPopUp)
-                {
-                    if (i < lastPopUp)
-                    {
-                        document.setChildIndex(child, lastPopUp);
-                        lastPopUp--;
-                    }
-                }
-            }
-        }
-       }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
index 577690d..ec96f89 100644
--- 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
+++ 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as
@@ -365,9 +365,9 @@ public class MXMLDataInterpreter
                 bead.strand = host as IStrand;
             }
                        
-                       if (l>0) {
-                               IEventDispatcher(host).dispatchEvent(new 
Event("beadsAdded"));
-                       }
+//                     if (l>0) {
+//                             IEventDispatcher(host).dispatchEvent(new 
Event("beadsAdded"));
+//                     }
         }
         m = data[i++]; // num styles
         for (j = 0; j < m; j++)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
index a812b60..e05e2b6 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
@@ -18,6 +18,7 @@
 
////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.utils
 {
+       import org.apache.flex.core.IPopUpHost;
        import org.apache.flex.core.UIBase;
 
        /**
@@ -42,6 +43,9 @@ package org.apache.flex.utils
                /**
                 *  Centers the given item relative to another item. Typically 
the item being centered is
                 *  a child or sibling of the second item. 
+                * 
+                *  @param item The component item being centered.
+                *  @param relativeTo The component used as reference for the 
centering.
                 *  
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
@@ -56,5 +60,44 @@ package org.apache.flex.utils
                        item.x = xpos;
                        item.y = ypos;
                }
+               
+               /**
+                *  Given a component starting point, this function walks up 
the parent chain
+                *  looking for a component that implements the IPopUpHost 
interface. The function
+                *  either returns that component or null if no IPopUpHost can 
be found. 
+                * 
+                *  @param start A component to start the search.
+                *  @return A component that implements IPopUpHost or null.
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public static function findPopUpHost(start:UIBase):IPopUpHost
+               {
+                       while( start != null && !(start is IPopUpHost) ) {
+                               start = start.parent as UIBase;
+                       }
+                       
+                       return start as IPopUpHost;
+               }
+               
+               /**
+                *  Removes the given component from the IPopUpHost. 
+                * 
+                *  @param start A component to start the search.
+                *  @return A component that implements IPopUpHost or null.
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public static function removePopUp(popUp:UIBase):void
+               {
+                       var host:IPopUpHost = popUp.parent as IPopUpHost;
+                       host.removeElement(popUp);
+               }
        }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/IFormatBead.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IFormatBead.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/IFormatBead.js
new file mode 100644
index 0000000..a7daf3c
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/IFormatBead.js
@@ -0,0 +1,71 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @fileoverview
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.IFormatBead');
+
+
+
+/**
+ * @interface
+ * @extends {org.apache.flex.core.IBead}
+ * @extends {org.apache.flex.events.IEventDispatcher}
+ */
+org.apache.flex.core.IFormatBead = function() {
+};
+
+
+/**
+ * @return {string}
+ */
+org.apache.flex.core.IFormatBead.prototype.get_propertyName = function() {};
+
+
+/**
+ * @param {string} value
+ */
+org.apache.flex.core.IFormatBead.prototype.set_propertyName = function(value) 
{};
+
+
+/**
+ * @return {string}
+ */
+org.apache.flex.core.IFormatBead.prototype.get_eventName = function() {};
+
+
+/**
+ * @param {string} value
+ */
+org.apache.flex.core.IFormatBead.prototype.set_eventName = function(value) {};
+
+
+/**
+ * @return {string}
+ */
+org.apache.flex.core.IFormatBead.prototype.get_formattedString = function() {};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.IFormatBead.prototype.FLEXJS_CLASS_INFO = {
+    names: [{ name: 'IFormatBead', qName: 'org.apache.flex.core.IFormatBead'}],
+    interfaces: [org.apache.flex.core.IBead, 
org.apache.flex.events.IEventDispatcher]
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/IParent.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IParent.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/IParent.js
new file mode 100644
index 0000000..1ff763a
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/IParent.js
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+/**
+ * org.apache.flex.core.IParent
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.IParent');
+
+
+
+/**
+ * @interface
+ */
+org.apache.flex.core.IParent = function() {
+};
+
+
+/**
+ * @param {Object} c
+ */
+org.apache.flex.core.IParent.prototype.addElement = function(c) {};
+
+
+/**
+ * @param {Object} c
+ * @param {number} index
+ */
+org.apache.flex.core.IParent.prototype.addElementAt = function(c, index) {};
+
+
+/**
+ * @return {number}
+ * @param {Object} c
+ */
+org.apache.flex.core.IParent.prototype.getElementIndex = function(c) {};
+
+
+/**
+ * @param {Object} c
+ */
+org.apache.flex.core.IParent.prototype.removeElement = function(c) {};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.IParent.prototype.FLEXJS_CLASS_INFO = {
+    names: [{ name: 'IParent', qName: 'org.apache.flex.core.IParent'}]
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/IPopUpHost.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IPopUpHost.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/IPopUpHost.js
new file mode 100644
index 0000000..9d2d502
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/IPopUpHost.js
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+/**
+ * org.apache.flex.core.IPopUpHost
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('org.apache.flex.core.IPopUpHost');
+
+
+
+/**
+ * @interface
+ * @extends {org.apache.flex.core.IParent}
+ */
+org.apache.flex.core.IPopUpHost = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.IPopUpHost.prototype.FLEXJS_CLASS_INFO = {
+    names: [{ name: 'IPopUpHost', qName: 'org.apache.flex.core.IPopUpHost'}],
+    interfaces: [org.apache.flex.core.IParent]
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
index 13030fd..fe315ca 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ListBase.js
@@ -65,6 +65,7 @@ org.apache.flex.core.ListBase.prototype.createElement = 
function() {
   this.element.style.borderWidth = '1px';
   this.element.style.borderColor = '#333333';
   this.positioner = this.element;
+  this.element.flexjs_wrapper = this;
 
   return this.element;
 };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
index d331fe2..35681fd 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
@@ -78,6 +78,8 @@ org.apache.flex.core.UIBase.prototype.createElement = 
function() {
   if (this.positioner == null)
     this.positioner = this.element;
 
+  this.element['flexjs_wrapper'] = this;
+
   return this.element;
 };
 
@@ -140,6 +142,16 @@ org.apache.flex.core.UIBase.prototype.removeElement = 
function(c) {
 
 
 /**
+ * @return {Object} The parent of this object.
+ */
+org.apache.flex.core.UIBase.prototype.get_parent = function() {
+  var p = this.element.parentNode;
+  var wrapper = p['flexjs_wrapper'];
+  return wrapper;
+};
+
+
+/**
  */
 org.apache.flex.core.UIBase.prototype.addedToParent = function() {
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js 
b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
index f1ac3b0..5e47265 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBase.js
@@ -14,6 +14,7 @@
 
 goog.provide('org.apache.flex.core.ViewBase');
 
+goog.require('org.apache.flex.core.IPopUpHost');
 goog.require('org.apache.flex.core.UIBase');
 goog.require('org.apache.flex.core.ValuesManager');
 goog.require('org.apache.flex.events.Event');
@@ -24,6 +25,7 @@ goog.require('org.apache.flex.utils.MXMLDataInterpreter');
 
 /**
  * @constructor
+ * @implements {org.apache.flex.core.IPopUpHost}
  * @extends {org.apache.flex.core.UIBase}
  */
 org.apache.flex.core.ViewBase = function() {
@@ -58,7 +60,8 @@ goog.inherits(org.apache.flex.core.ViewBase, 
org.apache.flex.core.UIBase);
  */
 org.apache.flex.core.ViewBase.prototype.FLEXJS_CLASS_INFO =
     { names: [{ name: 'ViewBase',
-                qName: 'org.apache.flex.core.ViewBase' }] };
+                qName: 'org.apache.flex.core.ViewBase' }],
+      interfaces: [org.apache.flex.core.IPopUpHost] };
 
 
 /**
@@ -88,6 +91,7 @@ org.apache.flex.core.ViewBase.prototype.MXMLDescriptor = null;
 org.apache.flex.core.ViewBase.prototype.addedToParent = function() {
 
   //goog.base(this,'addedToParent');
+  this.element.flexjs_wrapper = this;
   if (org.apache.flex.core.ValuesManager.valuesImpl.init) {
     org.apache.flex.core.ValuesManager.valuesImpl.init(this);
   }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
----------------------------------------------------------------------
diff --git 
a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js 
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
index 076235a..ec25864 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/Label.js
@@ -27,6 +27,7 @@ org.apache.flex.html.staticControls.Label = function() {
 
   this.element = document.createElement('div');
   this.positioner = this.element;
+  this.element.flexjs_wrapper = this;
 };
 goog.inherits(org.apache.flex.html.staticControls.Label,
     org.apache.flex.core.UIBase);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/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 a5af58b..88a22b5 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
@@ -120,6 +120,7 @@ 
org.apache.flex.html.staticControls.Panel.prototype.createElement =
   this.element.className = 'Panel';
 
   this.contentArea = document.createElement('div');
+  this.contentArea.flexjs_wrapper = this;
   this.element.appendChild(this.contentArea);
 
   this.panelView = new org.apache.flex.html.staticControls.beads.PanelView();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/NonVirtualDataGroup.js
----------------------------------------------------------------------
diff --git 
a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/NonVirtualDataGroup.js
 
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/NonVirtualDataGroup.js
index ab6a850..2b64d93 100644
--- 
a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/NonVirtualDataGroup.js
+++ 
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/NonVirtualDataGroup.js
@@ -15,6 +15,8 @@
 
goog.provide('org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup');
 
 goog.require('org.apache.flex.core.UIBase');
+goog.require('org.apache.flex.utils.Language');
+goog.require('org.apache.flex.html.staticControls.supportClasses.DataItemRenderer');
 
 
 
@@ -61,6 +63,7 @@ 
org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup.
   this.element.style.overflow = 'auto';
   this.element.style.display = 'inline-block';
   this.element.style.position = 'inherit';
+  this.element.flexjs_wrapper = this;
   this.set_className('NonVirtualDataGroup');
 
   this.positioner = this.element;
@@ -77,8 +80,9 @@ 
org.apache.flex.html.staticControls.supportClasses.NonVirtualDataGroup.
     prototype.addElement = function(value) {
   goog.base(this, 'addElement', value);
 
-  value.set_index(this.renderers.length);
-  value.set_itemRendererParent(this);
+  var itemRenderer = 
org.apache.flex.utils.Language.as(value,org.apache.flex.html.staticControls.supportClasses.DataItemRenderer);
+  itemRenderer.set_index(this.renderers.length);
+  itemRenderer.set_itemRendererParent(this);
   this.renderers.push(value);
 };
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js
----------------------------------------------------------------------
diff --git 
a/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js 
b/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js
index 9bfd00d..4b9f273 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js
@@ -102,7 +102,7 @@ 
org.apache.flex.utils.MXMLDataInterpreter.generateMXMLObject =
 org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray =
     function(document, parent, data, opt_recursive) {
   var bead, beadOffset, beads, children, Cls, comp, comps, generateMXMLArray,
-      generateMXMLObject, i, id, j, k, l, m, n, name, self, simple, value;
+      generateMXMLObject, i, id, j, k, l, m, n, name, self, simple, value, 
dispatchBeadsAdded;
 
   if (opt_recursive === undefined) {
     opt_recursive = true;
@@ -122,6 +122,7 @@ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray 
=
     comp = new Cls();
 
     id = null;
+    dispatchBeadsAdded = false;
 
     m = data[i++]; // num props
     if (m > 0 && data[0] === 'model') {
@@ -209,6 +210,7 @@ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray 
=
       for (k = 0; k < l; k++) {
         bead = beads[k];
         comp.addBead(bead);
+        dispatchBeadsAdded = true;
       }
     }
 
@@ -254,6 +256,7 @@ org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray 
=
 
     if (parent) {
       parent.addElement(comp);
+      dispatchBeadsAdded = true;
     }
 
     children = data[i++];
@@ -286,6 +289,10 @@ 
org.apache.flex.utils.MXMLDataInterpreter.generateMXMLArray =
     }
 
     comps.push(comp);
+
+    if (dispatchBeadsAdded) {
+      comp.dispatchEvent('beadsAdded');
+    }
   }
 
   return comps;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02420b9a/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
index edf18bc..9e2e9fc 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/UIUtils.js
@@ -14,6 +14,9 @@
 
 goog.provide('org.apache.flex.utils.UIUtils');
 
+goog.require('org.apache.flex.core.IPopUpHost');
+goog.require('org.apache.flex.utils.Language');
+
 
 
 /**
@@ -41,8 +44,41 @@ org.apache.flex.utils.UIUtils.prototype.FLEXJS_CLASS_INFO =
 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;
+  var rw = relativeTo.get_width();
+  if (isNaN(rw)) rw = window.innerWidth;
+  var rh = relativeTo.get_height();
+  if (isNaN(rh)) rh = window.innerHeight;
+
+  var xpos = (rw - item.get_width()) / 2;
+  var ypos = (rh - item.get_height()) / 2;
   item.set_x(xpos);
   item.set_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.get_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.get_parent();
+  p.removeElement(popUp);
+};

Reply via email to