Added ability to select Flex SDK version
Fixed errors where config files ended up with duplicate contents
Fixed layout of application


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

Branch: refs/heads/master
Commit: 67d965baa379555437f70e1aa63931ceabef1a0b
Parents: 2309ab2
Author: Om <bigosma...@gmail.com>
Authored: Wed Jul 17 00:43:01 2013 -0700
Committer: Om <bigosma...@gmail.com>
Committed: Wed Jul 17 00:43:01 2013 -0700

----------------------------------------------------------------------
 installer/src/InstallApacheFlex.mxml            | 166 +++++++++++++------
 .../src/installer/sdk-installer-config-3.0.xml  |  13 +-
 .../skins/controls/InstallApacheFlexSkin.mxml   |   2 +
 3 files changed, 121 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/67d965ba/installer/src/InstallApacheFlex.mxml
----------------------------------------------------------------------
diff --git a/installer/src/InstallApacheFlex.mxml 
b/installer/src/InstallApacheFlex.mxml
index 985b3d6..9c4fc9a 100644
--- a/installer/src/InstallApacheFlex.mxml
+++ b/installer/src/InstallApacheFlex.mxml
@@ -34,7 +34,7 @@ variables are not required because the locations of these 
pieces are known.
 
 <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009";
                                           
xmlns:s="library://ns.adobe.com/flex/spark"
-                                          width="800" height="650" 
maxWidth="800" maxHeight="650" minWidth="800" minHeight="650"
+                                          width="800" height="700" 
maxWidth="800" maxHeight="700" minWidth="800" minHeight="700"
                                           backgroundColor="0xDDDDDD"
                                           preinitialize="getInvoke()"
                                           
applicationComplete="handleApplicationComplete(event)" showStatusBar="false"
@@ -57,6 +57,9 @@ variables are not required because the locations of these 
pieces are known.
                import mx.managers.PopUpManager;
                import mx.utils.StringUtil;
                
+               import spark.events.IndexChangeEvent;
+               import spark.events.TextOperationEvent;
+               
                import 
org.apache.flex.packageflexsdk.model.InstallerComponentVO;
                import 
org.apache.flex.packageflexsdk.resource.ViewResourceConstants;
                import org.apache.flex.packageflexsdk.util.MD5CompareUtil;
@@ -73,9 +76,6 @@ variables are not required because the locations of these 
pieces are known.
                import org.as3commons.zip.ZipEvent;
                import org.as3commons.zip.ZipFile;
                
-               import spark.events.IndexChangeEvent;
-               import spark.events.TextOperationEvent;
-               
                import ws.tink.spark.controls.StepItem;
                
                private var _mirrorURLCGI:String;
@@ -101,8 +101,8 @@ variables are not required because the locations of these 
pieces are known.
                private var APACHE_FLEX_BIN_DISTRO_FILE:String;
                private var APACHE_FLEX_BIN_DISTRO_FILE_SHORT:String;
                private var APACHE_FLEX_BIN_DISTRO_URL:String;
