Repository: flex-utilities
Updated Branches:
  refs/heads/develop c6d5523e0 -> c3a906ffa


fix osmf download when not caching and no cache folder


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

Branch: refs/heads/develop
Commit: c3a906ffa6cce51168d3cde83b5e30e60ab519ad
Parents: c6d5523
Author: Alex Harui <[email protected]>
Authored: Thu Mar 6 23:42:47 2014 -0800
Committer: Alex Harui <[email protected]>
Committed: Thu Mar 6 23:42:47 2014 -0800

----------------------------------------------------------------------
 installer/src/InstallApacheFlex.mxml | 63 +++++++++++++++++--------------
 1 file changed, 35 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c3a906ff/installer/src/InstallApacheFlex.mxml
----------------------------------------------------------------------
diff --git a/installer/src/InstallApacheFlex.mxml 
b/installer/src/InstallApacheFlex.mxml
index e8e9816..022743b 100644
--- a/installer/src/InstallApacheFlex.mxml
+++ b/installer/src/InstallApacheFlex.mxml
@@ -106,7 +106,8 @@ variables are not required because the locations of these 
pieces are known.
         import mx.core.IFlexDisplayObject;
         import mx.events.FlexEvent;
         import mx.events.PropertyChangeEvent;
-        import mx.managers.PopUpManager;
+        import mx.managers.CursorManager;
+        import mx.managers.PopUpManager;        
         import mx.resources.ResourceBundle;
         import mx.rpc.events.FaultEvent;
         import mx.rpc.events.ResultEvent;
@@ -366,6 +367,8 @@ variables are not required because the locations of these 
pieces are known.
                }
                
                protected function 
handleApplicationComplete(event:FlexEvent):void {
+            CursorManager.setBusyCursor();
+            updateWindow();
                        loadXML();
                }
                
@@ -391,7 +394,8 @@ 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_DISPLAY]);
+            if (_viewResourceConstants)
+                       this.nativeWindow.title = 
StringUtil.substitute(_viewResourceConstants.INFO_WINDOW_TITLE, 
[APACHE_FLEX_BIN_DISTRO_VERSION_DISPLAY]);
                }
                
                protected function selectDefaultLanguage():void {
@@ -504,6 +508,7 @@ variables are not required because the locations of these 
pieces are known.
                 _viewResourceConstants.FETCH_MIRROR_CGI_ERROR);
             
             _mirrorURLUtil.getMirrorURL(Constants.APACHE_FLEX_URL + 
_mirrorURLCGI, getMirrorURLResultHandler);
+            CursorManager.removeBusyCursor();
                }
                
                protected function updateWindow():void {
@@ -1879,34 +1884,35 @@ variables are not required because the locations of 
these pieces are known.
                        var httpService:HTTPService = new HTTPService();
                        httpService.resultFormat = 
HTTPService.RESULT_FORMAT_TEXT;
                        url = httpService.url = 
Constants.SOURCEFORGE_DOWNLOAD_URL + OSMF_SWC_URL + OSMF_SWC_FILE;
-            var cacheURL:String;
-            if (url.indexOf("http") == 0)
-            {
-                var c:int = url.indexOf("/");
-                c = url.indexOf("/", c + 1);
-                c = url.indexOf("/", c + 1);
-                // that should find the slash after the server.
-                cacheURL = url.substr(c + 1);
-                if (debugMode)
-                    log("http caching.  url = " + cacheURL);                   
     
-            }
-            var cacheFile:File = 
File.applicationStorageDirectory.resolvePath(downloadCacheFolder);
-            cacheFile = cacheFile.resolvePath(cacheURL);
-            if (debugMode)
-                log("searching cache for " + cacheFile.url);                   
     
-            if (cacheFile.exists)
+            if (usingDownloadCache)
             {
+                var cacheURL:String;
+                if (url.indexOf("http") == 0)
+                {
+                    var c:int = url.indexOf("/");
+                    c = url.indexOf("/", c + 1);
+                    c = url.indexOf("/", c + 1);
+                    // that should find the slash after the server.
+                    cacheURL = url.substr(c + 1);
+                    if (debugMode)
+                        log("http caching.  url = " + cacheURL);               
         
+                }
+                var cacheFile:File = 
File.applicationStorageDirectory.resolvePath(downloadCacheFolder);
+                cacheFile = cacheFile.resolvePath(cacheURL);
                 if (debugMode)
-                    log("found file in cache");                        
-                url = cacheFile.url;
-                actuallyDownloadOSMF2SWC(new URLRequest(url));
-            }
-            else
-            {
-                       httpService.addEventListener(ResultEvent.RESULT, 
getMirrorInfo);
-                       httpService.addEventListener(FaultEvent.FAULT, 
handleOSMFSWCUnzipError);
-                       httpService.send();
+                    log("searching cache for " + cacheFile.url);               
         
+                if (cacheFile.exists)
+                {
+                    if (debugMode)
+                        log("found file in cache");                        
+                    url = cacheFile.url;
+                    actuallyDownloadOSMF2SWC(new URLRequest(url));
+                    return;
+                }
             }
+                       httpService.addEventListener(ResultEvent.RESULT, 
getMirrorInfo);
+                       httpService.addEventListener(FaultEvent.FAULT, 
handleOSMFSWCUnzipError);
+                       httpService.send();
                }
                
                protected function getMirrorInfo(event:ResultEvent):void
@@ -1928,7 +1934,8 @@ variables are not required because the locations of these 
pieces are known.
         {
                        loader = new URLLoader();
                        loader.dataFormat = URLLoaderDataFormat.BINARY;
-            loader.addEventListener(Event.COMPLETE, cacheOSMF2SWC);
+            if (usingDownloadCache)
+                loader.addEventListener(Event.COMPLETE, cacheOSMF2SWC);
                        loader.addEventListener(Event.COMPLETE, 
handleOSMFSWCFileDownloaded);
                        loader.addEventListener(ErrorEvent.ERROR, 
handleOSMFSWCInstallError);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, 
handleOSMFSWCInstallError);

Reply via email to