flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mamsel...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - - changed mobile CalloutSkin and CalloutArrow to keep backward compatibility: - if calloutSkin is subclassed, and borderThickness & borderColor are overridden => use these values - otherwise, use matching
Date Thu, 10 Oct 2013 22:42:16 GMT
Updated Branches:
  refs/heads/develop bde3a3d3c -> 626c45e2b


- changed mobile CalloutSkin and CalloutArrow to keep backward compatibility:
  - if calloutSkin is subclassed, and borderThickness & borderColor are overridden =>
use these values
  - otherwise, use matching css styles
- reverted mustella CalloutSkin test to use the old behavior (overridden values)


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

Branch: refs/heads/develop
Commit: 626c45e2b350a63bc8cf83d8a8de9f19635eebaf
Parents: bde3a3d
Author: mamsellem <maurice.amsellem@systar.com>
Authored: Fri Oct 11 00:41:51 2013 +0200
Committer: mamsellem <maurice.amsellem@systar.com>
Committed: Fri Oct 11 00:41:51 2013 +0200

----------------------------------------------------------------------
 .../mobiletheme/src/MobileThemeClasses.as       |  3 +-
 .../src/spark/skins/mobile/CalloutSkin.as       | 38 +++++++++++++------
 .../skins/mobile/supportClasses/CalloutArrow.as | 39 +++++++++++++++-----
 .../swfs/skins/MyCalloutSkin.as                 | 37 ++++++++++---------
 4 files changed, 77 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/626c45e2/frameworks/projects/mobiletheme/src/MobileThemeClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/MobileThemeClasses.as b/frameworks/projects/mobiletheme/src/MobileThemeClasses.as
index d7cacfc..3ff2ebe 100644
--- a/frameworks/projects/mobiletheme/src/MobileThemeClasses.as
+++ b/frameworks/projects/mobiletheme/src/MobileThemeClasses.as
@@ -35,7 +35,8 @@ import spark.skins.mobile.BeveledBackButtonSkin; BeveledBackButtonSkin;
 import spark.skins.mobile.ButtonBarSkin; spark.skins.mobile.ButtonBarSkin;
 import spark.skins.mobile.ButtonSkin; spark.skins.mobile.ButtonSkin;
 import spark.skins.mobile.CalloutSkin; spark.skins.mobile.CalloutSkin;
-import spark.skins.mobile.CalloutActionBarSkin; spark.skins.mobile.CalloutActionBarSkin;
+ import spark.skins.mobile.supportClasses.CalloutArrow;  spark.skins.mobile.supportClasses.CalloutArrow;
+    import spark.skins.mobile.CalloutActionBarSkin; spark.skins.mobile.CalloutActionBarSkin;
 import spark.skins.mobile.CalloutViewNavigatorSkin; spark.skins.mobile.CalloutViewNavigatorSkin;
 import spark.skins.mobile.CheckBoxSkin; spark.skins.mobile.CheckBoxSkin;
 import spark.skins.mobile.DefaultBeveledActionButtonSkin; spark.skins.mobile.DefaultBeveledActionButtonSkin;

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/626c45e2/frameworks/projects/mobiletheme/src/spark/skins/mobile/CalloutSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/mobile/CalloutSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/mobile/CalloutSkin.as
index 1a6df7d..b43d48d 100644
--- a/frameworks/projects/mobiletheme/src/spark/skins/mobile/CalloutSkin.as
+++ b/frameworks/projects/mobiletheme/src/spark/skins/mobile/CalloutSkin.as
@@ -279,7 +279,7 @@ public class CalloutSkin extends MobileSkin
      *  @playerversion AIR 3
      *  @productversion Flex 4.6
      */
-    protected var borderColor:Number = 0;
+    protected var borderColor:Number = -1; // not set
     
     /**
      *  Thickness of the border stroke around the <code>backgroundColor</code>
@@ -289,7 +289,7 @@ public class CalloutSkin extends MobileSkin
      *  @playerversion AIR 3
      *  @productversion Flex 4.6
      */
-    protected var borderThickness:Number = NaN;
+    protected var borderThickness:Number = -1 ;      // marker that borderThickness was not
set  directly
     
     /**
      *  Width of the arrow in vertical directions. This property also controls
@@ -359,7 +359,21 @@ public class CalloutSkin extends MobileSkin
      * @copy spark.components.Callout#arrow
      */
     public var arrow:UIComponent;
