ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lekt...@apache.org
Subject svn commit: r607999 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget: html/HtmlMenuRenderer.java menu/ModelMenu.java menu/ModelMenuItem.java
Date Wed, 02 Jan 2008 04:04:23 GMT
Author: lektran
Date: Tue Jan  1 20:04:22 2008
New Revision: 607999

URL: http://svn.apache.org/viewvc?rev=607999&view=rev
Log:
The menu widget's hide-if-selected wasn't working, turns out that ModelMenu's currentMenuItemName
was never being set, so fixed that and changed ModelMenuItem.isSelected() to make use of it
as well

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=607999&r1=607998&r2=607999&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Tue Jan 
1 20:04:22 2008
@@ -150,7 +150,7 @@
 
         String style = null;
         
-        if (menuItem.isSelected(context)) {
+        if (menuItem.isSelected()) {
             style = menuItem.getSelectedStyle();
             if (UtilValidate.isEmpty(style)) {
                 style = "selected";

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=607999&r1=607998&r2=607999&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Tue Jan  1 20:04:22
2008
@@ -328,6 +328,9 @@
         // render formatting wrapper open
         menuStringRenderer.renderFormatSimpleWrapperOpen(buffer, context, this);
 
+        // Set the selected menu item from the context
+        this.setCurrentMenuItemName(context);
+
             //Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module);
         // render each menuItem row, except hidden & ignored rows
         //menuStringRenderer.renderFormatSimpleWrapperRows(buffer, context, this);
@@ -534,6 +537,13 @@
      */
     public void setCurrentMenuItemName(String string) {
         this.currentMenuItemName = string;
+    }
+
+    /**
+     * @param context Map containing the menu context
+     */
+    public void setCurrentMenuItemName(Map context) {
+        this.currentMenuItemName = this.getSelectedMenuItemContextFieldName(context);
     }
 
     /**

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=607999&r1=607998&r2=607999&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Tue Jan  1 20:04:22
2008
@@ -569,9 +569,14 @@
        return this.link;
     }
     
+    /** @deprecated use isSelected() */
     public boolean isSelected(Map context) {
         String currentMenuItemName = modelMenu.getSelectedMenuItemContextFieldName(context);
         return currentMenuItemName != null && currentMenuItemName.equals(this.name);
+    }
+
+    public boolean isSelected() {
+        return modelMenu.getCurrentMenuItemName() != null && modelMenu.getCurrentMenuItemName().equals(this.name);
     }
 
     public static class Link {



Mime
View raw message