Changeset 1222

Show
Ignore:
Timestamp:
07/04/09 06:42:13 (4 years ago)
Author:
tschaub
Message:

Make sure there is one active layer on remove.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/GroupContainer.js

    r1220 r1222  
    6161                this.enforceOneVisible(record); 
    6262            }, this); 
     63        } 
     64    }, 
     65 
     66    /** private: method[onStoreRemove] 
     67     *  :param store: ``Ext.data.Store`` 
     68     *  :param record: ``Ext.data.Record`` 
     69     *  :param index: ``Number`` 
     70     *   
     71     *  Listener for the store's remove event. 
     72     */ 
     73    onStoreRemove: function(store, record, index) { 
     74        /** 
     75         * Containers with checkedGroup should have only one visible layer. 
     76         * This listener can be removed if the LayerNode is made to fire 
     77         * checkchange when the radio button is unchecked. 
     78         * TODO: http://www.geoext.org/trac/geoext/ticket/109 
     79         */ 
     80        GeoExplorer.GroupContainer.superclass.onStoreRemove.apply(this, arguments); 
     81        if (this.defaults && this.defaults.checkedGroup && !this._reordering) { 
     82            var layer = this.lastChild && this.lastChild.layer; 
     83            if (layer) { 
     84                var last; 
     85                this.layerStore.each(function(rec) { 
     86                    if (rec.get("layer") === layer) { 
     87                        last = rec; 
     88                    } 
     89                    return !last; 
     90                }); 
     91                if (last) { 
     92                    this.enforceOneVisible(last); 
     93                } 
     94            } 
    6395        } 
    6496    },