[Commits] r1575 - in sandbox/ahocevar/playground/ux/Printing: . ux/widgets/form
commits at geoext.org
commits at geoext.org
Fri Dec 11 18:10:22 CET 2009
Author: ahocevar
Date: 2009-12-11 18:10:22 +0100 (Fri, 11 Dec 2009)
New Revision: 1575
Modified:
sandbox/ahocevar/playground/ux/Printing/license.txt
sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/PrintForm.js
Log:
made layer of PrintForm configurable, fixed license.
Modified: sandbox/ahocevar/playground/ux/Printing/license.txt
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/license.txt 2009-12-10 22:10:03 UTC (rev 1574)
+++ sandbox/ahocevar/playground/ux/Printing/license.txt 2009-12-11 17:10:22 UTC (rev 1575)
@@ -1,8 +1,7 @@
-This license applies to all code and content hosted in the "core" directory of
-this repository (http://svn.geoext.org/core/) - including the "trunk",
-"branches", and "tags" subdirectories. This license does not apply to external
-code and content which may be checked out in working copies (due to
-svn:externals properties on subdirectories).
+This license applies to all code and content hosted in this directory of the
+repository. It does not apply to external code and content which may be
+checked out in working copies (due to svn:externals properties on
+subdirectories).
License
=======
Modified: sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/PrintForm.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/PrintForm.js 2009-12-10 22:10:03 UTC (rev 1574)
+++ sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/PrintForm.js 2009-12-11 17:10:22 UTC (rev 1575)
@@ -18,8 +18,8 @@
*
* Provides a base class form for working with
* :class:`GeoExt.ux.data.PrintProvider`, :class:`GeoExt.ux.data.PrintPage`
- * and the plugins available for fields to synchronize. The form also
- * provides a layer for the page extent and handle features of print pages,
+ * and the plugins available for fields to synchronize. The form uses
+ * a layer to draw the page extent and handle features of print pages,
* with a control to modify them. Finally, it configures the printProvider
* with the appropriate units of the map.
*
@@ -41,12 +41,24 @@
printProvider: null,
/** api: config[map]
- * ``GeoExt.MapPanel``|``OpenLayers.Map`` The map this control uses to
- * draw and control extent features and handles, and to determine the map
- * units for the printProvider.
+ * ``GeoExt.MapPanel``|``OpenLayers.Map`` The map the drag control will
+ * be added to. The units for the printProvider are also taken from this
+ * map. Optional if a layer is provided and the layer has already been
+ * added to a map.
*/
+
+ /** private: property[map]
+ * ``OpenLayers.Map`` The map the control uses to draw and control
+ * extent features and handles, and to determine the map units for the
+ * printProvider.
+ */
map: null,
+ /** api: config[layer]
+ * ``OpenLayers.Layer.Vector`` The layer used to render extent and handle
+ * features to. Optional, will be created if not provided.
+ */
+
/** private: property[layer]
* ``OpenLayers.Layer.Vector`` The layer used to render extent and handle
* features to.
@@ -61,7 +73,7 @@
/** api: config[pages]
* Array of :class:`GeoExt.ux.data.PrintPage` The pages that this form
- * controls.
+ * controls. Optional, will be created if not provided.
*/
/** api: property[pages]
@@ -77,6 +89,9 @@
if(this.map instanceof GeoExt.MapPanel) {
this.map = this.map.map;
}
+ if(!this.map) {
+ this.map = this.layer.map;
+ }
this.printProvider.units = this.map.baseLayer.units;
if(!this.pages) {
@@ -101,10 +116,14 @@
/** private: method[initLayer]
*/
initLayer: function() {
- this.layer = new OpenLayers.Layer.Vector(null, {
- displayInLayerSwitcher: false
- });
- this.map.addLayer(this.layer);
+ if(!this.layer) {
+ this.layer = new OpenLayers.Layer.Vector(null, {
+ displayInLayerSwitcher: false
+ });
+ }
+ if(!this.layer.map) {
+ this.map.addLayer(this.layer);
+ }
},
/** private: method[initControl]
@@ -143,8 +162,13 @@
Ext.each(this.pages, function(page) {
this.layer.removeFeatures(page.feature, page.handle);
}, this);
- this.layer.destroy();
+ if(!this.initialConfig.layer) {
+ this.layer.destroy();
+ }
this.control.destroy();
+ delete this.layer;
+ delete this.map;
+ delete this.control;
}
});
More information about the Commits
mailing list