[fusion-commits] r2489 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Dec 20 02:01:32 EST 2011


Author: liuar
Date: 2011-12-19 23:01:32 -0800 (Mon, 19 Dec 2011)
New Revision: 2489

Modified:
   trunk/widgets/Legend.js
Log:
on behalf of libr(Bruce li)

fix ticket#506: Base map check/uncheck box fails to work.

issue:
Base map can't switch visible/invisible,as it doesn't implemented in server code, so the base map should not have checkbox.

Solution:
replace the 'Fusion.Widget.Legend.TreeFolder' with 'Jx.TreeFolder' for baselayer, 'Jx.TreeFolder' doesn't have checkbox before label of layer.

Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2011-12-15 02:24:51 UTC (rev 2488)
+++ trunk/widgets/Legend.js	2011-12-20 07:01:32 UTC (rev 2489)
@@ -697,7 +697,18 @@
         } else {
           opt.selectable = false;
         }
-        var folder = new Fusion.Widget.Legend.TreeFolder(opt);
+        var folder;
+        if (!layer.isBaseMapLayer) {
+            folder = new Fusion.Widget.Legend.TreeFolder(opt);
+            /* only need to add layer info if it has a check box too */
+            var layerInfo = layer.oMap.getLayerInfoUrl(layer.layerName);
+            if (layerInfo) {
+                folder.setLayerInfo(layerInfo, this.imgLayerInfoIcon);
+            }
+        }  else {
+            opt.selectable = false;
+            folder = new Jx.TreeFolder(opt);
+        }
         var img = folder.elements.get('jxTreeIcon');
         img.style.backgroundPosition = '0px 0px';
         // folder.options.contextMenu.add([
@@ -710,11 +721,6 @@
         //         onClick: OpenLayers.Function.bind(this.expandBranch, this, folder)
         //     })]
         // );
-        
-        var layerInfo = layer.oMap.getLayerInfoUrl(layer.layerName);
-        if (layerInfo) {
-            folder.setLayerInfo(layerInfo, this.imgLayerInfoIcon);
-        }
        
         return folder;
     },
@@ -757,7 +763,7 @@
         }
 
         var item;
-        if (checkbox) {
+        if (!layer.isBaseMapLayer&&checkbox) {
             // opt.contextMenu = this.getContextMenu();
             item = new Fusion.Widget.Legend.TreeItem(opt);
             /* only need to add layer info if it has a check box too */



More information about the fusion-commits mailing list