[Commits] r1051 - apps/opengeo/geoexplorer/branches/0.1.x/lib

commits at geoext.org commits at geoext.org
Thu Jun 11 23:54:45 CEST 2009


Author: tschaub
Date: 2009-06-11 23:54:44 +0200 (Thu, 11 Jun 2009)
New Revision: 1051

Modified:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
Log:
Use actions instead of writing toggle handlers.

Modified: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-11 21:47:48 UTC (rev 1050)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-11 21:54:44 UTC (rev 1051)
@@ -577,9 +577,19 @@
 
     createTools: function() {
 
+        var toolGroup = "toolGroup";
+
         // create a navigation control
-        var navControl = new OpenLayers.Control.Navigation();
-        this.map.addControl(navControl);        
+        var navAction = new GeoExt.Action({
+            tooltip: "Pan Map",
+            iconCls: "icon-pan",
+            enableToggle: true,
+            pressed: true,
+            allowDepress: false,
+            control: new OpenLayers.Control.Navigation(),
+            map: this.map,
+            toggleGroup: toolGroup
+        });
         
         // create a navigation history control
         var historyControl = new OpenLayers.Control.NavigationHistory();
@@ -588,7 +598,6 @@
         // create actions for previous and next
         var navPreviousAction = new GeoExt.Action({
             tooltip: "Zoom to Previous Extent",
-            text: "previous",
             iconCls: "icon-zoom-previous",
             disabled: true,
             control: historyControl.previous
@@ -596,13 +605,11 @@
         
         var navNextAction = new GeoExt.Action({
             tooltip: "Zoom to Next Extent",
-            text: "next",
             iconCls: "icon-zoom-next",
             disabled: true,
             control: historyControl.next
         });
         
-        var toolGroup = "toolGroup";
         
         // create a get feature info control
         var info = {controls: []};
@@ -662,7 +669,6 @@
         this.mapPanel.layers.on("remove", updateInfo, this);
 
         // create split button for measure controls
-        // (replacement candidate for MapToolSplitToggle)
         var activeIndex = 0;
         var measureSplit = new Ext.SplitButton({
             iconCls: "icon-measure-length",
@@ -749,22 +755,7 @@
                 iconCls: "icon-save"
             }),
             "-",
-            new Ext.Button({
-                tooltip: "Pan Map",
-                iconCls: "icon-pan",
-                enableToggle: true,
-                pressed: true,
-                allowDepress: false,
-                toggleGroup: toolGroup,
-                toggleHandler: function(b, pressed) {
-                    if(pressed) {
-                        navControl.activate();
-                    } else {
-                        navControl.deactivate();
-                    }
-                },
-                scope: this
-            }),
+            navAction,
             infoButton,
             measureSplit,
             "-",



More information about the Commits mailing list