-               [Bindable]
-               private var APACHE_FLEX_BIN_DISTRO_VERSION:String = "";
+               [Bindable] private var APACHE_FLEX_BIN_DISTRO_VERSION:String = 
"";
+               [Bindable] private var 
APACHE_FLEX_BIN_DISTRO_VERSION_DISPLAY:String = "";
                
                /**
                 * Adobe AIR SDK
@@ -132,6 +132,14 @@ variables are not required because the locations of these 
pieces are known.
                private var ADOBE_FB_GLOBALPLAYER_SWC_URL:String;
                
                /**
+                * Apache Flex
+                *
+                * Values stored in sdk-installer-config.xml edit file to change
+                *
+                */
+               [Bindable] private var FLEX_VERSIONS:ArrayCollection = new 
ArrayCollection();
+               
+               /**
                 *
                 * SwfObject
                 *
@@ -310,7 +318,7 @@ variables are not required because the locations of these 
pieces are known.
                }
                
                private function updateWindowTitle():void {
-                       this.nativeWindow.title = 
StringUtil.substitute(_viewResourceConstants.INFO_WINDOW_TITLE, 
[APACHE_FLEX_BIN_DISTRO_VERSION]);
+                       this.nativeWindow.title = 
StringUtil.substitute(_viewResourceConstants.INFO_WINDOW_TITLE, 
[APACHE_FLEX_BIN_DISTRO_VERSION_DISPLAY]);
                }
                
                protected function selectDefaultLanguage():void {
@@ -352,7 +360,8 @@ variables are not required because the locations of these 
pieces are known.
                        if (configOverride != "") {
                                request = new URLRequest(configOverride);
                        } else {
-                               request = new 
URLRequest(Constants.APACHE_FLEX_URL + Constants.CONFIG_XML_NAME);
+//                             request = new 
URLRequest(Constants.APACHE_FLEX_URL + Constants.CONFIG_XML_NAME);
+                               request = new 
URLRequest(Constants.CONFIG_XML_NAME);
                        }
                        
                        _loader = new URLLoader();
@@ -400,29 +409,6 @@ variables are not required because the locations of these 
pieces are known.
                        
                        _mirrorURLCGI = files.(@name == 
'MirrorURLCGI').@file.toString();
                        
-                       var fileName:String = files.(@name == 
'ApacheFlexSDK').@file.toString();
-                       /* Tmp solution to remove the file extension if present 
in the config XML */
-                       var winExtension:String = 
Constants.ARCHIVE_EXTENSION_WIN;
-                       if (fileName.indexOf(winExtension) > -1) {
-                               fileName = fileName.substring(0, 
fileName.length - winExtension.length);
-                       }
-                       
-                       APACHE_FLEX_BIN_DISTRO_FILE_SHORT = fileName;
-                       APACHE_FLEX_BIN_DISTRO_VERSION = 
fileName.substr(Constants.SDK_BINARY_FILE_NAME_PREFIX.length).split("-")[0];
-                       fileName += (_os == WINDOWS_OS) ? winExtension : 
Constants.ARCHIVE_EXTENSION_MAC;
-                       
-                       APACHE_FLEX_BIN_DISTRO_FILE = fileName;
-                       APACHE_FLEX_BIN_DISTRO_PATH = files.(@name == 
'ApacheFlexSDK').@path.toString();
-                       if (!APACHE_FLEX_BIN_DISTRO_FILE || 
!APACHE_FLEX_BIN_DISTRO_PATH) {
-                               
log(_viewResourceConstants.ERROR_INVALID_SDK_URL);
-                               keepGoing = false;
-                       }
-                       
-                       // ApacheFlex is full URL so download directly and dont 
use mirror useful for testing release candidates
-                       if (APACHE_FLEX_BIN_DISTRO_PATH.indexOf("http") == 0) {
-                               _useMirror = false;
-                       }
-                       
                        var airVersions:Array = files.(@name == 
'Versions').@airVersions.toString().split(",");
                        var selected:String = files.(@name == 
'Versions').@airDefault.toString();
                        for each (var airVersion:String in airVersions) {
@@ -439,6 +425,29 @@ variables are not required because the locations of these 
pieces are known.
                                this.airVersion.selectedIndex = 
airVersions.indexOf(selected);  
                        }
                        