-    
+
+    /* helper private accessors */
+
+    /* returns borderThickness from style if member is -1, or borderThickness.  Returns 0
if NaN */
+    mx_internal function get actualBorderThickness():Number
+    {
+        var border: Number =  borderThickness != -1 ? borderThickness : getStyle('borderThickness');
+        return isNaN(border)? 0: border;
+    }
+
+    mx_internal function get actualBorderColor():uint
+    {
+        return borderColor != -1 ? borderColor: getStyle('borderColor');
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Overridden methods
@@ -381,7 +395,7 @@ public class CalloutSkin extends MobileSkin
             dropShadow.blurX = dropShadowBlurX;
             dropShadow.blurY = dropShadowBlurY;
             dropShadow.tlRadius = dropShadow.trRadius = dropShadow.blRadius = 
-                dropShadow.brRadius = backgroundCornerRadius;
+                dropShadow.brRadius = backgroundCornerRadius ;
             dropShadow.mouseEnabled = false;
             dropShadow.alpha = dropShadowAlpha;
             addChild(dropShadow);
@@ -408,8 +422,6 @@ public class CalloutSkin extends MobileSkin
             addChild(contentGroup);
         }
 
-        borderThickness = getStyle("borderThickness");
-        borderColor = getStyle("borderColor");
 
     }
     
@@ -446,7 +458,8 @@ public class CalloutSkin extends MobileSkin
         invalidateSize();
         invalidateDisplayList();
     }
-    
+
+
     /**
      * @private
      */
