Author: lektran
Date: Thu Dec 23 08:05:33 2010
New Revision: 1052195
URL:
http://svn.apache.org/viewvc?rev=1052195&view=revLog:
OFBIZ-4071 - menu-item's disable-if-empty attribute was not being handled, fixed by using the existing unused method to check if the item should be disabled and if true then applying the disabled style and not rendering the hyperlink portion of the child link (if present). Based on a slightly modified patch and report from Deepak Dixit, thanks Deepak.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.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=1052195&r1=1052194&r2=1052195&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 Thu Dec 23 08:05:33 2010
@@ -158,7 +158,7 @@ public class HtmlMenuRenderer extends Ht
}
}
- if (menuItem.getDisabled()) {
+ if (menuItem.getDisabled() || this.isDisableIfEmpty(menuItem, context)) {
style = menuItem.getDisabledTitleStyle();
}
@@ -389,7 +389,7 @@ public class HtmlMenuRenderer extends Ht
public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException {
String target = link.getTarget(context);
ModelMenuItem menuItem = link.getLinkMenuItem();
- if (menuItem.getDisabled()) {
+ if (menuItem.getDisabled() || isDisableIfEmpty(menuItem, context)) {
target = null;
}