[Users] Suggestion for tree RadioButtonPlugin

Andreas Hocevar ahocevar at opengeo.org
Thu Aug 5 08:34:17 CEST 2010


Hi,

I agree with Erid. The createNode method is customizable and part of the API, so this is where you should make such changes. You don't even have to use Ext.extend, you can just configure your layer loader with your custom createNode method.

Regards,
Andreas.

On Aug 5, 2010, at 08:02 , Eric Lemoine wrote:

> On Monday, August 2, 2010, Dan Ramage <dan at inlet.geol.sc.edu> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> I run into situations where I have layers that should be
>> grouped together in a node, but maybe only one of them is capable of a getFeatureInfo
>> request.
>> 
>> Currently on a node loader.baseAttrs.radioGroup must be
>> defined for the plugin to work. However every layer that appears in the group
>> will have a radiobutton whether it is required or not.
>> 
>> 
>> 
>> When working on my layerOpacitySliderPlugin, I added some
>> code to check not only if the node defines loader.baseAttrs.slider, but also
>> check to see if the layer defines layer.options.opacitySlider: true.  By
>> default, if loader.baseAttrs.slider is defined, but nothing is set in
>> layer.options.opacitySlider, the slider will be created. So one catch is for
>> any layers in a group that might have a slider, the ones in the groups that
>> should not have a slider must define layer.options.opacitySlider: false.
>> 
>> 
>> 
>> 
>> 
>> Anyway I was wondering if something similar would be a
>> useful addition to the radio button to give some further creation control.
> 
> Hi.
> 
> I wouldn't make such a change to GeoExt. Relying on user-specific
> options not defined in OpenLayers isn't something I'd personnally like
> to have.
> 
> What you can possibly do is extend LayerLoader. Something like this (untested):
> 
> LayerLoader = Ext.extend(GeoExt.tree.LayerLoader, {
>    createNode: function(attr) {
>         var radioGroup = this.baseAttrs.radioGroup;
>         var queryable = attr.layer.options.queryable;
>        if(queryable) {
>            delete this.baseAttrs.radioGroup;
>        }
>        var node = LayerLoader.superclass.createNode.apply(this, arguments);
>        this.baseAttrs.radioGroup = radioGroup;
>        return node;
>    }
> });
> 
> 
> Cheers,
> 
> -- 
> Eric Lemoine
> 
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> 
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list