incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cframp...@apache.org
Subject svn commit: r1403832 - /incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as
Date Tue, 30 Oct 2012 19:31:44 GMT
Author: cframpton
Date: Tue Oct 30 19:31:44 2012
New Revision: 1403832

URL: http://svn.apache.org/viewvc?rev=1403832&view=rev
Log:
Defer adding IAdvancedStyleClients to a Group until after its children have been created with
createChildren(). The locale was not propagating properly.  [SDK-30452]

Modified:
    incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as

Modified: incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as?rev=1403832&r1=1403831&r2=1403832&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as
(original)
+++ incubator/flex/sdk/branches/develop/frameworks/projects/spark/src/spark/components/Group.as
Tue Oct 30 19:31:44 2012
@@ -23,9 +23,9 @@ package spark.components 
 import flash.display.BlendMode;
 import flash.display.DisplayObject;
 import flash.geom.Rectangle;
+import flash.utils.Dictionary;
 
 import mx.core.FlexVersion;
-import mx.styles.IAdvancedStyleClient;
 import mx.core.IFlexModule;
 import mx.core.IFontContextComponent;
 import mx.core.IUIComponent;
@@ -43,6 +43,8 @@ import mx.graphics.shaderClasses.HueShad
 import mx.graphics.shaderClasses.LuminosityShader;
 import mx.graphics.shaderClasses.SaturationShader;
 import mx.graphics.shaderClasses.SoftLightShader;
+import mx.styles.AdvancedStyleClient;
+import mx.styles.IAdvancedStyleClient;
 import mx.styles.ISimpleStyleClient;
 import mx.styles.IStyleClient;
 import mx.styles.StyleProtoChain;
@@ -239,6 +241,7 @@ public class Group extends GroupBase imp
     private var needsDisplayObjectAssignment:Boolean = false;
     private var layeringMode:uint = ITEM_ORDERED_LAYERING;
     private var numGraphicElements:uint = 0;
+    private var deferredStyleClients:Dictionary = null;  // of IAdvancedStyleClient
     
     private static const ITEM_ORDERED_LAYERING:uint = 0;
     private static const SPARSE_LAYERING:uint = 1;    
@@ -841,6 +844,37 @@ public class Group extends GroupBase imp
     
     /**
      *  @private
+     *  Defer adding IAdvancedStyleClients until createChildren() time.  The AdvancedStyleClient's
+     *  styleName might be a component's show inclusion in the IVisualElement hierarchy was
also
+     *  deferred.
+     */ 
+    override public function addStyleClient(styleClient:IAdvancedStyleClient):void    
+    {
+        if (!createChildrenCalled)
+        {
+            if (!deferredStyleClients)
+                deferredStyleClients = new Dictionary(true);
+            deferredStyleClients[styleClient] = true;
+        }
+        else 
+        {
+            super.addStyleClient(styleClient);
+        }
+    }
+    
+    /**
+     *  @private
+     */     
+    override public function removeStyleClient(styleClient:IAdvancedStyleClient):void
+    {
+        if (deferredStyleClients && !createChildrenCalled)
+            delete deferredStyleClients[styleClient];
+        else
+            super.removeStyleClient(styleClient);
+    }
+    
+    /**
+     *  @private
      *  Whether createChildren() has been called or not.
      *  We use this in the setter for mxmlContent to know 
      *  whether to validate the value immediately, or just 
@@ -862,6 +896,17 @@ public class Group extends GroupBase imp
             mxmlContentChanged = false;
             setMXMLContent(_mxmlContent);
         }
+        
+        if (deferredStyleClients)
+        {
+            for (var obj:Object in deferredStyleClients)
+            {
+                var styleClient:IAdvancedStyleClient = obj as IAdvancedStyleClient;
+                if (styleClient)
+                    super.addStyleClient(styleClient);
+            }
+            deferredStyleClients = null;
+        }        
     }
     
     /**



Mime
View raw message