You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2014/12/19 07:40:18 UTC

[6/6] git commit: [flex-sdk] [refs/heads/develop] - Several FlatSpark bug fixes, resolves FLEX-34692 and FLEX-34694

Several FlatSpark bug fixes, resolves FLEX-34692 and FLEX-34694

FlatSpark now accepts user "fontSize" properties
Added default values for fontSize and iconFontSize properties
Changed how FlatSpark renders button's label's sizes to avoid a potential exception
Removed unused parts from several components' "exclude" that caused an exception when used with chromeColor


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

Branch: refs/heads/develop
Commit: bcb29254f539e88d9d6c0b5ad995b1c8a42ee7f2
Parents: 2785366
Author: Mahmoud Ali <ak...@apache.org>
Authored: Thu Dec 18 21:02:50 2014 -0300
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Dec 19 07:39:36 2014 +0100

----------------------------------------------------------------------
 frameworks/projects/flatspark/defaults.css      |   6 ++
 .../src/flatspark/components/ButtonIcon.as      |   5 +-
 .../src/flatspark/skins/ButtonIconSkin.mxml     | 101 +++++++++++--------
 .../src/flatspark/skins/ButtonSkin.mxml         |  47 +++------
 .../src/flatspark/skins/CheckBoxSkin.mxml       |   6 +-
 .../src/flatspark/skins/PanelSkin.mxml          |   2 +-
 .../src/flatspark/skins/RadioButtonSkin.mxml    |   2 +-
 .../src/flatspark/skins/TextInputIconSkin.mxml  |   2 +-
 .../src/flatspark/skins/TitleWindowSkin.mxml    |   2 +-
 9 files changed, 87 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/defaults.css b/frameworks/projects/flatspark/defaults.css
index 5771436..f84b715 100644
--- a/frameworks/projects/flatspark/defaults.css
+++ b/frameworks/projects/flatspark/defaults.css
@@ -107,8 +107,14 @@ s|Application {
 	fontFamily: Lato, Helvetica, Arial, sans-serif;
 }
 
