details:   /erp/devel/pi/rev/4bb44fefb8c6
changeset: 11436:4bb44fefb8c6
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri Apr 01 17:18:14 2011 +0200
summary:   fixed bug 16604: Not possible to create two menu items for the same 
window

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java
 |  23 ++++++---
 1 files changed, 16 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r ebf1a5e0b117 -r 4bb44fefb8c6 
modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java
    Fri Apr 01 16:44:56 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java
    Fri Apr 01 17:18:14 2011 +0200
@@ -336,7 +336,7 @@
     // force a load
     final List<?> list = tabsQry.list();
 
-    final Map<String, MenuOption> menuOptionsByWindowId = new HashMap<String, 
MenuOption>();
+    final Map<String, List<MenuOption>> menuOptionsByWindowId = new 
HashMap<String, List<MenuOption>>();
     for (MenuOption menuOption : menuOptions) {
       if (menuOption.getMenu() != null && menuOption.getMenu().getWindow() != 
null) {
         // allow access if not running in a web container
@@ -344,7 +344,14 @@
             || ActivationKey.getInstance().hasLicenseAccess("MW",
                 menuOption.getMenu().getWindow().getId()) == 
FeatureRestriction.NO_RESTRICTION;
         if (hasAccess) {
-          menuOptionsByWindowId.put(menuOption.getMenu().getWindow().getId(), 
menuOption);
+          final String windowId = menuOption.getMenu().getWindow().getId();
+          if (menuOptionsByWindowId.containsKey(windowId)) {
+            menuOptionsByWindowId.get(windowId).add(menuOption);
+          } else {
+            List<MenuOption> option = new ArrayList<MenuOption>();
+            option.add(menuOption);
+            menuOptionsByWindowId.put(windowId, option);
+          }
         }
         // make sure that the important parts are read into mem
         for (Tab windowTab : menuOption.getMenu().getWindow().getADTabList()) {
@@ -356,11 +363,13 @@
 
     for (Tab tab : (List<Tab>) list) {
       final Window window = tab.getWindow();
-      final MenuOption menuOption = menuOptionsByWindowId.get(window.getId());
-      if (menuOption != null) {
-        menuOption.setType(MenuEntryType.Window);
-        menuOption.setId(tab.getId());
-        menuOption.setTab(tab);
+      final List<MenuOption> options = 
menuOptionsByWindowId.get(window.getId());
+      if (options != null) {
+        for (MenuOption menuOption : options) {
+          menuOption.setType(MenuEntryType.Window);
+          menuOption.setId(tab.getId());
+          menuOption.setTab(tab);
+        }
       }
     }
   }

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to