[Commits] r1753 - in sandbox/ahocevar/playground/ux/Printing: examples ux/widgets/form

commits at geoext.org commits at geoext.org
Fri Jan 15 12:20:01 CET 2010


Author: ahocevar
Date: 2010-01-15 12:20:01 +0100 (Fri, 15 Jan 2010)
New Revision: 1753

Modified:
   sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.html
   sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.js
   sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js
Log:
added autoFit option

Modified: sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.html
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.html	2010-01-15 01:55:17 UTC (rev 1752)
+++ sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.html	2010-01-15 11:20:01 UTC (rev 1753)
@@ -6,7 +6,7 @@
         <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/ext-all.js"></script>
         <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
         <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
-        <script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+        <script src="http://www.openlayers.org/dev/OpenLayers.js"></script>
         <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
         
         <!-- script resources for this ux -->

Modified: sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.js	2010-01-15 01:55:17 UTC (rev 1752)
+++ sandbox/ahocevar/playground/ux/Printing/examples/SimplePrint.js	2010-01-15 11:20:01 UTC (rev 1753)
@@ -74,6 +74,7 @@
     printForm = new GeoExt.ux.form.SimplePrint({
         mapPanel: mapPanel,
         layer: extentLayer, // optional
+        autoFit: true,
         printProvider: printProvider,
         bodyStyle: {padding: "5px"},
         labelWidth: 65,
@@ -122,7 +123,6 @@
      */
     formCt.add(printForm);
     formCt.doLayout();
-    printForm.page.fit(mapPanel.map);
 
     /* use this code block instead of the above one if you configured the
      * printProvider with url instead of capabilities
@@ -132,7 +132,6 @@
         myMask.hide();
         formCt.add(printForm);
         formCt.doLayout();
-        printForm.page.fit(mapPanel.map);
     });
      */
     

Modified: sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js	2010-01-15 01:55:17 UTC (rev 1752)
+++ sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js	2010-01-15 11:20:01 UTC (rev 1753)
@@ -136,6 +136,13 @@
                 single: true
             });
         }
+        
+        if(this.autoFit === true) {
+            this.mapPanel.map.events.on({
+                "moveend": this.onMoveend,
+                scope: this
+            })
+        }
     },
     
     /** private: method[initForm]
@@ -206,12 +213,25 @@
         this.doLayout();
     },
     
+    /** private: method[onMoveend]
+     *  Handler for the map's moveend event
+     */
+    onMoveend: function() {
+        this.page.fit(this.mapPanel.map);
+    },
+    
     /** private: method[beforeDestroy]
      */
     beforeDestroy: function() {
         var p = this.printExtent.printProvider;
         p.un("beforePrint", this.busyMask.show, this.busyMask);
         p.un("print", this.busyMask.hide, this.busyMask);
+        if(this.autoFit === true) {
+            this.mapPanel.map.events.un({
+                "moveend": this.onMoveend,
+                scope: this
+            })
+        }
         GeoExt.SimplePrint.superclass.beforeDestroy.apply(this, arguments);
     }
     



More information about the Commits mailing list