+s|Button {
+	fontSize: 14;
+}
+
 components|ButtonIcon {
 	skinClass: ClassReference("flatspark.skins.ButtonIconSkin");
+	fontSize: 14;
+	iconFontSize: 17;
 }
 
 components|TextInputIcon {

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/components/ButtonIcon.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/components/ButtonIcon.as b/frameworks/projects/flatspark/src/flatspark/components/ButtonIcon.as
index d14c53f..e3f5620 100644
--- a/frameworks/projects/flatspark/src/flatspark/components/ButtonIcon.as
+++ b/frameworks/projects/flatspark/src/flatspark/components/ButtonIcon.as
@@ -21,7 +21,7 @@ package flatspark.components
 	import spark.components.Button;
 	
 	import flatspark.enums.BrandColorEnum;
-
+	[Style(name="iconFontSize", type="Number", format="Length", inherit="yes", minValue="1.0", maxValue="720.0")]
 	public class ButtonIcon extends spark.components.Button
 	{
 
@@ -30,6 +30,9 @@ package flatspark.components
 		
 		[Bindable]
 		public var brand:int = BrandColorEnum.Default;
+		
+		[Bindable]
+		public var fixedHeight:Boolean = true;
 
 
 		public function ButtonIcon()

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/ButtonIconSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/ButtonIconSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/ButtonIconSkin.mxml
index cb8ab83..c7f03fc 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/ButtonIconSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/ButtonIconSkin.mxml
@@ -44,7 +44,7 @@ limitations under the License.
 
 			/* Define the skin elements that should not be colorized. 
 			For button, the graphics are colorized but the label is not. */
-			static private const exclusions:Array = ["iconDisplay", "labelDisplay"];
+			static private const exclusions:Array = ["labelDisplay"];
 			
 			/** 
 			 * @private
@@ -59,6 +59,9 @@ limitations under the License.
 				useChromeColor = true;
 				hostComponent.useHandCursor=true;
 				hostComponent.buttonMode=true;
+				// Set 'fontSize' here cause doing this inside the 'labelDisplay' results in an error
+				(labelDisplay as Label).setStyle("fontSize", fontSize);
+				(iconFont as Label).setStyle("fontSize", iconSize);
 				super.initializationComplete();
 			}  
 			
@@ -78,62 +81,76 @@ limitations under the License.
 					fill_disabled.radiusX = cornerRadius;
 				}
 				
-				/*var larguraIcone:int = 0;
-				if (iconFont.text != null && iconFont.text != "")
-				{
-					larguraIcone = 60;
-				}*/
 				super.updateDisplayList(unscaledWidth, unscaledHeight);
 			}
 			
 			private var cornerRadius:Number = 2;
 			
-			private static function getFontSize(height:int):int
+			private function get fontSize():Number
 			{
-				var altura:int = 15;
+				var fontHeight:int = 14;
 				
-				switch (height)
+				if (hostComponent.fixedHeight)
+				{
+					switch (hostComponent.height)
+					{
+						case ButtonSizeEnum.Large:
+							fontHeight = 17;
+							break;
+						case ButtonSizeEnum.Normal:
+							fontHeight = 14;
+							break;
+						case ButtonSizeEnum.Small:
+							fontHeight = 13;
+							break;
+						case ButtonSizeEnum.ExtraSmall:
+							fontHeight = 12;
+							break;
+						default:
+							fontHeight = hostComponent.getStyle("fontSize");
+							break;
+					}
+				}
+				else
 				{
-					case ButtonSizeEnum.Large:
-						altura = 17;
-						break;
-					case ButtonSizeEnum.Normal:
-						altura = 14;
-						break;
-					case ButtonSizeEnum.Small:
-						altura = 13;
-						break;
-					case ButtonSizeEnum.ExtraSmall:
-						altura = 12;
-						break;
+					fontHeight = hostComponent.getStyle("fontSize");
 				}
 				
-				return altura;
+				return fontHeight;
 			}
 			
-			private static function getIconSize(height:int):int
+			private function get iconSize():Number
 			{
-				var altura:int = 17;
+				var iconHeight:int = 17;				
 				
-				switch (height)
+				if (hostComponent.fixedHeight)
 				{
-					case ButtonSizeEnum.Large:
-						altura = 19;
-						break;
-					case ButtonSizeEnum.Normal:
-						altura = 17;
-						break;
-					case ButtonSizeEnum.Small:
-						altura = 15;
-						break;
-					case ButtonSizeEnum.ExtraSmall:
-						altura = 12;
-						break;
+					switch (hostComponent.height)
+					{
+						case ButtonSizeEnum.Large:
+							iconHeight = 19;
+							break;
+						case ButtonSizeEnum.Normal:
+							iconHeight = 17;
+							break;
+						case ButtonSizeEnum.Small:
+							iconHeight = 15;
+							break;
+						case ButtonSizeEnum.ExtraSmall:
+							iconHeight = 12;
+							break;
+						default:
+							iconHeight = hostComponent.getStyle("iconFontSize");
+							break;
+					}
+				}
+				else
+				{
+					iconHeight = hostComponent.getStyle("iconFontSize");
 				}
 				
-				return altura;
+				return iconHeight;
 			}
-			
 		]]>        
 	</fx:Script>
 	
@@ -177,14 +194,14 @@ limitations under the License.
 	<!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay  -->
 	<s:HGroup verticalAlign="middle" verticalCenter="0" horizontalAlign="center" horizontalCenter="0" left="10" right="10" top="2" bottom="2">
 		<s:Label id="iconFont" color="0xFFFFFF" color.disabled="0xE3E3E3" text="{hostComponent.iconFont}"
-				 textAlign="left" fontSize="{getIconSize(hostComponent.height)}" fontFamily="FontAwesome"
+				 textAlign="left" fontFamily="FontAwesome"
 				 maxDisplayedLines="1" includeInLayout="{hostComponent.iconFont != null}"
 				 horizontalCenter="0" verticalCenter="0" verticalAlign="middle">
 		</s:Label>
 		
 		<s:Label id="labelDisplay" color="0xFFFFFF" color.disabled="0xE3E3E3"
