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

commits at geoext.org commits at geoext.org
Thu Apr 9 19:03:13 CEST 2009


Author: tschaub
Date: 2009-04-09 19:03:13 +0200 (Thu, 09 Apr 2009)
New Revision: 371

Modified:
   apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
Enable and disable navigation history controls as appropriate states become available or unavailable.

Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-09 07:27:40 UTC (rev 370)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js	2009-04-09 17:03:13 UTC (rev 371)
@@ -260,6 +260,39 @@
         
         // create a navigation history control
         var historyControl = new OpenLayers.Control.NavigationHistory();
+        // create buttons for previous and next
+        var navPreviousButton = new Ext.Button({
+            tooltip: "Zoom to Previous Extent",
+            iconCls: "icon-zoom-previous",
+            disabled: true,
+            handler: function() {
+                historyControl.previous.trigger();
+            }
+        });
+        historyControl.previous.events.on({
+            activate: function() {
+                navPreviousButton.enable();
+            },
+            deactivate: function() {
+                navPreviousButton.disable();
+            }
+        });
+        var navNextButton = new Ext.Button({
+            tooltip: "Zoom to Next Extent",
+            iconCls: "icon-zoom-next",
+            disabled: true,
+            handler: function() {
+                historyControl.next.trigger();
+            }
+        });
+        historyControl.next.events.on({
+            activate: function() {
+                navNextButton.enable();
+            },
+            deactivate: function() {
+                navNextButton.disable();
+            }
+        });
         this.map.addControl(historyControl);
         
         // create a get feature info control
@@ -351,21 +384,9 @@
                 iconCls: "icon-zoom-out",
                 scope: this
             }),
+            navPreviousButton,
+            navNextButton,
             new Ext.Button({
-                tooltip: "Zoom to Previous Extent",
-                iconCls: "icon-zoom-previous",
-                handler: function() {
-                    historyControl.previous.trigger();
-                }
-            }),
-            new Ext.Button({
-                tooltip: "Zoom to Next Extent",
-                iconCls: "icon-zoom-next",
-                handler: function() {
-                    historyControl.next.trigger();
-                }
-            }),
-            new Ext.Button({
                 tooltip: "Zoom to Visible Extent",
                 iconCls: "icon-zoom-visible",
                 handler: function() {



More information about the Commits mailing list