Hello list,<br>I want to add opacity slider to each tree node like in this example :<br><a href="http://www.geobretagne.fr/web/guest/le-visualiseur" target="_blank">http://dev.geoext.org/sandbox/elemoine/playground/geoext/examples/tree-tools.html</a><br>
I tried to adapt to my script with no success. Can you help me? because i'm newbie in geoext.<br><br>My script is like this:<br><br>var LayerNodeUI = Ext.extend(GeoExt.tree.LayerNodeUI, new GeoExt.tree.TreeNodeUIEventMixin_sc());<br>
sbar = function(node, ct) {<br> return new Ext.Toolbar({<br> cls: "gx-toolbar",<br> buttons: [new GeoExt.LayerOpacitySlider({<br> layer: node.layer,<br> aggressive: true,<br>
plugins: new GeoExt.LayerOpacitySliderTip(),<br> width: 100<br> })]<br> });<br>}; <br> <br>// a custom layer node UI class, for use with the second tree (see below).<br>CustomLayerNodeUI = Ext.extend(GeoExt.tree.LayerNodeUI, {<br>
component: sbar<br>});<br> //Ajout d'un élément de type "Arborescence" dans le tableau des items<br> items.push({<br> xtype: "treepanel",<br> ref: "tree",<br>
title: "Couches",<br> region: "west",<br> width: 300,<br> autoScroll: true,<br> applyLoader: false,<br> enableDD: true,<br> plugins: [new GeoExt.tree.LayerOpacitySliderPlugin_a({<br>
listeners: { <br> "opacityslide": function(node, value) <br> { <br> <br> } <br> }<br>
})],<br> root: new Ext.tree.AsyncTreeNode({<br> //nodeType: "gx_overlaylayercontainer",<br> text: 'Couches Disponibles',<br> allowChildren:true,<br>
loader: new GeoExt.tree.WMSCapabilitiesLoader(<br> {<br> uiProviders: {<br> "ui": CustomLayerNodeUI<br> },<br><br> url: "/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1",<br>
layerOptions: {buffer: 0, singleTile: true, ratio: 1},<br> layerParams: {'TRANSPARENT': 'TRUE'},<br> // Utiliser la méthode createNode pour ajouter un checkbox devant chaque noeud qui n'a pas d'enfants<br>
createNode: function(attr) {<br> attr.checked = attr.leaf ? false : undefined;<br> attr.uiProvider=attr.leaf ? "ui":undefined;<br> //attr.slider="layeropacityslider";<br>
<br> <br> return GeoExt.tree.WMSCapabilitiesLoader.prototype.createNode.apply(this, [attr]);<br> }}),<br> }),<br> listeners: <br>
{<br> // Ajouter la couche à la carte quand elle est cochée, retirer quand décochée<br> 'checkchange': function(node, checked) { <br> if (checked == true) <br>
{<br> app.mapPanel.map.addLayer(node.attributes.layer); <br> } else {<br> app.mapPanel.map.removeLayer(node.attributes.layer);<br>
}<br> },<br> // Le menu au clic droit<br> contextmenu: function (node, e) { <br> node.select();<br> var c = node.getOwnerTree().contextMenu;<br>
c.contextNode = node;<br> c.showAt(e.getXY());<br> },<br> scope: this<br> },<br> contextMenu: new Ext.menu.Menu({<br> // Les boutons du menu contextuel<br>
items: [{<br> // Le bouton zoom sur l'emprise de la couche<br> text: "Zoom sur l'emprise de la couche",<br> icon:'openlayers/theme/default/img/arrow_out.png',<br>
handler: function () {<br> var node = app.tree.getSelectionModel().getSelectedNode();<br> if (node && node.attributes.layer) { <br> app.mapPanel.map.zoomToExtent(node.attributes.layer.maxExtent);<br>
}<br> },<br> scope: this<br> },<br> {<br> // Le bouton Débuter mise à jour<br> text: "D\351buter une mise \340 jour",<br>
// icon:'openlayers/theme/default/img/silk_pencil.png',<br> handler: function () {<br> var node = app.tree.getSelectionModel().getSelectedNode();<br> if (node && node.attributes.layer) {<br>
setLayer(node);<br> } <br> },<br> scope: this<br> },<br> {<br> // Le bouton Terminer la mise à jour<br> text: "Terminer la mise \340 jour",<br>
// icon:'openlayers/theme/default/img/silk_pencil.png',<br> handler: function() {<br> app.featureGrid.getSelectionModel().clearSelections();// pour éviter que des entités soient toujours sélectionnées<br>
drawControl.deactivate();// pour désactiver le drawcontrol<br> vectorLayer.removeAllFeatures();<br> app.featureGrid.reconfigure(<br> new Ext.data.Store(),<br>
new Ext.grid.ColumnModel([])<br> );<br> app.featureGrid.setTitle("");<br> }<br> }<br> ]<br> })<br> });<br>
<br>
Thank you for your help,<br>Best regards,<br>Zineb<br>