-				 textAlign="center" fontSize="{getFontSize(hostComponent.height)}" fontFamily="Lato"
-				 maxDisplayedLines="1"
+				 textAlign="center" fontFamily="Lato"
+				 maxDisplayedLines="1" includeInLayout="{hostComponent.label != ''}"
 				 horizontalCenter="0" verticalCenter="1" verticalAlign="middle">
 		</s:Label>
 	</s:HGroup>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/ButtonSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/ButtonSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/ButtonSkin.mxml
index ce56543..966497f 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/ButtonSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/ButtonSkin.mxml
@@ -28,7 +28,7 @@ limitations under the License.
 @playerversion AIR 1.5
 @productversion Flex 4
 -->
-<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
+<s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
 			 xmlns:s="library://ns.adobe.com/flex/spark" 
 			 xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
 			 minWidth="21" minHeight="21" height="{ButtonSizeEnum.Normal}"
@@ -60,6 +60,8 @@ limitations under the License.
 				useChromeColor = true;
 				hostComponent.useHandCursor=true;
 				hostComponent.buttonMode=true;
+				// Set 'fontSize' here cause doing this inside the 'labelDisplay' results in an error
+				(labelDisplay as Label).setStyle("fontSize", fontSize);
 				super.initializationComplete();
 			}  
 			
@@ -79,21 +81,16 @@ limitations under the License.
 					fill_disabled.radiusX = cornerRadius;
 				}
 				
-				/*var larguraIcone:int = 0;
-				if (iconFont.text != null && iconFont.text != "")
-				{
-					larguraIcone = 60;
-				}*/
 				super.updateDisplayList(unscaledWidth, unscaledHeight);
 			}
 			
 			private var cornerRadius:Number = 2;
 			
-			private static function getFontSize(height:int):int
+			private function get fontSize():Number
 			{
-				var altura:int = 15;
+				var altura:int = 14;
 				
-				switch (height)
+				switch (hostComponent.height)
 				{
 					case ButtonSizeEnum.Large:
 						altura = 17;
@@ -107,34 +104,14 @@ limitations under the License.
 					case ButtonSizeEnum.ExtraSmall:
 						altura = 12;
 						break;
-				}
-				
-				return altura;
-			}
-			
-			private static function getIconSize(height:int):int
-			{
-				var altura:int = 17;
-				
-				switch (height)
-				{
-					case ButtonSizeEnum.Large:
-						altura = 19;
-						break;
-					case ButtonSizeEnum.Normal:
-						altura = 17;
-						break;
-					case ButtonSizeEnum.Small:
-						altura = 15;
-						break;
-					case ButtonSizeEnum.ExtraSmall:
-						altura = 12;
+					default:
+						// Make sure that an optional passed 'fontSize' inside the host componenet will be considered
+						altura = hostComponent.getStyle("fontSize");
 						break;
 				}
 				
 				return altura;
 			}
-			
 		]]>        
 	</fx:Script>
 	
@@ -176,9 +153,11 @@ limitations under the License.
 	
 	<!-- layer 8: text -->
 	<!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay  -->
+	<!--- @see initializationComplete() -->
 	<s:Label id="labelDisplay" color="0xFFFFFF" color.disabled="0xE3E3E3" right="10" left="10"
-			 textAlign="center" fontSize="{getFontSize(hostComponent.height)}" fontFamily="Lato"
+			 textAlign="center" 
+			 fontFamily="Lato"
 			 maxDisplayedLines="1"
 			 horizontalCenter="0" verticalCenter="1" verticalAlign="middle">
 	</s:Label>
-</s:SparkSkin>
+</s:SparkButtonSkin>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/CheckBoxSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/CheckBoxSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/CheckBoxSkin.mxml
index 504bf2d..79584bd 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/CheckBoxSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/CheckBoxSkin.mxml
@@ -43,7 +43,7 @@ limitations under the License.
     <fx:Script fb:purpose="styling">
         /* Define the skin elements that should not be colorized. 
            For button, the graphics are colorized but the label is not. */
