Download OSMF both SWC and SWF file

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

Branch: refs/heads/develop
Commit: 502a365b14e974178e9aa3ffb1f23e6177d7561f
Parents: a4a2d57
Author: Justin Mclean <[email protected]>
Authored: Mon Sep 30 08:04:39 2013 +1000
Committer: Justin Mclean <[email protected]>
Committed: Mon Sep 30 08:04:39 2013 +1000

----------------------------------------------------------------------
 installer/src/InstallApacheFlex.mxml | 128 ++++++++++++++++++------------
 1 file changed, 78 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/502a365b/installer/src/InstallApacheFlex.mxml
----------------------------------------------------------------------
diff --git a/installer/src/InstallApacheFlex.mxml 
b/installer/src/InstallApacheFlex.mxml
index 5fbd726..ddd5cf5 100644
--- a/installer/src/InstallApacheFlex.mxml
+++ b/installer/src/InstallApacheFlex.mxml
@@ -41,8 +41,8 @@ variables are not required because the locations of these 
pieces are known.
                                           
skinClass="ws.tink.spark.skins.controls.InstallApacheFlexSkin"
                                           
xmlns:controls="ws.tink.spark.controls.*"
                                           
xmlns:controls1="org.apache.flex.packageflexsdk.view.controls.*"
-                                          
xmlns:components="org.apache.flex.packageflexsdk.view.components.*" 
xmlns:controls2="org.apache.flex.utilities.common.controls.*"
-                                          >
+                                          
xmlns:components="org.apache.flex.packageflexsdk.view.components.*"
+                                          
xmlns:controls2="org.apache.flex.utilities.common.controls.*">
        
        <fx:Style source="assets/styles/ApacheFlexToolsStyle.css"/>
        <fx:Style source="assets/styles/InstallApacheFlexStyle.css"/> 
@@ -151,8 +151,10 @@ variables are not required because the locations of these 
pieces are known.
                 * Optional installs
                 *
                 */
-               private var OSMF_FILE:String;
-               private var OSMF_URL:String;
+               private var OSMF_SWF_FILE:String;
+               private var OSMF_SWF_URL:String;
+               private var OSMF_SWC_FILE:String;
+               private var OSMF_SWC_URL:String;
                
                private var BLAZEDS_FILE:String;
                private var BLAZEDS_URL:String;
@@ -184,7 +186,8 @@ variables are not required because the locations of these 
pieces are known.
                private var _aglj40JarFile:File;
                private var _flexFontKitJarFile:File;
                private var _rideauJarFile:File;
-               private var _osmfFile:File;
+               private var _osmfSWCFile:File;
+               private var _osmfSWFFile:File;
                
                private var _os:String;
                private var _loader:URLLoader;
@@ -373,7 +376,7 @@ variables are not required because the locations of these 
pieces are known.
                                request = new URLRequest(configOverride);
                        } else {
                                request = new 
URLRequest(Constants.APACHE_FLEX_URL + Constants.CONFIG_XML_NAME);
-//                             request = new 
URLRequest(Constants.CONFIG_XML_NAME);
+                               //                              request = new 
URLRequest(Constants.CONFIG_XML_NAME);
                        }
                        
                        _loader = new URLLoader();
@@ -509,8 +512,10 @@ variables are not required because the locations of these 
pieces are known.
                        SWF_OBJECT_FILE = files.(@name == 
'swfobject')[email protected]();
                        SWF_OBJECT_URL = files.(@name == 
'swfobject')[email protected]();
                        
-                       OSMF_FILE = files.(@name == 'OSMF')[email protected]();
-                       OSMF_URL = files.(@name == 'OSMF')[email protected]();
+                       OSMF_SWC_FILE = files.(@name == 
'OSMF_SWC')[email protected]();
+                       OSMF_SWC_URL = files.(@name == 
'OSMF_SWC')[email protected]();
+                       OSMF_SWF_FILE = files.(@name == 
'OSMF_SWF')[email protected]();
+                       OSMF_SWF_URL = files.(@name == 
'OSMF_SWF')[email protected]();
                        
                        BLAZEDS_FILE = files.(@name == 
'BlazeDS')[email protected]();
                        BLAZEDS_URL = files.(@name == 
'BlazeDS')[email protected]();
@@ -526,7 +531,7 @@ variables are not required because the locations of these 
pieces are known.
                        
                        RIDEAU_FILE = files.(@name == 
'rideau')[email protected]();
                        RIDEAU_URL = files.(@name == 'rideau')[email protected]();
-
+                       
                        
                        return keepGoing;
                }
