<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
<br>
You might be interested in the unofficial LayerTreeBuilder
widget, which takes care of creating the layer tree with nested
folders for you using a single and simple option: 'group', inside
your OpenLayers.Layer objects. Its value is a string of folder
names, separated by '/'.<br>
<br>
See it live:<br>
<a class="moz-txt-link-freetext" href="http://dev.geoext.org/geoext/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html">http://dev.geoext.org/geoext/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html</a><br>
<br>
Its source is in svn, you can get it at:<br>
<a class="moz-txt-link-freetext" href="http://svn.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/">http://svn.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/</a><br>
<br>
If you'd rather build your own tree, you can look at the tree
builder source to see how it works.<br>
<br>
Note: this version is for GeoExt 1.x, and ExtJS 3.x.<br>
<br>
HTH,<br>
<br>
Alexandre<br>
<br>
<br>
On 12-12-02 12:23 PM, Shariful Islam wrote:<br>
</div>
<blockquote
cite="mid:1354469007.5515.YahooMailNeo@web121101.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:Courier
New, courier, monaco, monospace, sans-serif;font-size:12pt">
<div>Hi all,</div>
<div><br>
</div>
<div>It may be a very disgusting question from me a noob .<br>
</div>
<div> I am very Upset to be failed to create nested tree in the
tree.js file (included in the examples folder).</div>
<div>I need it very much, very much(not a superfluous word). I
failed to do it after trying a month</div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;">THANKS A
LOT IN ADVANCE</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;">var
mapPanel, tree;<br>
Ext.onReady(function() {<br>
// create a map panel with some layers that we will show
in our layer tree<br>
// below.<br>
mapPanel = new GeoExt.MapPanel({<br>
border: true,<br>
region: "center",<br>
// we do not want all overlays, to try the
OverlayLayerContainer<br>
map: new OpenLayers.Map({allOverlays: 1}),<br>
center: [146.1569825, -41.6109735],<br>
zoom: 6,<br>
layers: [<br>
new OpenLayers.Layer.WMS("Global Imagery",<br>
<a class="moz-txt-link-rfc2396E" href="http://maps.opengeo.org/geowebcache/service/wms">"http://maps.opengeo.org/geowebcache/service/wms"</a>, {<br>
layers: "bluemarble"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0,<br>
visibility: false<br>
}<br>
),<br>
new OpenLayers.Layer.WMS("Tasmania State
Boundaries",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: "topp:tasmania_state_boundaries"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
),<br>
new OpenLayers.Layer.WMS("Water",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: "topp:tasmania_water_bodies",<br>
transparent: true,<br>
format: "image/gif"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
),<br>
new OpenLayers.Layer.WMS("Cities",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: "topp:tasmania_cities",<br>
transparent: true,<br>
format: "image/gif"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
),<br>
new OpenLayers.Layer.WMS("Tasmania Roads",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: "topp:tasmania_roads",<br>
transparent: true,<br>
format: "image/gif"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
),<br>
// create a group layer (with several layers in
the "layers" param)<br>
// to show how the LayerParamLoader works<br>
new OpenLayers.Layer.WMS("Tasmania (Group Layer)",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: [<br>
"topp:tasmania_state_boundaries",<br>
"topp:tasmania_water_bodies",<br>
"topp:tasmania_cities",<br>
"topp:tasmania_roads"<br>
],<br>
transparent: true,<br>
format: "image/gif"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0,<br>
// exclude this layer from layer container
nodes<br>
displayInLayerSwitcher: false,<br>
visibility: false<br>
}<br>
),<br>
<br>
new OpenLayers.Layer.WMS("Tasmania State
Boundaries",<br>
<a class="moz-txt-link-rfc2396E" href="http://demo.opengeo.org/geoserver/wms">"http://demo.opengeo.org/geoserver/wms"</a>, {<br>
layers: "topp:tasmania_state_boundaries"<br>
}, {<br>
isBaseLayer: false,<br>
buffer: 0<br>
}<br>
)<br>
]</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"> I think i
need add severel array into the above portion but how do i
this, Does I have to edit tree config block below.</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;">Block--1<br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"> var
treeConfig = [{<br>
nodeType: "gx_baselayercontainer"<br>
}, {<br>
nodeType: "gx_overlaylayercontainer",<br>
expanded: true,<br>
// render the nodes inside this container with a radio
button,<br>
// and assign them the group "foo".<br>
loader: {<br>
baseAttrs: {<br>
radioGroup: "foo",<br>
uiProvider: "layernodeui"<br>
}<br>
}<br>
}, {<br>
nodeType: "gx_layer",<br>
layer: "Tasmania (Group Layer)",<br>
isLeaf: false,<br>
// create subnodes for the layers in the LAYERS param.
If we assign<br>
// a loader to a LayerNode and do not provide a loader
class, a<br>
// LayerParamLoader will be assumed.<br>
loader: {<br>
param: "LAYERS"<br>
}<br>
}];<br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;">Block--2</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"> tree =
new Ext.tree.TreePanel({<br>
border: true,<br>
region: "west",<br>
title: "Layers",<br>
width: 200,<br>
split: true,<br>
collapsible: true,<br>
collapseMode: "mini",<br>
autoScroll: true,<br>
plugins: [<br>
new GeoExt.plugins.TreeNodeRadioButton({<br>
listeners: {<br>
"radiochange": function(node) {<br>
alert(node.text + " is now the active
layer.");<br>
}<br>
}<br>
})<br>
],<br>
loader: new Ext.tree.TreeLoader({<br>
// applyLoader has to be set to false to not
interfer with loaders<br>
// of nodes further down the tree hierarchy<br>
applyLoader: false,<br>
uiProviders: {<br>
"layernodeui": LayerNodeUI<br>
}<br>
}),<br>
root: {<br>
nodeType: "async",<br>
// the children property of an
Ext.tree.AsyncTreeNode is used to<br>
// provide an initial set of layer nodes. We use
the treeConfig<br>
// from above, that we created with
OpenLayers.Format.JSON.write.<br>
children: Ext.decode(treeConfig)<br>
// Don't use the line above in your application.
Instead, use<br>
//children: treeConfig<br>
<br>
},<br>
listeners: {<br>
"radiochange": function (node) {<br>
alert(node.layer.name + " is now the the
active layer.");<br>
}<br>
},<br>
rootVisible: false,<br>
lines: false,<br>
bbar: [{<br>
text: "Show/Edit Tree Config",<br>
handler: function () {<br>
treeConfigWin.show();<br>
Ext.getCmp("treeconfig").setValue(treeConfig);<br>
}<br>
}]<br>
});</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;">Thanks in
advance a lot.<br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
Courier New,courier,monaco,monospace,sans-serif;
background-color: transparent; font-style: normal;"> });<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Alexandre Dubé
Mapgears
<a class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
</body>
</html>