-        static private const exclusions:Array = ["labelDisplay", "check"];
+        static private const exclusions:Array = ["labelDisplay"];
 
        /** 
         * @private 
@@ -116,10 +116,6 @@ limitations under the License.
 			</s:fill>
 		</s:Rect>
         
-		<!--<s:Label fontFamily="FontAwesome" fontSize="12" color="#FFFFFF" text="{AwesomeUtils.fa_check}" includeIn="overStates"
-				 itemCreationPolicy="immediate" verticalAlign="middle" horizontalCenter="0" verticalCenter="0" alpha="0.75"
-				 />-->
-		
 		<s:Label fontFamily="FontAwesome" fontSize="12" color="#FFFFFF" text="{AwesomeUtils.fa_check}" includeIn="selectedStates"
 				 itemCreationPolicy="immediate" verticalAlign="middle" horizontalCenter="0" verticalCenter="0"
 				 />

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/PanelSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/PanelSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/PanelSkin.mxml
index 9df0ea7..00fdd74 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/PanelSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/PanelSkin.mxml
@@ -49,7 +49,7 @@ limitations under the License.
 		
 		/* Define the skin elements that should not be colorized. 
         For panel, border and title background are skinned, but the content area, background, border, and title text are not. */
-        static private const exclusions:Array = ["background", "titleDisplay", "contentGroup", "controlBarGroup", "border"];
+        static private const exclusions:Array = ["background", "titleDisplay", "contentGroup", "controlBarGroup"];
 			
 		/* exclusions before Flex 4.5 for backwards-compatibility purposes */
 		static private const exclusions_4_0:Array = ["background", "titleDisplay", "contentGroup", "controlBarGroup"];

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/RadioButtonSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/RadioButtonSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/RadioButtonSkin.mxml
index 97e2bb1..63c10fe 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/RadioButtonSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/RadioButtonSkin.mxml
@@ -36,7 +36,7 @@ limitations under the License.
     <fx:Script fb:purpose="styling">
         /* Define the skin elements that should not be colorized. 
            For button, the graphics are colorized but the label is not. */
-        static private const exclusions:Array = ["labelDisplay", "dot"];
+        static private const exclusions:Array = ["labelDisplay"];
 
         /**
          * @private

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/TextInputIconSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/TextInputIconSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/TextInputIconSkin.mxml
index a4b167a..92df014 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/TextInputIconSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/TextInputIconSkin.mxml
@@ -66,7 +66,7 @@ limitations under the License.
         private var paddingChanged:Boolean;
         
         /* Define the skin elements that should not be colorized. */
-        static private const exclusions:Array = ["background", "background_disabled", "textDisplay", "promptDisplay", "border", "border_disabled"];
+        static private const exclusions:Array = ["background", "background_disabled", "textDisplay", "promptDisplay", "border"];
         
         /* exclusions before Flex 4.5 for backwards-compatibility purposes */
         static private const exclusions_4_0:Array = ["background", "background_disabled", "textDisplay", "promptDisplay"];

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bcb29254/frameworks/projects/flatspark/src/flatspark/skins/TitleWindowSkin.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/flatspark/src/flatspark/skins/TitleWindowSkin.mxml b/frameworks/projects/flatspark/src/flatspark/skins/TitleWindowSkin.mxml
index c4e4a94..86a37a2 100644
--- a/frameworks/projects/flatspark/src/flatspark/skins/TitleWindowSkin.mxml
+++ b/frameworks/projects/flatspark/src/flatspark/skins/TitleWindowSkin.mxml
@@ -50,7 +50,7 @@ limitations under the License.
 		
 		/* Define the skin elements that should not be colorized. 
         For panel, border and title background are skinned, but the content area, background, border, and title text are not. */
-        static private const exclusions:Array = ["background", "titleDisplay", "contentGroup", "border"];
+        static private const exclusions:Array = ["background", "titleDisplay", "contentGroup"];
 		
 		/* exclusions before Flex 4.5 for backwards-compatibility purposes */
 		static private const exclusions_4_0:Array = ["background", "titleDisplay", "contentGroup"];