[Commits] r1098 - in sandbox/camptocamp/geobretagne: build examples lib/GeoExt/data lib/GeoExt/widgets lib/GeoExt/widgets/tree resources/css tests/lib/GeoExt/data tests/lib/GeoExt/widgets tests/lib/GeoExt/widgets/tree
commits at geoext.org
commits at geoext.org
Wed Jun 17 12:16:47 CEST 2009
Author: elemoine
Date: 2009-06-17 12:16:47 +0200 (Wed, 17 Jun 2009)
New Revision: 1098
Added:
sandbox/camptocamp/geobretagne/build/Makefile
Modified:
sandbox/camptocamp/geobretagne/build/readme.txt
sandbox/camptocamp/geobretagne/examples/feature-grid.html
sandbox/camptocamp/geobretagne/examples/layercontainer.html
sandbox/camptocamp/geobretagne/examples/legendpanel.html
sandbox/camptocamp/geobretagne/examples/mappanel-div.html
sandbox/camptocamp/geobretagne/examples/mappanel-viewport.html
sandbox/camptocamp/geobretagne/examples/mappanel-window.html
sandbox/camptocamp/geobretagne/examples/popup.html
sandbox/camptocamp/geobretagne/examples/search-form.html
sandbox/camptocamp/geobretagne/examples/toolbar.html
sandbox/camptocamp/geobretagne/examples/tree.html
sandbox/camptocamp/geobretagne/examples/wms-capabilities.html
sandbox/camptocamp/geobretagne/examples/zoom-chooser.html
sandbox/camptocamp/geobretagne/examples/zoomslider.html
sandbox/camptocamp/geobretagne/examples/zoomslider.js
sandbox/camptocamp/geobretagne/lib/GeoExt/data/LayerStore.js
sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/Action.js
sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/ZoomSlider.js
sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerContainer.js
sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js
sandbox/camptocamp/geobretagne/resources/css/gxtheme-gray.css
sandbox/camptocamp/geobretagne/resources/css/popup.css
sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerStore.html
sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/ZoomSlider.html
sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/tree/LayerContainer.html
Log:
svn merge -r1077:HEAD http://svn.geoext.org/core/trunk/geoext .
Copied: sandbox/camptocamp/geobretagne/build/Makefile (from rev 1097, core/trunk/geoext/build/Makefile)
===================================================================
--- sandbox/camptocamp/geobretagne/build/Makefile (rev 0)
+++ sandbox/camptocamp/geobretagne/build/Makefile 2009-06-17 10:16:47 UTC (rev 1098)
@@ -0,0 +1,68 @@
+# Makefile for GeoExplorer apps
+
+LIB_NAME = GeoExt
+ZIP_NAME = $(LIB_NAME).zip
+
+CSS_DIR = $(LIB_NAME)/resources/css
+CSS_IMPORTS = $(shell cat ../resources/css/geoext-all-debug.css | grep '@import' | sed 's/^@import "\(.*\)";/\1/')
+ALL_CSS = $(CSS_DIR)/geoext-all.css
+
+.PHONEY: help clean ext examples lib zip dist
+
+help:
+ @echo "Please use 'make <target>' where <target> is one or more of"
+ @echo " clean to clean up after building"
+ @echo " ext to make a custom Ext JS build. See readme.txt for requirements"
+ @echo " examples to make the examples dir"
+ @echo " lib to make a standalone dir of lib resources"
+ @echo " zip to make a zip archive of a standalone lib"
+ @echo " dist to make a zip archive of a standalone lib with examples"
+ @echo
+ @echo "Example use:"
+ @echo " make lib"
+ @echo " make lib LIB_NAME=MyLib"
+ @echo " make zip"
+ @echo " make zip ZIP_NAME=MyZip.zip"
+
+clean:
+ -rm -rf $(LIB_NAME)
+ -rm -f $(ZIP_NAME)
+
+ext:
+ @echo "Building ext.js."
+ mkdir -p $(LIB_NAME)/script
+ jsbuild full.cfg -v -o $(LIB_NAME)/script/ -s ext.js
+
+examples:
+ mkdir -p $(LIB_NAME)/examples
+ svn export --force ../examples $(LIB_NAME)/examples
+ for file in `find $(LIB_NAME)/examples/ -name "*.html"`; do \
+ sed -i "s/\.\.\/lib\/GeoExt\.js/\.\.\/script\/GeoExt\.js/g" $${file} ; \
+ sed -i "s/geoext-all-debug\.css/geoext-all\.css/g" $${file} ; \
+ done ;
+
+lib:
+ @echo "Building the library."
+ mkdir -p $(LIB_NAME)/script $(LIB_NAME)/resources/css
+
+ jsbuild full.cfg -v -o $(LIB_NAME)/script/ -s GeoExt.js
+
+ svn export --force ../resources $(LIB_NAME)/resources
+
+ for file in `find $(CSS_DIR) -name "*.css"`; do \
+ csstidy $${file} --template=highest $${file} ; \
+ done ;
+ echo "" > $(ALL_CSS)
+ for filename in $(CSS_IMPORTS); do \
+ cat $(CSS_DIR)/$${filename} >> $(ALL_CSS) ; \
+ done ;
+ -rm $(CSS_DIR)/geoext-all-debug.css
+
+ cp ../license.txt $(LIB_NAME)
+
+zip: lib
+ @echo "Archiving the library."
+ -rm -f $(ZIP_NAME)
+ zip $(ZIP_NAME) -r $(LIB_NAME)
+
+dist: examples zip
\ No newline at end of file
Modified: sandbox/camptocamp/geobretagne/build/readme.txt
===================================================================
--- sandbox/camptocamp/geobretagne/build/readme.txt 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/build/readme.txt 2009-06-17 10:16:47 UTC (rev 1098)
@@ -2,23 +2,54 @@
===============
This directory contains configuration files necessary for building GeoExt
-(and ExtJS). The build configuration is intended for use with the jsbuild
+(and Ext JS). The build configuration is intended for use with the jsbuild
utility included in JSTools (http://projects.opengeo.org/jstools).
Brief instructions
------------------
-Install JSTools.
+This build dir contains a Makefile, which can be used to build GeoExt. The
+build process requires a bash-like shell, make, sed, find and svn. All this
+should be available on well equipped development *nix and OS X boxes. In
+addition, JSTools and csstidy are required. The latter is available as csstidy
+package on debian-style linux systems.
+ $ sudo aptitude install csstidy
+
+To install JSTools, python-setuptools is required. This is available as
+python-setuptools package on debian-style linux systems.
+
+ $ sudo aptitude install python-setuptools
+
+Now you can easily install JSTools.
+
$ easy_install http://svn.opengeo.org/jstools/trunk/
-Change into the core/trunk/build directory.
+Change into the core/trunk/build directory (the one containing the readme.txt
+file you are reading right now), if you are not already here.
- $ cd core/trunk/geoext/build
+ $ cd geoext/build
-Run jsbuild.
+From here, you can build the library.
- $ jsbuild full.cfg
+ $ make zip
-For more complete instructions on building GeoExt, see the documentation
-on the project website: http://www.geoext.org/trac/geoext/wiki/builds.
+Now you can take the resulting GeoExt.zip file and unpack it on your web
+server. The library itself resides in the script folder, the resources folder
+contains css files and images.
+
+For more complete instructions on building GeoExt with jsbuild, see the
+documentation on the project website:
+http://www.geoext.org/trac/geoext/wiki/builds.
+
+The Makefile also contains a target for building Ext JS. This requires Ext JS
+to be installed in ../../ext (relative to this build dir). Make sure to
+provide a license file matching your Ext JS installation and replace the
+provided ext-license.js file with it. To build the library with ext.js in the
+script folder, run make with the ext and zip targets.
+
+ $ make ext zip
+
+The Makefile has even more targets. Invoke make help to see them all.
+
+ $ make help
\ No newline at end of file
Modified: sandbox/camptocamp/geobretagne/examples/feature-grid.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/feature-grid.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/feature-grid.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/layercontainer.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/layercontainer.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/layercontainer.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/legendpanel.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/legendpanel.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/legendpanel.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -1,9 +1,9 @@
<html>
<head>
- <script type="text/javascript" src="http://dev.geoext.org/trunk/ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="http://dev.geoext.org/trunk/ext/ext-all.js"></script>
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/adapter/ext/ext-base.js"></script>
+ <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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/mappanel-div.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/mappanel-div.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/mappanel-div.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/mappanel-viewport.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/mappanel-viewport.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/mappanel-viewport.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
<!-- Google Maps API for "localhost" -->
<!--
Modified: sandbox/camptocamp/geobretagne/examples/mappanel-window.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/mappanel-window.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/mappanel-window.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/popup.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/popup.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/popup.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
<link rel="stylesheet" type="text/css" href="../resources/css/geoext-all-debug.css" />
<script src="http://openlayers.org/api/2.8-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/search-form.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/search-form.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/search-form.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -2,7 +2,7 @@
<head>
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/toolbar.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/toolbar.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/toolbar.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -3,18 +3,9 @@
<title>GeoExt Toolbar Example</title>
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
- <!--
- <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="../../ext/ext-all-debug.js"></script>
- <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css" />
- <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
- -->
<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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
- <!--
- <script src="../../openlayers/lib/OpenLayers.js"></script>
- -->
<script type="text/javascript" src="../lib/GeoExt.js"></script>
<script type="text/javascript" src="toolbar.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/tree.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/tree.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/tree.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/wms-capabilities.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/wms-capabilities.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/wms-capabilities.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -3,7 +3,7 @@
<title>GeoExt WMS Capabilities Example</title>
<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.com/deploy/dev/examples/shared/examples.css"></link>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
<script type="text/javascript" src="../lib/GeoExt/adapter/override-ext-ajax.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/zoom-chooser.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/zoom-chooser.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/zoom-chooser.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/zoomslider.html
===================================================================
--- sandbox/camptocamp/geobretagne/examples/zoomslider.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/zoomslider.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -4,7 +4,7 @@
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.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.com/deploy/dev/examples/shared/examples.css"></link>
+ <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-rc2/OpenLayers.js"></script>
<script type="text/javascript" src="../lib/GeoExt.js"></script>
Modified: sandbox/camptocamp/geobretagne/examples/zoomslider.js
===================================================================
--- sandbox/camptocamp/geobretagne/examples/zoomslider.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/examples/zoomslider.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -38,6 +38,7 @@
// create a separate slider bound to the map but displayed elsewhere
slider = new GeoExt.ZoomSlider({
map: panel.map,
+ aggressive: true,
width: 200,
plugins: new GeoExt.ZoomSliderTip({
template: "<div>Zoom Level: {zoom}</div>"
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/data/LayerStore.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/data/LayerStore.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/data/LayerStore.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -239,11 +239,18 @@
* Handler for a map's removelayer event
*/
onRemoveLayer: function(evt){
- if(!this._removing) {
- var layer = evt.layer;
- this._removing = true;
- this.remove(this.getById(layer.id));
- delete this._removing;
+ //TODO replace the check for undloadDestroy with a listener for the
+ // map's beforedestroy event, doing unbind(). This can be done as soon
+ // as http://trac.openlayers.org/ticket/2136 is fixed.
+ if(this.map.unloadDestroy) {
+ if(!this._removing) {
+ var layer = evt.layer;
+ this._removing = true;
+ this.remove(this.getById(layer.id));
+ delete this._removing;
+ }
+ } else {
+ this.unbind();
}
},
@@ -369,6 +376,13 @@
*/
onReplace: function(key, oldRecord, newRecord){
this.removeMapLayer(oldRecord);
+ },
+
+ /** private: method[destroy]
+ */
+ destroy: function() {
+ this.unbind();
+ GeoExt.data.LayerStore.superclass.destroy.call(this);
}
};
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/Action.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/Action.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/Action.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -19,7 +19,7 @@
* .. code-block:: javascript
*
* var ctrl = new OpenLayers.Control.ZoomToMaxExtent();
- * var action = new GeoExt.Action(ctrl, {
+ * var action = new GeoExt.Action({
* text: "max extent"
* control: ctrl,
* map: map
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/ZoomSlider.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/ZoomSlider.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/ZoomSlider.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -47,6 +47,7 @@
* extent: [-5, 35, 15, 55],
* items: [{
* xtype: "gx_zoomslider",
+ * aggressive: true,
* vertical: true,
* height: 100,
* x: 10,
@@ -73,6 +74,13 @@
* The CSS class name for the slider elements. Default is "gx-zoomslider".
*/
baseCls: "gx-zoomslider",
+
+ /** api: config[aggressive]
+ * ``Boolean``
+ * If set to true, the map is zoomed as soon as the thumb is moved. Otherwise
+ * the map is zoomed when the thumb is released (default).
+ */
+ aggressive: false,
/** private: property[updating]
* ``Boolean``
@@ -92,12 +100,13 @@
}
this.bind(this.map);
}
- this.on({
- "changecomplete": this.changeHandler,
- "beforedestroy": this.unbind,
- scope: this
- });
-
+
+ if (this.aggressive === true) {
+ this.on('change', this.changeHandler, this);
+ } else {
+ this.on('changecomplete', this.changeHandler, this);
+ }
+ this.on("beforedestroy", this.unbind, this);
},
/** private: method[onRender]
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerContainer.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerContainer.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerContainer.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -100,16 +100,6 @@
}
},
- /** private: method[onDestroy]
- */
- onDestroy: function() {
- if(this.layerStore) {
- this.layerStore.un("add", this.onStoreAdd, this);
- this.layerStore.un("remove", this.onStoreRemove, this);
- }
- GeoExt.tree.LayerContainer.superclass.onDestroy.apply(this, arguments);
- },
-
/** private: method[recordIndexToNodeIndex]
* :param index: ``Number`` The record index in the layer store.
* :return: ``Number`` The appropriate child node index for the record.
@@ -220,8 +210,17 @@
this.layerStore.insert(newRecordIndex, [record]);
delete this._reordering;
}
+ },
+
+ /** private: method[destroy]
+ */
+ destroy: function() {
+ if(this.layerStore) {
+ this.layerStore.un("add", this.onStoreAdd, this);
+ this.layerStore.un("remove", this.onStoreRemove, this);
+ }
+ GeoExt.tree.LayerContainer.superclass.destroy.apply(this, arguments);
}
-
});
/**
Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/widgets/tree/LayerNode.js 2009-06-17 10:16:47 UTC (rev 1098)
@@ -64,11 +64,11 @@
node.visibilityChanging = false;
},
- /** private: method[onDestroy]
+ /** private: method[destroy]
*/
- onDestroy: function() {
+ destroy: function() {
delete this.radio;
- GeoExt.tree.LayerNodeUI.superclass.onDestroy.call(this);
+ GeoExt.tree.LayerNodeUI.superclass.destroy.call(this);
}
});
@@ -225,53 +225,84 @@
* state
*/
addVisibilityEventHandlers: function() {
- this.layer.events.register("visibilitychanged", this, function() {
- if(!this.visibilityChanging &&
- this.attributes.checked != this.layer.getVisibility()) {
- this.getUI().toggleCheck(this.layer.getVisibility());
- }
- });
+ this.layer.events.on({
+ "visibilitychanged": this.onLayerVisibilityChanged,
+ scope: this
+ });
this.on({
- "checkchange": function(node, checked) {
- if (checked && this.layer.isBaseLayer && this.layer.map) {
- this.layer.map.setBaseLayer(this.layer);
- }
- this.layer.setVisibility(checked);
- },
+ "checkchange": this.onCheckChange,
scope: this
});
},
+ /** private: method[onLayerVisiilityChanged
+ * handler for visibilitychanged events on the layer
+ */
+ onLayerVisibilityChanged: function() {
+ if(!this.visibilityChanging &&
+ this.attributes.checked != this.layer.getVisibility()) {
+ this.getUI().toggleCheck(this.layer.getVisibility());
+ }
+ },
+
+ /** private: method[onCheckChange]
+ * :param node: ``GeoExt.tree.LayerNode``
+ * :param checked: ``Boolean``
+ * handler for checkchange events
+ */
+ onCheckChange: function(node, checked) {
+ if (checked && this.layer.isBaseLayer && this.layer.map) {
+ this.layer.map.setBaseLayer(this.layer);
+ }
+ this.layer.setVisibility(checked);
+ },
+
/** private: method[addStoreEventHandlers]
* Adds handlers that make sure the node disappeares when the layer is
* removed from the store, and appears when it is re-added.
*/
addStoreEventHandlers: function() {
this.layerStore.on({
- "add": function(store, records, index) {
- var l;
- for(var i=0; i<records.length; ++i) {
- l = records[i].get("layer");
- if(this.layer == l) {
- this.getUI().show();
- } else if (this.layer == l.name) {
- // layer is a string, which means the node has not yet
- // been rendered because the layer was not found. But
- // now we have the layer and can render.
- this.render(bulkRender);
- return;
- }
- }
- },
- "remove": function(store, record, index) {
- if(this.layer == record.get("layer")) {
- this.getUI().hide();
- }
- },
+ "add": this.onStoreAdd,
+ "remove": this.onStoreRemove,
scope: this
});
},
+ /** private: method[onStoreAdd]
+ * :param store: ``Ext.data.Store``
+ * :param records: ``Array(Ext.data.Record)``
+ * :param index: ``Nmber``
+ * handler for add events on the store
+ */
+ onStoreAdd: function(store, records, index) {
+ var l;
+ for(var i=0; i<records.length; ++i) {
+ l = records[i].get("layer");
+ if(this.layer == l) {
+ this.getUI().show();
+ } else if (this.layer == l.name) {
+ // layer is a string, which means the node has not yet
+ // been rendered because the layer was not found. But
+ // now we have the layer and can render.
+ this.render(bulkRender);
+ return;
+ }
+ }
+ },
+
+ /** private: method[onStoreRemove]
+ * :param store: ``Ext.data.Store``
+ * :param record: ``Ext.data.Record``
+ * :param index: ``Nmber``
+ * handler for remove events on the store
+ */
+ onStoreRemove: function(store, record, index) {
+ if(this.layer == record.get("layer")) {
+ this.getUI().hide();
+ }
+ },
+
/** private: method[addChildNodes]
* Calls the add method of a node type configured as ``childNodeType``
* to add children.
@@ -282,6 +313,22 @@
} else if(typeof this.childNodeType.add === "function") {
this.childNodeType.add(this);
}
+ },
+
+ /** private: method[destroy]
+ */
+ destroy: function() {
+ this.layer.events.un({
+ "visibilitychanged": this.onLayerVisibilityChanged,
+ scope: this
+ });
+ delete this.layer;
+ this.layerStore.un("add", this.onStoreAdd, this);
+ this.layerStore.un("remove", this.onStoreRemove, this);
+ delete this.layerStore;
+ this.un("checkchange", this.onCheckChange, this);
+
+ GeoExt.tree.LayerNode.superclass.destroy.call(this);
}
});
Modified: sandbox/camptocamp/geobretagne/resources/css/gxtheme-gray.css
===================================================================
--- sandbox/camptocamp/geobretagne/resources/css/gxtheme-gray.css 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/resources/css/gxtheme-gray.css 2009-06-17 10:16:47 UTC (rev 1098)
@@ -1,9 +1,9 @@
.gx-popup-anc {
- background: transparent url(../images/gray/anchor.png) no-repeat 0 0;
- position: relative;
- top:-1px;
- left:5px;
- z-index:2;
- height:16px;
- width:31px;
+ background: transparent url(../images/gray/anchor.png) no-repeat 0 0;
+ position: relative;
+ top:-1px;
+ left:5px;
+ z-index:2;
+ height:16px;
+ width:31px;
}
\ No newline at end of file
Modified: sandbox/camptocamp/geobretagne/resources/css/popup.css
===================================================================
--- sandbox/camptocamp/geobretagne/resources/css/popup.css 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/resources/css/popup.css 2009-06-17 10:16:47 UTC (rev 1098)
@@ -1,10 +1,9 @@
-
.gx-popup-anc {
- background: transparent url(../images/default/anchor.png) no-repeat 0 0;
- position: relative;
- top:-1px;
- left:5px;
- z-index:2;
- height:16px;
- width:31px;
+ background: transparent url(../images/default/anchor.png) no-repeat 0 0;
+ position: relative;
+ top:-1px;
+ left:5px;
+ z-index:2;
+ height:16px;
+ width:31px;
}
Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerStore.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerStore.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerStore.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -390,7 +390,37 @@
}
+ function test_map_destroy(t) {
+ t.plan(1);
+
+ var map = new OpenLayers.Map({div: "mappanel", allOverlays: true});
+ var a = new OpenLayers.Layer("a");
+ var b = new OpenLayers.Layer("b");
+ map.addLayers([a, b]);
+ var store = new GeoExt.data.LayerStore({
+ map: map
+ });
+
+ var count = 0;
+ // destroying and adding this.control to the map in the remove
+ // handler will cause exceptions when done while the map is being
+ // destroyed. This is the pattern that helped investigating #88.
+ this.control = new OpenLayers.Control();
+ store.on("remove", function() {
+ count++;
+ this.control.destroy();
+ this.control = new OpenLayers.Control();
+ map.addControl(this.control);
+ }, this);
+
+ map.removeLayer(a);
+ map.destroy();
+
+ t.eq(count, 1, "store's remove handler called once");
+ }
+
+
</script>
</head>
<body>
Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/ZoomSlider.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/ZoomSlider.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/ZoomSlider.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -57,8 +57,36 @@
map.destroy();
}
+
+ function test_zoomslider_aggressive(t) {
+ t.plan(2);
+ var slider1 = new GeoExt.ZoomSlider({
+ renderTo: document.body
+ });
+ slider1.on({
+ "changecomplete": function() {
+ t.ok(true, "changecomplete triggered in non-aggressive mode");
+ }
+ });
+ var slider2 = new GeoExt.ZoomSlider({
+ renderTo: document.body,
+ aggressive: true
+ });
+ slider2.on({
+ "change": function() {
+ t.ok(true, "change triggered in aggressive mode");
+ }
+ });
+
+ slider1.setValue(slider1.maxValue, undefined, true);
+ slider2.setValue(slider2.maxValue, undefined, true);
+
+ slider1.destroy();
+ slider2.destroy();
+ }
</script>
+ </head>
<body>
<div id="map" style="width: 512px; height: 256px;"></div>
</body>
Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/tree/LayerContainer.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/tree/LayerContainer.html 2009-06-17 10:07:45 UTC (rev 1097)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/widgets/tree/LayerContainer.html 2009-06-17 10:16:47 UTC (rev 1098)
@@ -54,7 +54,7 @@
t.ok(node.firstChild.layer === layer, "child layer is correct");
node.destroy();
- //map.destroy();
+ map.destroy();
}
@@ -117,7 +117,7 @@
t.eq(root.childNodes[3].layer.name, "c", "[c, a, b, d] first layer drawn at bottom of root");
root.destroy();
- //map.destroy();
+ map.destroy();
}
More information about the Commits
mailing list