[Webflysuesk-commits] r63 - in webflysuesk/branches/openlayers-integration: . webflys/src/main/webapp/pages

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 14 17:45:03 CEST 2009


Author: iweinzierl
Date: 2009-07-14 17:45:03 +0200 (Tue, 14 Jul 2009)
New Revision: 63

Modified:
   webflysuesk/branches/openlayers-integration/ChangeLog.txt
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/app.jsp
   webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
Log:
Window is locked and an icon is displayed while ajax requests are loading. Not sensitive to map activities yet.

Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-07-14 10:27:11 UTC (rev 62)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt	2009-07-14 15:45:03 UTC (rev 63)
@@ -1,5 +1,12 @@
 2009-07-14  Ingo Weinzierl <ingo.weinzierl at intevation.de>
 
+	* webflys/src/main/webapp/pages/karte.js,
+	  webflys/src/main/webapp/pages/app.jsp: The window is locked and an icon is
+	  displayed while loading ajax requests. This is not sensitive to requests
+	  from OpenLayers.
+
+2009-07-14  Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
 	* webflys/src/main/webapp/pages/entrance.jsp: The entrance page got
 	  default-values for a nice presentation.
 

Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/app.jsp
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/app.jsp	2009-07-14 10:27:11 UTC (rev 62)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/app.jsp	2009-07-14 15:45:03 UTC (rev 63)
@@ -50,11 +50,48 @@
         <script type="text/javascript">
             <!-- 
             var $j = jQuery.noConflict();
+
+            // global variable to count the running ajax requests
+            var ajaxLoads = 0;
+
+            function increaseAjaxCounter() {
+                // display load-icon
+                if(ajaxLoads == 0) {
+                    $j(document.body).find('#loadingWindow').each(function(){
+                        // set size
+                        $j(this).css('width', window.outerWidth);
+                        $j(this).css('height', window.outerHeight);
+
+                        // set location
+                        $j(this).css('-moz-opacity', 0.5);
+                        $j(this).css('position', 'absolute');
+                        $j(this).css('top', '0px');
+                        $j(this).css('left', '0px');
+
+                        // display
+                        $j(this).css('visibility', 'visible');
+                    });
+                }
+                ++ajaxLoads;
+            }
+
+            function decreaseAjaxCounter() {
+                --ajaxLoads;
+
+                // hide load-icon
+                if(ajaxLoads == 0) {
+                    $j(document.body).find('#loadingWindow').each(function() {
+                        $j(this).css('visibility', 'hidden');
+                    });
+                }
+
+            }
             -->
         </script>
     </head>
 
 	<body>
+
         <div id="olbanner" style="height: 85px; margin: 10px 0px;">
             <a href="index.html" alt="Startseite" title="Startseite">
                 WebFLYS.next generation
@@ -93,5 +130,11 @@
             </fieldset>
         </div>
 
+        <div id="loadingWindow" style="visibility: hidden; background-color: grey; z-index: 9999;">
+            <img src="./OpenLayers/theme/default/img/loading.gif"
+                style="width: 25px; height: 25px; border: solid 1px black;
+                       position: relative; top: 50%; left: 50%;">
+        </div>
+
     </body>
 </html:html>

Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-07-14 10:27:11 UTC (rev 62)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/karte.js	2009-07-14 15:45:03 UTC (rev 63)
@@ -17,12 +17,14 @@
  */
 function createMapForRiver() {
     // fetch the BoundingBox from Servlet via XML HTTP-Request
+    increaseAjaxCounter();
     $j.ajax( {
         url: 'http://beige.rgb:8080/webflys/bbox',
         type: 'GET',
         dataType: 'xml',
         error: function(error) {
             alert('Error loading boundingbox: ' + error);
+            decreaseAjaxCounter();
         },
         // on success create a new map with this BoundingBox
         success: function( xml ) {
@@ -39,6 +41,7 @@
                 // add Start/End-Feature
                 initInteraktiveStreckenauswahl();
             });
+            decreaseAjaxCounter();
         }
     });
 }
@@ -253,6 +256,7 @@
 
     var gew = null;
 
+    increaseAjaxCounter();
     $j.ajax({
         type    :'GET',
         url     :'http://beige.rgb:8080/webflys/getGewaesser',
@@ -260,11 +264,13 @@
         dataType: 'xml',
         error   : function(error) {
                       alert('Error loading gewaesser: ' + error);
+                      decreaseAjaxCounter();
         },
         success : function(xml) {
             $j(xml).find('gewaesser').each(function() {
                 gew = $j(this).text();
             });
+            decreaseAjaxCounter();
         }
     });
 
@@ -283,6 +289,7 @@
 
     var uid = null;
 
+    increaseAjaxCounter();
     $j.ajax({
         type    : 'GET',
         url     : 'http://beige.rgb:8080/webflys/userId',
@@ -290,11 +297,13 @@
         dataType: 'xml',
         error   : function(error) {
             alert('Error loading UserId: ' + error);
+            decreaseAjaxCounter();
         },
         success: function(xml) {
             $j(xml).find('user-name').each(function() {
                 uid = $j(this).text();
             });
+            decreaseAjaxCounter();
         }
     });
 
@@ -363,6 +372,8 @@
     filterBody = xmlFormat.write(filter_1_0.write(filter));
 
     var final_filter = filterHead+filterBody+filterFoot;
+
+    increaseAjaxCounter();
     var req = new OpenLayers.Request.POST({
         method  : 'POST',
         url     : 'http://beige.rgb:8080/geoserver/wfs',
@@ -401,6 +412,8 @@
     for(var i = 0; i < features.length; ++i) {
         usk_layer.addFeatures([features[i]]);
     }
+
+    decreaseAjaxCounter();
 }
 
 
@@ -474,6 +487,7 @@
         var content = '<font color="red">Keine Berechnungsergebnisse für den aktuellen Benutzer vorhanden.</font>';
         $j('#results').append(content);
     }
+    decreaseAjaxCounter();
 }
 
 



More information about the Webflysuesk-commits mailing list