[Commits] r1742 - sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Wed Jan 13 23:39:12 CET 2010
Author: ahocevar
Date: 2010-01-13 23:39:12 +0100 (Wed, 13 Jan 2010)
New Revision: 1742
Modified:
sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/widgets/PrintExtent.js
Log:
improved comments, made printCapabilities optional if pages are provided, added fitMap method.
Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/widgets/PrintExtent.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/widgets/PrintExtent.js 2010-01-13 22:11:55 UTC (rev 1741)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/widgets/PrintExtent.js 2010-01-13 22:39:12 UTC (rev 1742)
@@ -26,13 +26,18 @@
* },
* items: [{
* xtype: "gx_printextent",
- * printProvider: new GeoExt.data.PrintProvider({
- * capabilities: printCapabilities
- * })
+ * pages: [new GeoExt.data.PrintPage({
+ * printProvider: new GeoExt.data.PrintProvider({
+ * capabilities: printCapabilities
+ * })
+ * })]
* }]
* });
+ * var printExtent = mapPanel.items.get(0);
+ * // fit print extent to current map extent
+ * printExtent.fitMap(printExtent.pages[0]);
* // print the map
- * mapPanel.items.get(0).print();
+ * printExtent.print();
*/
/** api: constructor
@@ -47,7 +52,7 @@
/** api: config[printProvider]
* :class:`GeoExt.data.PrintProvider` The print provider this form
- * is connected to.
+ * is connected to. Optional if pages are provided.
*/
/** api: property[printProvider]
@@ -81,11 +86,13 @@
/** api: config[pages]
* Array of :class:`GeoExt.data.PrintPage` The pages that this form
* controls. Optional, will be created if not provided.
+ *
+ * .. note:: All pages must use the same PrintProvider.
*/
/** api: property[pages]
* Array of :class:`GeoExt.data.PrintPage` The pages that this form
- * controls.
+ * controls. Read-only.
*/
pages: null,
@@ -96,6 +103,9 @@
if(!this.pages) {
this.pages = [];
}
+ if(!this.printProvider) {
+ this.printProvider = this.pages[0].printProvider;
+ }
},
/** api: method[print]
@@ -108,6 +118,15 @@
this.printProvider.print(this.map, this.pages, options);
},
+ /** api: method[fitMap]
+ * :param page: class:`GeoExt.data.PrintPage`
+ *
+ * Fits a print page to the current map extent.
+ */
+ fitMap: function(page) {
+ page.fit(this.map);
+ },
+
/** private: method[addToMapPanel]
* :param mapPanel: class:`GeoExt.MapPanel`
*/
More information about the Commits
mailing list