[fusion-commits] r1711 - in trunk: lib widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Dec 11 16:30:25 EST 2008


Author: pagameba
Date: 2008-12-11 16:30:24 -0500 (Thu, 11 Dec 2008)
New Revision: 1711

Modified:
   trunk/lib/jxlib.uncompressed.js
   trunk/widgets/Legend.js
Log:
fixes #189.  create two different context menus based on whether the item is a folder or not.

Modified: trunk/lib/jxlib.uncompressed.js
===================================================================
--- trunk/lib/jxlib.uncompressed.js	2008-12-10 21:14:23 UTC (rev 1710)
+++ trunk/lib/jxlib.uncompressed.js	2008-12-11 21:30:24 UTC (rev 1711)
@@ -10118,6 +10118,7 @@
         }
         
         this.contentContainer.setStyle('visibility','hidden');
+        this.contentContainer.setStyle('display','block');
         $(document.body).adopt(this.contentContainer);            
         /* we have to size the container for IE to render the chrome correctly
          * but just in the menu/sub menu case - there is some horrible peekaboo

Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2008-12-10 21:14:23 UTC (rev 1710)
+++ trunk/widgets/Legend.js	2008-12-11 21:30:24 UTC (rev 1711)
@@ -264,28 +264,45 @@
     },
     
     getContextMenu: function(folder) {
-        return new Jx.Menu.Context(this.name).add(
-            new Jx.Menu.Item({
-                label: OpenLayers.i18n('collapse'),
-                onClick: OpenLayers.Function.bind(this.collapseBranch, this, folder)
-            }),
-            new Jx.Menu.Item({
-                label: OpenLayers.i18n('expand'),
-                onClick: OpenLayers.Function.bind(this.expandBranch, this, folder)
-            }),
-            new Jx.Menu.Item({
-                label: OpenLayers.i18n('refresh'),
-                onClick: OpenLayers.Function.bind(this.update, this, folder)
-            }),
-            new Jx.Menu.Item({
-                label: OpenLayers.i18n('collapseAll'),
-                onClick: OpenLayers.Function.bind(this.collapseAll, this, folder)
-            }),
-            new Jx.Menu.Item({
-                label: OpenLayers.i18n('expandAll'),
-                onClick: OpenLayers.Function.bind(this.expandAll, this, folder)
-            })
-        );
+        if (folder instanceof Jx.TreeFolder) {
+                        return new Jx.Menu.Context(this.name).add(
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('collapse'),
+                    onClick: OpenLayers.Function.bind(this.collapseBranch, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('expand'),
+                    onClick: OpenLayers.Function.bind(this.expandBranch, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('refresh'),
+                    onClick: OpenLayers.Function.bind(this.update, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('collapseAll'),
+                    onClick: OpenLayers.Function.bind(this.collapseAll, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('expandAll'),
+                    onClick: OpenLayers.Function.bind(this.expandAll, this, folder)
+                })
+            );
+        } else {
+            return new Jx.Menu.Context(this.name).add(
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('refresh'),
+                    onClick: OpenLayers.Function.bind(this.update, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('collapseAll'),
+                    onClick: OpenLayers.Function.bind(this.collapseAll, this, folder)
+                }),
+                new Jx.Menu.Item({
+                    label: OpenLayers.i18n('expandAll'),
+                    onClick: OpenLayers.Function.bind(this.expandAll, this, folder)
+                })
+            );
+        }
     },
     expandAll: function(folder) {
         this.recurseTree('expand', this.oRoot);
@@ -626,7 +643,7 @@
         }
 
         var item = new Jx.TreeItem(opt);
-        item.contextMenu = this.getContextMenu(layer.parentGroup.legend.treeItem);
+        item.contextMenu = this.getContextMenu(item); //layer.parentGroup.legend.treeItem);
         if (bCheckBox) {
             //item.domObj.insertBefore(layer.legend.checkBox, item.domObj.childNodes[1]);
             /* only need to add layer info if it has a check box too */



More information about the fusion-commits mailing list