@@ -1348,15 +1353,31 @@ variables are not required because the locations of 
these pieces are known.
                }
                
                protected function downloadOSMFFile():void {
-                       
log(StringUtil.substitute(_viewResourceConstants.INFO_DOWNLOADING_FILE_FROM, 
[OSMF_FILE, OSMF_URL]));
-                       _osmfFile = File.userDirectory.resolvePath(_flexTemp + 
File.separator + OSMF_FILE);
-                       copyOrDownload(OSMF_URL + OSMF_FILE, 
handleOSMFFileDownloaded, null, handleOSMFInstallError);
+                       
log(StringUtil.substitute(_viewResourceConstants.INFO_DOWNLOADING_FILE_FROM, 
[OSMF_SWF_FILE, OSMF_SWF_URL]));
+                       _osmfSWFFile = File.userDirectory.resolvePath(_flexTemp 
+ File.separator + OSMF_SWF_FILE);
+                       copyOrDownload(OSMF_SWF_URL + OSMF_SWF_FILE, 
handleOSMFSWFFileDownloaded, null, handleOSMFSWFInstallError);
+                       
+                       
log(StringUtil.substitute(_viewResourceConstants.INFO_DOWNLOADING_FILE_FROM, 
[OSMF_SWC_FILE, OSMF_SWC_URL]));
+                       _osmfSWCFile = File.userDirectory.resolvePath(_flexTemp 
+ File.separator + OSMF_SWC_FILE);
+                       copyOrDownload(OSMF_SWC_URL + OSMF_SWC_FILE, 
handleOSMFSWCFileDownloaded, null, handleOSMFSWCInstallError);
+               }
+               
+               protected function 
handleOSMFSWFFileDownloaded(event:Event):void {
+                       try {
+                               writeFileToDirectory(_osmfSWFFile, 
event.target.data);
+                               copyFileToLibDir(_osmfSWFFile);
+                               clearData(URLLoader(event.target));
+                       } catch (e:Error) {
+                               
updateActivityStep(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF, 
StepItem.ERROR);
+                               
updateOptionalComponentInstallStatusAborted(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF,
 true);
+                               abortInstallation();
+                       }
                }
                
-               protected function handleOSMFFileDownloaded(event:Event):void {
+               protected function 
handleOSMFSWCFileDownloaded(event:Event):void {
                        try {
-                               writeFileToDirectory(_osmfFile, 
event.target.data);
-                               copyFileToLibDir(_osmfFile);
+                               writeFileToDirectory(_osmfSWCFile, 
event.target.data);
+                               copyFileToLibDir(_osmfSWCFile);
                                clearData(URLLoader(event.target));
                                
                                
updateOptionalComponentInstallStatus(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF,
 true);
@@ -1396,10 +1417,17 @@ variables are not required because the locations of 
these pieces are known.
                        installNextOptionalComponent();
                }
                
-               protected function handleOSMFInstallError(event:* = null):void {
+               protected function handleOSMFSWFInstallError(event:* = 
null):void {
+                       
updateActivityStep(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF, 
StepItem.ERROR);
+                       
updateOptionalComponentInstallStatusAborted(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF,
 true);
+                       
log(StringUtil.substitute(_viewResourceConstants.ERROR_UNABLE_TO_DOWNLOAD_FILE, 
["OSMF_SWF"]));
+                       installNextOptionalComponent();
+               }
+               
+               protected function handleOSMFSWCInstallError(event:* = 
null):void {
                        
updateActivityStep(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF, 
StepItem.ERROR);
                        
updateOptionalComponentInstallStatusAborted(_viewResourceConstants.STEP_REQUIRED_INSTALL_OSMF,
 true);
-                       
log(StringUtil.substitute(_viewResourceConstants.ERROR_UNABLE_TO_DOWNLOAD_FILE, 
["OSMF"]));
+                       
log(StringUtil.substitute(_viewResourceConstants.ERROR_UNABLE_TO_DOWNLOAD_FILE, 
["OSMF_SWC"]));
                        installNextOptionalComponent();
                }
                
@@ -1511,15 +1539,15 @@ 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;
-                               } else {
-                                       installChkBx.selected = false;
-                               }
+                       if (selectedItem.selected) {
+                       installChkBx.selected = true;
+                       } else {
+                       installChkBx.selected = false;
+                       }
                        } else {
-                               installChkBx.selected = false;
+                       installChkBx.selected = false;
                        }*/
                        
                        licenseLinkBtn.includeInLayout = true;
@@ -1941,23 +1969,23 @@ variables are not required because the locations of 
these pieces are known.
                        </s:layout>
                </s:DropDownList>
        </s:HGroup>
-<!--   <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="70"
-                                        />
-               </s:HGroup>
-<!--   </s:Group>-->
+       <!--    <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="70"
+                                />
+       </s:HGroup>
+       <!--    </s:Group>-->
        <s:Panel id="zeroStepGroup"
                         
title="{_viewResourceConstants.INFO_SELECT_AIR_FLASH_PLAYER}"
                         width="640"
@@ -2121,15 +2149,15 @@ variables are not required because the locations of 
these pieces are known.
                                                        editable="false"/>
                        </s:VGroup>
                </s:HGroup>
-<!--           <s:HGroup
-                       width="100%"
-                       height="20"
-                       horizontalAlign="center"
-                       verticalAlign="middle">
-                       <s:CheckBox id="installChkBx"
-                                               
label="{_viewResourceConstants.INSTALL_AGREE_ALL}"
-                                               selected="false" 
-                                               visible="true"/>
+               <!--            <s:HGroup
+               width="100%"
+               height="20"
+               horizontalAlign="center"
+               verticalAlign="middle">
+               <s:CheckBox id="installChkBx"
+               label="{_viewResourceConstants.INSTALL_AGREE_ALL}"
+               selected="false" 
+               visible="true"/>
                </s:HGroup>-->
        </s:Panel>
        <s:Panel id="thirdStepGroup"

Reply via email to