[Commits] r985 - in apps/opengeo/geoexplorer/branches/0.1.x/lib: . GeoExplorer

commits at geoext.org commits at geoext.org
Thu Jun 4 20:15:16 CEST 2009


Author: tschaub
Date: 2009-06-04 20:15:16 +0200 (Thu, 04 Jun 2009)
New Revision: 985

Added:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/util.js
Removed:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/Viewer.js
Modified:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
Log:
Make GeoExplorer the base and push dispatch into util.

Added: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/util.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/util.js	                        (rev 0)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/util.js	2009-06-04 18:15:16 UTC (rev 985)
@@ -0,0 +1,43 @@
+Ext.namespace("GeoExplorer");
+
+GeoExplorer.util = {
+
+    /**
+     * Method: dispatch
+     * Allows multiple asynchronous sequences to be called in parallel.  A final
+     *     callback is called when all other sequences report that they are done.
+     * 
+     * Parameters:
+     * functions - {Array(Function)} List of functions to be called.  All
+     *     functions will be called with two arguments - a callback to call when
+     *     the sequence is done and a storage object
+     * complete - {Function} A function that will be called when all other
+     *     functions report that they are done.  The final callback will be
+     *     called with the storage object passed to all other functions.
+     * scope - {Object} Optional object to be set as the scope of all functions
+     *     called.
+     */
+    dispatch: function(functions, complete, scope) {
+        complete = complete || Ext.emptyFn;
+        scope = scope || this;
+        var requests = functions.length;
+        var responses = 0;
+        var storage = {};
+        function respond() {
+            ++responses;
+            if(responses === requests) {
+                complete.call(scope, storage);
+            }
+        }
+        function trigger(index) {
+            window.setTimeout(function() {
+                functions[index].apply(scope, [respond, storage]);
+            });
+        }
+        for(var i=0; i<requests; ++i) {
+            trigger(i);
+        }
+    }
+
+
+};
\ No newline at end of file

Modified: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-04 18:10:05 UTC (rev 984)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-04 18:15:16 UTC (rev 985)
@@ -27,11 +27,8 @@
  * Valid layer config properties:
  * name - {String} Required WMS layer name.
  * title - {String} Optional title to display for layer.
- *
- * Extends:
- *  - Viewer
  */
-var GeoExplorer = Ext.extend(Viewer, {
+var GeoExplorer = Ext.extend(Ext.util.Observable, {
     
     /**
      * Property: map
@@ -76,15 +73,44 @@
      * {Object} An object containing references to visible popups so that 
      *     we can insert responses from multiple requests.
      */
-    popupCache: {},
+    popupCache: null,
 
+    constructor: function(config) {
+
+        var query = Ext.urlDecode(document.location.search.substr(1));
+        var queryConfig = Ext.util.JSON.decode(query.q);
+        
+        this.initialConfig = Ext.apply({}, queryConfig, config);
+        Ext.apply(this, this.initialConfig);
+
+        // add any custom application events
+        this.addEvents(
+            /**
+             * Event: ready
+             * Fires when application is ready for user interaction.
+             */
+            "ready"
+        );
+        
+        // pass on any proxy config to OpenLayers
+        if(this.proxy) {
+            OpenLayers.ProxyHost = this.proxy;
+        }
+        
+        this.popupCache = {};
+        
+        this.load();
+        
+    },
+    
+
     /**
      * Method: load
      * Called at the end of construction.  This initiates the sequence that
      *     prepares the application for use.
      */
     load: function() {
-        this.dispatch(
+        GeoExplorer.util.dispatch(
             [
                 // create layout as soon as Ext says ready
                 function(done) {
@@ -102,7 +128,7 @@
                 }
             ],
             // activate app when the above are both done
-            this.activate
+            this.activate, this
         );
     },
     

Deleted: apps/opengeo/geoexplorer/branches/0.1.x/lib/Viewer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/Viewer.js	2009-06-04 18:10:05 UTC (rev 984)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/Viewer.js	2009-06-04 18:15:16 UTC (rev 985)
@@ -1,89 +0,0 @@
-/**
- * Copyright (c) 2008 The Open Planning Project
- */
-
-/**
- * Constructor: Viewer
- * Create a new Viewer application.
- *
- * Parameters:
- * config - {Object} Optional application configuration properties.
- *
- * Extends:
- *  - Ext.util.Observable
- */
-var Viewer = Ext.extend(Ext.util.Observable, {
-    
-    /**
-     * Constructor: Viewer
-     */
-    constructor: function(config) {
-
-        var query = Ext.urlDecode(document.location.search.substr(1));
-        var queryConfig = Ext.util.JSON.decode(query.q);
-        
-        this.initialConfig = Ext.apply({}, queryConfig, config);
-        Ext.apply(this, config);
-
-        // add any custom application events
-        this.addEvents(
-            /**
-             * Event: ready
-             * Fires when application is ready for user interaction.
-             */
-            "ready"
-        );
-        
-        // pass on any proxy config to OpenLayers
-        if(this.proxy) {
-            OpenLayers.ProxyHost = this.proxy;
-        }
-        
-        this.load();
-        
-    },
-    
-    /**
-     * Method: load
-     * Called to load the application.  Implemented by a subclass.
-     */
-    load: Ext.emptyFn,
-
-    /**
-     * Method: dispatch
-     * Allows multiple asynchronous sequences to be called in parallel.  A final
-     *     callback is called when all other sequences report that they are done.
-     * 
-     * Parameters:
-     * functions - {Array(Function)} List of functions to be called.  All
-     *     functions will be called with two arguments - a callback to call when
-     *     the sequence is done and a storage object
-     * complete - {Function} A function that will be called when all other
-     *     functions report that they are done.  The final callback will be
-     *     called with the storage object passed to all other functions.
-     * scope - {Object} Optional object to be set as the scope of all functions
-     *     called.
-     */
-    dispatch: function(functions, complete, scope) {
-        complete = complete || Ext.emptyFn;
-        scope = scope || this;
-        var requests = functions.length;
-        var responses = 0;
-        var storage = {};
-        function respond() {
-            ++responses;
-            if(responses === requests) {
-                complete.call(scope, storage);
-            }
-        }
-        function trigger(index) {
-            window.setTimeout(function() {
-                functions[index].apply(scope, [respond, storage]);
-            });
-        }
-        for(var i=0; i<requests; ++i) {
-            trigger(i);
-        }
-    }
-    
-});
\ No newline at end of file



More information about the Commits mailing list