+                       var flexVersions:Array = files.(@name == 
'FlexVersions').@versions.toString().split(",");
+                       for each (var flexVersion:String in flexVersions) {
+                               var shortName:String = files.(@name == 
flexVersion).@file.toString();
+                               var fileName:String = shortName + ((_os == 
WINDOWS_OS) ? Constants.ARCHIVE_EXTENSION_WIN : 
Constants.ARCHIVE_EXTENSION_MAC);
+                               var label:String = "Flex SDK " + flexVersion;
+                               var ver:String = 
fileName.substr(Constants.SDK_BINARY_FILE_NAME_PREFIX.length).split("-")[0];
+                               var path:String = files.(@name == 
flexVersion).@path.toString();
+                               FLEX_VERSIONS.addItem({shortName: shortName, 
fileName:fileName,label:label, version:ver, path:path});
+                       }
+                       var selectedFlexVersion:String = files.(@name == 
'FlexVersions').@default.toString();
+                       
+                       if (this.flexVersion.selectedIndex == -1) {
+                               this.flexVersion.selectedIndex = 0;
+                       }
+                       
+                       var selectedFlexVersionObject:Object = 
this.flexVersion.selectedItem;
+                       updateFlexVersionStrings(selectedFlexVersionObject);
+                       
+                       if (!APACHE_FLEX_BIN_DISTRO_FILE || 
!APACHE_FLEX_BIN_DISTRO_PATH) {
+                               
log(_viewResourceConstants.ERROR_INVALID_SDK_URL);
+                               keepGoing = false;
+                       }
+                       
                        var flashPlayerVersions:Array = files.(@name == 
'Versions').@flashPlayerVersions.toString().split(",");
                        selected = files.(@name == 
'Versions').@flashPlayerDefault.toString();
                        for each (var flashPlayerVersion:String in 
flashPlayerVersions) {
@@ -504,10 +513,30 @@ variables are not required because the locations of these 
pieces are known.
                        
                        RIDEAU_FILE = files.(@name == 
'rideau').@file.toString();
                        RIDEAU_URL = files.(@name == 'rideau').@path.toString();
+
                        
                        return keepGoing;
                }
                
