[Commits] r195 - sandbox/opengeo/drake/trunk/apps/drake

commits at geoext.org commits at geoext.org
Wed Feb 18 20:39:46 CET 2009


Author: tcoulter
Date: 2009-02-18 20:39:46 +0100 (Wed, 18 Feb 2009)
New Revision: 195

Added:
   sandbox/opengeo/drake/trunk/apps/drake/LayerTree.js
Modified:
   sandbox/opengeo/drake/trunk/apps/drake/LayerNodeUI.js
   sandbox/opengeo/drake/trunk/apps/drake/index.html
Log:
Moved the LayerTree to its own file per convention; also created zipped up all our featureStore.load() calls into one function for use later (DRY).

Modified: sandbox/opengeo/drake/trunk/apps/drake/LayerNodeUI.js
===================================================================
--- sandbox/opengeo/drake/trunk/apps/drake/LayerNodeUI.js	2009-02-18 18:01:49 UTC (rev 194)
+++ sandbox/opengeo/drake/trunk/apps/drake/LayerNodeUI.js	2009-02-18 19:39:46 UTC (rev 195)
@@ -49,51 +49,4 @@
         }
     }
 
-});
-
-
-
-GeoExt.tree.LayerTree = Ext.extend(Ext.tree.TreePanel, {
-    lines:false,
-    borderWidth: Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
-    cls:'gx-column-tree',
-
-    initComponent: function() {
-        this.addEvents("layeractivated");
-        GeoExt.tree.LayerTree.superclass.initComponent.call(this);
-    },
-    
-    onRender : function(){
-        GeoExt.tree.LayerTree.superclass.onRender.apply(this, arguments);
-        this.headers = this.body.createChild(
-            {cls:'gx-tree-headers'},this.innerCt.dom);
-
-        var cols = [{
-            header: 'Layer',
-            width: 250
-        },{
-            header: 'Query',
-            width: 60
-        }];
-
-        var c;
-        var totalWidth = 0;
-
-        for(var i = 0, len = cols.length; i < len; i++){
-             c = cols[i];
-             totalWidth += c.width;
-             this.headers.createChild({
-                 cls:'gx-tree-hd ' + (c.cls?c.cls+'-hd':''),
-                 cn: {
-                     cls:'gx-tree-hd-text',
-                     html: c.header
-                 },
-                 style:'width:'+(c.width-this.borderWidth)+'px;'
-             });
-        }
-        this.headers.createChild({cls:'x-clear'});
-        // prevent floats from wrapping when clipped
-        this.headers.setWidth(totalWidth);
-        this.innerCt.setWidth(totalWidth);
-    }
-});
+});
\ No newline at end of file

Added: sandbox/opengeo/drake/trunk/apps/drake/LayerTree.js
===================================================================
--- sandbox/opengeo/drake/trunk/apps/drake/LayerTree.js	                        (rev 0)
+++ sandbox/opengeo/drake/trunk/apps/drake/LayerTree.js	2009-02-18 19:39:46 UTC (rev 195)
@@ -0,0 +1,45 @@
+
+GeoExt.tree.LayerTree = Ext.extend(Ext.tree.TreePanel, {
+    lines:false,
+    borderWidth: Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
+    cls:'gx-column-tree',
+
+    initComponent: function() {
+        this.addEvents("layeractivated");
+        GeoExt.tree.LayerTree.superclass.initComponent.call(this);
+    },
+    
+    onRender : function(){
+        GeoExt.tree.LayerTree.superclass.onRender.apply(this, arguments);
+        this.headers = this.body.createChild(
+            {cls:'gx-tree-headers'},this.innerCt.dom);
+
+        var cols = [{
+            header: 'Layer',
+            width: 250
+        },{
+            header: 'Query',
+            width: 60
+        }];
+
+        var c;
+        var totalWidth = 0;
+
+        for(var i = 0, len = cols.length; i < len; i++){
+             c = cols[i];
+             totalWidth += c.width;
+             this.headers.createChild({
+                 cls:'gx-tree-hd ' + (c.cls?c.cls+'-hd':''),
+                 cn: {
+                     cls:'gx-tree-hd-text',
+                     html: c.header
+                 },
+                 style:'width:'+(c.width-this.borderWidth)+'px;'
+             });
+        }
+        this.headers.createChild({cls:'x-clear'});
+        // prevent floats from wrapping when clipped
+        this.headers.setWidth(totalWidth);
+        this.innerCt.setWidth(totalWidth);
+    }
+});

Modified: sandbox/opengeo/drake/trunk/apps/drake/index.html
===================================================================
--- sandbox/opengeo/drake/trunk/apps/drake/index.html	2009-02-18 18:01:49 UTC (rev 194)
+++ sandbox/opengeo/drake/trunk/apps/drake/index.html	2009-02-18 19:39:46 UTC (rev 195)
@@ -18,6 +18,7 @@
     <script type="text/javascript" src="../../core/lib/GeoExt.js"></script> 
     <script type="text/javascript" src="./AddLayerWindow.js"></script> 
     <script type="text/javascript" src="./CustomFilterBuilder.js"></script>
+    <script type="text/javascript" src="./LayerTree.js"></script>
     <script type="text/javascript" src="./LayerNodeUI.js"></script>
 
     <script>
@@ -209,12 +210,7 @@
                             this.featureStore.proxy.setOGCFilter(null);
                             this.filterBuilder.un("change", this.updateQueryFilter, this);
                         }
-                        this.grid.store.load({
-                            params: {
-                                start: 0,
-                                limit: this.featuresPerPage
-                            }
-                        }); 
+                        this.reloadFeatureStore();
                     },
                     scope: this
                 })] 
@@ -577,11 +573,15 @@
             this.grid.setTitle(typename + " - " + namespace);
             this.grid.colModel.setConfig(columnize(this.fields));
 
-            this.featureStore.load({params: {start: 0, limit: this.featuresPerPage}});
+            this.reloadFeatureStore();
         },
 
         updateQueryFilter: function(builder){
             this.featureStore.proxy.setOGCFilter(builder.getFilter());
+            this.reloadFeatureStore();
+        },
+        
+        reloadFeatureStore: function() {
             this.featureStore.load({params: {start: 0, limit: this.featuresPerPage}});
         }
     };



More information about the Commits mailing list