[Commits] r1222 - apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer

commits at geoext.org commits at geoext.org
Sat Jul 4 06:42:13 CEST 2009


Author: tschaub
Date: 2009-07-04 06:42:13 +0200 (Sat, 04 Jul 2009)
New Revision: 1222

Modified:
   apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/GroupContainer.js
Log:
Make sure there is one active layer on remove.

Modified: apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/GroupContainer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/GroupContainer.js	2009-07-04 03:03:20 UTC (rev 1221)
+++ apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/GroupContainer.js	2009-07-04 04:42:13 UTC (rev 1222)
@@ -63,7 +63,39 @@
         }
     },
 
+    /** private: method[onStoreRemove]
+     *  :param store: ``Ext.data.Store``
+     *  :param record: ``Ext.data.Record``
+     *  :param index: ``Number``
+     *  
+     *  Listener for the store's remove event.
+     */
+    onStoreRemove: function(store, record, index) {
+        /**
+         * Containers with checkedGroup should have only one visible layer.
+         * This listener can be removed if the LayerNode is made to fire
+         * checkchange when the radio button is unchecked.
+         * TODO: http://www.geoext.org/trac/geoext/ticket/109
+         */
+        GeoExplorer.GroupContainer.superclass.onStoreRemove.apply(this, arguments);
+        if (this.defaults && this.defaults.checkedGroup && !this._reordering) {
+            var layer = this.lastChild && this.lastChild.layer;
+            if (layer) {
+                var last;
+                this.layerStore.each(function(rec) {
+                    if (rec.get("layer") === layer) {
+                        last = rec;
+                    }
+                    return !last;
+                });
+                if (last) {
+                    this.enforceOneVisible(last);
+                }
+            }
+        }
+    },
 
+
     /** private: onStoreUpdate
      *  :param store: ``Ext.data.Store``
      *  :param record: ``Ext.data.Record``



More information about the Commits mailing list