+               protected function 
updateFlexVersionStrings(selectedFlexVersionObject:Object):void
+               {
+                       APACHE_FLEX_BIN_DISTRO_FILE_SHORT = 
selectedFlexVersionObject.shortName;
+                       APACHE_FLEX_BIN_DISTRO_VERSION = 
selectedFlexVersionObject.version;
+                       APACHE_FLEX_BIN_DISTRO_VERSION_DISPLAY = 
selectedFlexVersionObject.label;
+                       
+                       APACHE_FLEX_BIN_DISTRO_FILE = 
selectedFlexVersionObject.fileName;
+                       APACHE_FLEX_BIN_DISTRO_PATH = 
selectedFlexVersionObject.path;
+                       
+                       // ApacheFlex is full URL so download directly and dont 
use mirror useful for testing release candidates
+                       if (APACHE_FLEX_BIN_DISTRO_PATH.indexOf("http") == 0) {
+                               _useMirror = false;
+                       }
+                       else
+                       {
+                               _useMirror = true;
+                       }
+               }
+               
                protected function setOSSpecificVariables():void {
                        var operatingSystemStr:String = Capabilities.os;
                        
@@ -702,7 +731,7 @@ variables are not required because the locations of these 
pieces are known.
                }
                
                protected function handleAirVersionChange(event:Event):void {
-                       AIR_VERSION = airVersion.selectedItem.verson;
+                       AIR_VERSION = airVersion.selectedItem.version;
                        
                        // AIR requires a minimum Flash Player version
                        if (flashPlayerVersion.selectedIndex > 
airVersion.selectedIndex) {
@@ -712,7 +741,7 @@ variables are not required because the locations of these 
pieces are known.
                }
                
                protected function 
handleFlashPlayerVersionChange(event:Event):void {
-                       FLASH_PLAYER_VERSION = 
flashPlayerVersion.selectedItem.verson;
+                       FLASH_PLAYER_VERSION = 
flashPlayerVersion.selectedItem.version;
                        
                        // AIR requires a minimum Flash Player version
                        if (airVersion.selectedIndex < 
flashPlayerVersion.selectedIndex) {
@@ -721,6 +750,13 @@ variables are not required because the locations of these 
pieces are known.
                        }
                }
                
+               protected function handleFlexVersionChange(event:Event):void {
+                       /*APACHE_FLEX_BIN_DISTRO_VERSION =  
flexVersion.selectedItem.version;
+                       APACHE_FLEX_BIN_DISTRO_VERSION_DISPLAY = 
flexVersion.selectedItem.label;*/
+                       updateFlexVersionStrings(flexVersion.selectedItem);
+                       updateWindowTitle();
+               }
+               
                protected function browseForSDK(event:MouseEvent):void {
                        var file:File = new File();
                        
@@ -1043,12 +1079,14 @@ variables are not required because the locations of 
these pieces are known.
                                for each (var file:File in configFiles) {
                                        if (isValidConfigFile(file)) {
                                                var configFile:FileStream = new 
FileStream();
-                                               configFile.open(file, 
FileMode.UPDATE);
+                                               configFile.open(file, 
FileMode.READ);
                                                var contents:String = 
configFile.readMultiByte(configFile.bytesAvailable, "utf-8");
                                                var playerVersion:RegExp = 
/<target-player>\d\d\.\d<\/target-player>/;
                                                contents = 
contents.replace(playerVersion, "<target-player>" + FLASH_PLAYER_VERSION + 
"<\/target-player>");
                                                var swfVersion:RegExp = 
/<swf-version>\d\d<\/swf-version>/;
                                                contents = 
contents.replace(swfVersion, "<swf-version>" + FLASH_PLAYER_SWF_VERSION + 
"<\/swf-version>" );
+                                               configFile.close();
+                                               
configFile.open(file,FileMode.WRITE);
                                                
configFile.writeMultiByte(contents, "utf-8");                                   
                                                var copyToFile:File = 
flexHomeFrameworksDir.resolvePath(file.name);
                                                configFile.close();
@@ -1058,10 +1096,12 @@ variables are not required because the locations of 
these pieces are known.
                                
                                file = File.userDirectory.resolvePath(_flexHome 
+ File.separator + "flex-sdk-description.xml");
                                var descriptionFile:FileStream = new 
FileStream();
-                               descriptionFile.open(file, FileMode.UPDATE);
+                               descriptionFile.open(file, FileMode.READ);
                                contents = 
descriptionFile.readMultiByte(descriptionFile.bytesAvailable, "utf-8");
                                var description:RegExp = /<name>[^<]*<\/name>/;
                                contents = contents.replace(description, 
"<name>Apache Flex " + APACHE_FLEX_BIN_DISTRO_VERSION + " FP " + 
FLASH_PLAYER_VERSION + " AIR " + AIR_VERSION + " en_US</name>");
+                               descriptionFile.close();
+                               descriptionFile.open(file,FileMode.WRITE);
                                descriptionFile.writeMultiByte(contents, 
"utf-8");
                                descriptionFile.close();
                        } catch (e:Error) {
@@ -1440,7 +1480,7 @@ variables are not required because the locations of these 
pieces are known.
                protected function 
handleOptionalInstallsChange(event:IndexChangeEvent):void {
                        var selectedItem:InstallerComponentVO = 
InstallerComponentVO(event.target.selectedItem);
                        optionalInstallsTxtArea.text = selectedItem.message;
-                       installChkBx.label = 
_viewResourceConstants.INSTALL_AGREE;
+/*                     installChkBx.label = 
_viewResourceConstants.INSTALL_AGREE;
                        if (selectedItem.answered) {
                                if (selectedItem.selected) {
                                        installChkBx.selected = true;
@@ -1449,7 +1489,7 @@ variables are not required because the locations of these 
pieces are known.
                                }
                        } else {
                                installChkBx.selected = false;
-                       }
+                       }*/
                        
                        licenseLinkBtn.includeInLayout = true;
                        _currentLicenseLabel = selectedItem.licenseName;
@@ -1853,20 +1893,23 @@ variables are not required because the locations of 
these pieces are known.
                        </s:layout>
                </s:DropDownList>
        </s:HGroup>
-       <s:HGroup width="100%" top="170">
-               <s:Spacer width="100%" />
-               <s:Image source="assets/icons/apache_flex_logo_text.png" 
scaleX=".4" scaleY=".4" smooth="true" />
-               <s:Spacer width="150" />
-               <s:VGroup horizontalAlign="left" paddingLeft="100" gap="-5">
-                       <s:Label text="{_viewResourceConstants.INFO_VERSION}" 
fontFamily="openSansBold" color="0x677084" fontSize="33" />
+<!--   <s:Group width="100%" top="275">-->
+<!--           <s:HGroup gap="0" horizontalCenter="0" top="30">
+                       <s:Label text="apache" fontFamily="openSansBold" 
color="0x677084" fontSize="24" />
+                       <s:Label text="Flex" right="0"
+                                        fontFamily="openSansBold"
+                                        color="0x172647" fontSize="70"
+                                        />
+               </s:HGroup>-->
+               
+               <s:HGroup verticalAlign="middle" gap="5" horizontalCenter="0" 
top="300">
+                       <s:Label text="{_viewResourceConstants.INFO_VERSION}" 
fontFamily="openSansBold" color="0x677084" fontSize="24" />
                        <s:Label text="{APACHE_FLEX_BIN_DISTRO_VERSION}" 
right="0"
                                         fontFamily="openSansBold"
-                                        color="0x172647" fontSize="80"
-                                        trackingLeft="-2" trackingRight="-2"
+                                        color="0x172647" fontSize="70"
                                         />
-               </s:VGroup>
-               <s:Spacer width="100%" />
-       </s:HGroup>
+               </s:HGroup>
+<!--   </s:Group>-->
        <s:Panel id="zeroStepGroup"
                         
title="{_viewResourceConstants.INFO_SELECT_AIR_FLASH_PLAYER}"
                         width="640"
@@ -1882,6 +1925,19 @@ variables are not required because the locations of 
these pieces are known.
                                paddingLeft="10"/>
                </s:layout>
                <s:HGroup verticalAlign="middle">
+                       <s:Label text="Select Flex version" width="200" 
fontFamily="openSansBold" />
+                       <s:DropDownList id="flexVersion"
+                                                       
dataProvider="{FLEX_VERSIONS}"
+                                                       labelField="label"
+                                                       width="200"
+                                                       
fontFamily="openSansSemibold"
+                                                       
change="handleFlexVersionChange(event)">
+                               <s:layout>
+                                       <s:VerticalLayout 
requestedRowCount="-1"/>
+                               </s:layout>
+                       </s:DropDownList>
+               </s:HGroup>
+               <s:HGroup verticalAlign="middle">
                        <s:Label text="Select AIR version" width="200" 
fontFamily="openSansBold" />
                        <s:DropDownList id="airVersion"
                                                        
dataProvider="{AIR_VERSIONS}"
@@ -1960,11 +2016,11 @@ variables are not required because the locations of 
these pieces are known.
        <s:Panel id="secondStepGroup"
                         
title="{_viewResourceConstants.INFO_LICENSE_AGREEMENTS}"
                         width="720"
-                        height="300"
-                        top="280"
+                        height="250"
+                        top="370"
                         visible="false"
                         visible.optionsState="true"
-                        backgroundAlpha="0">
+                        backgroundAlpha="0"> 
                <s:controlBarContent>
                        <s:Spacer
                                width="100%"/>
@@ -2017,16 +2073,16 @@ variables are not required because the locations of 
these pieces are known.
                                                        editable="false"/>
                        </s:VGroup>
                </s:HGroup>
-               <s:HGroup
+<!--           <s:HGroup
                        width="100%"
                        height="20"
                        horizontalAlign="center"
                        verticalAlign="middle">
                        <s:CheckBox id="installChkBx"
                                                
label="{_viewResourceConstants.INSTALL_AGREE_ALL}"
-                                               selected="false"
-                                               visible="false"/>
-               </s:HGroup>
+                                               selected="false" 
+                                               visible="true"/>
+               </s:HGroup>-->
        </s:Panel>
        <s:Panel id="thirdStepGroup"
                         title="{_viewResourceConstants.INFO_INSTALLING}"

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/67d965ba/installer/src/installer/sdk-installer-config-3.0.xml
----------------------------------------------------------------------
diff --git a/installer/src/installer/sdk-installer-config-3.0.xml 
b/installer/src/installer/sdk-installer-config-3.0.xml
index fd54701..f5f239c 100644
--- a/installer/src/installer/sdk-installer-config-3.0.xml
+++ b/installer/src/installer/sdk-installer-config-3.0.xml
@@ -35,13 +35,16 @@ limitations under the License.
         <!-- Mirror URL CGI -->
         <file name="MirrorURLCGI" path="" file="single-mirror-url.cgi"/>
 
+               <file name="FlexVersions" versions="4.10.0 RC1,4.9.1,Nightly" 
default="4.10.0 RC1" />
+
         <!-- Apache Flex binary distribution
              Notes:
-                 - path is relative to mirror URL
-                 - don't use starting slash
-                 - for the second and later releases, remove the extension 
from the file name -->
-         <file name="ApacheFlexSDK" path="flex/4.9.1/binaries/" 
file="apache-flex-sdk-4.9.1-bin"/> -->
-<!-- <file name="ApacheFlexSDK" 
path="https://builds.apache.org/job/flex-sdk_release/lastSuccessfulBuild/artifact/out/";
 file="apache-flex-sdk-4.10.0-bin" />  -->
+                 - path is relative to mirror URL; don't use starting slash
+                 - use http based url if you want to use an absolute url 
instead of mirror
+                 - remove the extension from the file name -->
+               <file name="4.10.0 RC1" 
path="https://dist.apache.org/repos/dist/dev/flex/sdk/4.10.0/rc1/binaries/"; 
file="apache-flex-sdk-4.10.0-bin"/>
+               <file name="4.9.1" path="flex/4.9.1/binaries/" 
file="apache-flex-sdk-4.9.1-bin"/>
+               <file name="Nightly" 
path="https://builds.apache.org/job/flex-sdk_release/lastSuccessfulBuild/artifact/out/";
 file="apache-flex-sdk-4.10.0-bin" /> 
 
         <!-- All the versions! -->
                <file name="Versions" 
airVersions="3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3.0,2.7,2.6" 
flashPlayerVersions="11.8,11.7,11.6,11.5,11.4,11.3,11.2,11.1,11.0,10.3,10.2" 
airDefault="3.7" flashPlayerDefault="11.7" /> 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/67d965ba/installer/src/ws/tink/spark/skins/controls/InstallApacheFlexSkin.mxml
----------------------------------------------------------------------
diff --git 
a/installer/src/ws/tink/spark/skins/controls/InstallApacheFlexSkin.mxml 
b/installer/src/ws/tink/spark/skins/controls/InstallApacheFlexSkin.mxml
index 8bdc5cf..99ee6d7 100644
--- a/installer/src/ws/tink/spark/skins/controls/InstallApacheFlexSkin.mxml
+++ b/installer/src/ws/tink/spark/skins/controls/InstallApacheFlexSkin.mxml
@@ -83,6 +83,8 @@ limitations under the License.
 
     <!-- layer 1: background fill -->
        <s:BitmapImage source="@Embed('/assets/icons/bg_logo.png')" top="0" 
left="0"  scaleMode="letterbox" />
+       <s:BitmapImage source="@Embed('/assets/icons/bg_logo.png')" top="25" 
left="0"  scaleMode="letterbox" />
+       <s:BitmapImage 
source="@Embed('assets/icons/apache_flex_logo_text.png')" scaleX=".3" 
scaleY=".3" smooth="true" horizontalCenter="0" top="5" />
 
     <!-- layer 2: content + status bar -->
     <s:Group left="0" right="0" top="0" bottom="0" minHeight="24" minWidth="0" 
>

Reply via email to