@@ -454,7 +467,7 @@ public class CalloutSkin extends MobileSkin
     {
         super.measure();
         
-        var borderWeight:Number = isNaN(borderThickness) ? 0 : borderThickness;
+        var borderWeight:Number =actualBorderThickness;
         var frameAdjustment:Number = (frameThickness + borderWeight) * 2;
         
         var arrowMeasuredWidth:Number;
@@ -576,8 +589,9 @@ public class CalloutSkin extends MobileSkin
         var frameEllipseSize:Number = backgroundCornerRadius * 2;
         
         // account for borderThickness center stroke alignment
-        var showBorder:Boolean = !isNaN(borderThickness) || borderThickness > 0 ;
-        var borderWeight:Number = showBorder ? borderThickness : 0;
+        var borderWeight:Number =actualBorderThickness;
+        var showBorder:Boolean = borderWeight > 0 ;
+
         
         // contentBackgroundGraphic already accounts for the arrow position
         // use it's positioning instead of recalculating based on unscaledWidth
@@ -594,7 +608,7 @@ public class CalloutSkin extends MobileSkin
         bgFill.clear();
         
         if (showBorder)
-            bgFill.lineStyle(borderThickness, borderColor, 1, true);
+            bgFill.lineStyle(borderWeight, actualBorderColor, 1, true);
         
         if (useBackgroundGradient)
         {
@@ -742,7 +756,7 @@ public class CalloutSkin extends MobileSkin
         }
         
         // Show frameThickness by inset of contentGroup
-        var borderWeight:Number = isNaN(borderThickness) ? 0 : borderThickness;
+        var borderWeight:Number = actualBorderThickness;
         var contentBackgroundAdjustment:Number = frameThickness + borderWeight;
         
         var contentBackgroundX:Number = frameX + contentBackgroundAdjustment;

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/626c45e2/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/CalloutArrow.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/CalloutArrow.as
b/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/CalloutArrow.as
index 553eb21..ea4bcf0 100644
--- a/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/CalloutArrow.as
+++ b/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/CalloutArrow.as
@@ -149,22 +149,45 @@ public class CalloutArrow extends UIComponent
     /**
      *  @copy spark.skins.mobile.CalloutSkin#borderColor
      */
-    protected var borderColor:Number;
+    protected var borderColor:Number = -1; // if not set
 
     /**
      *  @copy spark.skins.mobile.CalloutSkin#borderThickness
      */
-    protected var borderThickness:Number = NaN;
+    protected var borderThickness:Number = -1 ;      // marker that borderThickness was not
set  directly
 
     /**
      *  @private
      *  A sibling of the arrow used to erase the drop shadow in CalloutSkin
      */
     private var eraseFill:Sprite;
+
+    /* helper private accessors */
+
+    /* returns borderThickness from style if member is -1, or borderThickness.  Returns 0
if NaN */
+    private function get actualBorderThickness():Number
+    {
+        return calloutSkin.actualBorderThickness;
+    }
+
+    private function get actualBorderColor():uint
+    {
+        return calloutSkin.actualBorderColor;
+    }
+
+    protected function get calloutSkin():CalloutSkin
+    {
+        return parent as CalloutSkin ;
+    }
+
+    protected function get calloutHostComponent():Callout {
+        return  calloutSkin.hostComponent;
+    }
     
     /**
      * @private
      */
+
     override protected function createChildren():void
     {
         super.createChildren();
@@ -187,9 +210,7 @@ public class CalloutArrow extends UIComponent
         
         graphics.clear();
         eraseFill.graphics.clear();
-        
-        var calloutSkin:CalloutSkin = (parent as CalloutSkin);
-        var hostComponent:Callout = calloutSkin.hostComponent;
+        var hostComponent: Callout = calloutHostComponent;
         var arrowDirection:String = hostComponent.arrowDirection;
         
         if (arrowDirection == ArrowDirection.NONE)
@@ -207,9 +228,9 @@ public class CalloutArrow extends UIComponent
         var arrowEndX:Number = 0;
         var arrowEndY:Number = 0;
 
-        var borderThickness:Number = getStyle("borderThickness");
-        var showBorder:Boolean = !isNaN(borderThickness) && borderThickness >
0;
-        var borderWeight:Number = showBorder ? borderThickness : 0;
+        var borderWeight:Number = actualBorderThickness;
+        var showBorder:Boolean = borderWeight > 0;
+
         var borderHalf:Number = borderWeight / 2;
         var isHorizontal:Boolean = false;
         
@@ -357,7 +378,7 @@ public class CalloutArrow extends UIComponent
         
         // draw arrow path
         if (showBorder)
-            arrowGraphics.lineStyle(borderThickness, getStyle("borderColor"), 1, true);
+            arrowGraphics.lineStyle(borderWeight, actualBorderColor, 1, true);
         
         arrowGraphics.drawPath(commands, coords);
         arrowGraphics.endFill();

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/626c45e2/mustella/tests/mobile/SplitViewNavigator/swfs/skins/MyCalloutSkin.as
----------------------------------------------------------------------
diff --git a/mustella/tests/mobile/SplitViewNavigator/swfs/skins/MyCalloutSkin.as b/mustella/tests/mobile/SplitViewNavigator/swfs/skins/MyCalloutSkin.as
index b49e03e..e27a4ba 100644
--- a/mustella/tests/mobile/SplitViewNavigator/swfs/skins/MyCalloutSkin.as
+++ b/mustella/tests/mobile/SplitViewNavigator/swfs/skins/MyCalloutSkin.as
@@ -18,22 +18,23 @@
 ////////////////////////////////////////////////////////////////////////////////
 package skins
 {
-	import spark.skins.mobile.CalloutSkin;
-	
-	public class MyCalloutSkin extends CalloutSkin
-	{
-		public function MyCalloutSkin()
-		{
-			super();
-			contentCornerRadius=20;
-			frameThickness=10;
-			arrowWidth = 50;
-			arrowHeight = 50;
-			setStyle('borderThickness' , 10);
-			setStyle('borderColor', 0xFF0000);
-			dropShadowVisible=true;
-			backgroundCornerRadius=30;
-			
-		}
-	}
+
+import spark.skins.mobile.CalloutSkin;
+
+public class MyCalloutSkin extends CalloutSkin
+{
+    public function MyCalloutSkin()
+    {
+        super();
+        contentCornerRadius = 20;
+        frameThickness = 10;
+        arrowWidth = 50;
+        arrowHeight = 50;
+        borderThickness = 10;
+        borderColor = 0xFF0000;
+        dropShadowVisible = true;
+        backgroundCornerRadius = 30;
+
+    }
+}
 }
\ No newline at end of file


Mime
View raw message