[Commits] r397 - apps/opengeo/geoexplorer/trunk/lib

commits at geoext.org commits at geoext.org
Wed Apr 15 09:49:20 CEST 2009


Author: tschaub
Date: 2009-04-15 09:49:20 +0200 (Wed, 15 Apr 2009)
New Revision: 397

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
Make sure capabilities are loaded before initializing cap grid.  Remove unused map init.

Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-15 07:28:37 UTC (rev 396)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-15 07:49:20 UTC (rev 397)
@@ -69,31 +69,30 @@
     load: function() {
         this.dispatch(
             [
+                // create layout as soon as Ext says ready
                 function(done) {
-                    Ext.onReady(
-                        function() {
-                            this.createLayout();
-                            done();
-                        },
-                        this
-                    );
+                    Ext.onReady(function() {
+                        this.createLayout();
+                        done();
+                    }, this);
                 },
+                // load capabilities immediately
                 function(done) {
-                    this.initCapabilities(done);
+                    this.initCapabilities();
+                    this.capabilities.load({
+                        callback: done
+                    });
                 },
             ],
+            // activate app when the above are both done
             this.activate
         );
     },
     
     /**
      * Method: initCapabilities
-     *
-     * Parameters:
-     * callback - {Function} Function to be called when capabilties store is loaded.
      */
-    initCapabilities: function(callback) {
-        
+    initCapabilities: function() {        
         var urlObj = OpenLayers.Util.createUrlObject(this.ows);
         var url = urlObj.protocol + "//" +
             urlObj.host + urlObj.pathname + "?" +
@@ -102,16 +101,7 @@
                 REQUEST: "GetCapabilities"
             }));
         
-        this.capabilities = new GeoExt.data.WMSCapabilitiesStore({
-            url: url,
-            listeners: {
-                load: {
-                    fn: callback,
-                    single: true
-                }
-            }
-        });
-        this.capabilities.load();
+        this.capabilities = new GeoExt.data.WMSCapabilitiesStore({url: url});
     },
     
     /**
@@ -253,31 +243,6 @@
     },
     
     /**
-     * Method: initMap
-     * Construct the map and reference it on the applicaiton as <map>.
-     */
-    initMap: function() {
-        // TODO: check this.initialConfig.map for any map options
-        this.map = new OpenLayers.Map({
-            allOverlays: true,
-            controls: []
-        });
-
-        //TODO: make this more configurable
-        this.map.events.on({
-            "preaddlayer" : function(evt){
-                if(evt.layer.mergeNewParams){
-                    evt.layer.mergeNewParams({
-                        transparent: true,
-                        format: "image/png"
-                    });
-                }
-            },
-            scope : this
-        });
-    },
-    
-    /**
      * Method: addLayers
      * Construct the layer store to be used with the map (referenced as <layers>).
      */



More information about the Commits mailing list