[fusion-commits] r2206 - in sandbox/jxlib-3.0: layers layers/Generic widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Aug 25 14:27:07 EDT 2010


Author: madair
Date: 2010-08-25 18:27:07 +0000 (Wed, 25 Aug 2010)
New Revision: 2206

Modified:
   sandbox/jxlib-3.0/layers/Generic/Generic.js
   sandbox/jxlib-3.0/layers/Layers.js
   sandbox/jxlib-3.0/widgets/Legend.js
Log:
extract legendLabel from AppDef <name> element for Generic layers

Modified: sandbox/jxlib-3.0/layers/Generic/Generic.js
===================================================================
--- sandbox/jxlib-3.0/layers/Generic/Generic.js	2010-08-17 19:41:04 UTC (rev 2205)
+++ sandbox/jxlib-3.0/layers/Generic/Generic.js	2010-08-25 18:27:07 UTC (rev 2206)
@@ -47,7 +47,7 @@
         var scaleRange = new Fusion.Layers.ScaleRange({
             minScale: this.minScale,
             maxScale: this.maxScale}, 
-            Fusion.Constant.LAYER_RASTER_TYPE);
+            Fusion.Constant.LAYER_RASTER_TYPE,{label:this._sMapname});
         
         rootOpts = {
           layerName: this._sMapname,

Modified: sandbox/jxlib-3.0/layers/Layers.js
===================================================================
--- sandbox/jxlib-3.0/layers/Layers.js	2010-08-17 19:41:04 UTC (rev 2205)
+++ sandbox/jxlib-3.0/layers/Layers.js	2010-08-25 18:27:07 UTC (rev 2206)
@@ -87,7 +87,7 @@
      */
 
     loadScaleRanges: function(userFunc) {
-      userFunc();
+      if (userFunc) userFunc();
     },
 
 
@@ -468,7 +468,7 @@
         this.visible = o.visible;
         this.initiallyVisible = o.visible;
         this.selectable = o.selectable;
-        this.metadata = o.metadata;
+        this.metadata = o.metadata?o.metadata:{};
         this.isBaseMapLayer = o.isBaseMapLayer;
 
         //determine the layer type so that the correct icon can be displayed in the legend
@@ -568,7 +568,7 @@
         }
         this.styles = [];
         if (!o.styles) {
-          var styleItem = new Fusion.Layers.StyleItem({legendLabel:'DWF'}, layerType, iconOpt);
+          var styleItem = new Fusion.Layers.StyleItem({legendLabel:iconOpt.label}, layerType, iconOpt);
           this.styles.push(styleItem);
           return;
         }

Modified: sandbox/jxlib-3.0/widgets/Legend.js
===================================================================
--- sandbox/jxlib-3.0/widgets/Legend.js	2010-08-17 19:41:04 UTC (rev 2205)
+++ sandbox/jxlib-3.0/widgets/Legend.js	2010-08-25 18:27:07 UTC (rev 2206)
@@ -640,9 +640,13 @@
             label: layer.legendLabel == '' ? '&nbsp;' : layer.legendLabel,
             isOpen: layer.expandInLegend,
             // contextMenu: this.getContextMenu(),
-            image: this.imgLayerThemeIcon,
-            selectable: !layer.metadata.jxUnselectable || (layer.metadata.jxUnselectable && layer.metadata.jxUnselectable != 'true')
+            image: this.imgLayerThemeIcon
         };
+        if (layer.metadata) {
+          opt.selectable = !layer.metadata.jxUnselectable || (layer.metadata.jxUnselectable && layer.metadata.jxUnselectable != 'true');
+        } else {
+          opt.selectable = false;
+        }
         var folder = new Fusion.Widget.Legend.TreeFolder(opt);
         var img = folder.elements.get('jxTreeIcon');
         img.style.backgroundPosition = '0px 0px';
@@ -669,7 +673,11 @@
         var opt = {};
         opt.statusIsDefault = layer.statusDefault;
         opt.label = style.legendLabel == '' ? '&nbsp;' : style.legendLabel;
-        opt.selectable = !layer.metadata.jxUnselectable || (layer.metadata.jxUnselectable && layer.metadata.jxUnselectable != 'true');
+        if (layer.metadata) {
+          opt.selectable = !layer.metadata.jxUnselectable || (layer.metadata.jxUnselectable && layer.metadata.jxUnselectable != 'true');
+        } else {
+          opt.selectable = false;
+        }
 
         if (!style) {
             opt.image = this.imgDisabledLayerIcon;



More information about the fusion-commits mailing list