Author: amarkhel
Date: 2010-12-16 10:32:54 -0500 (Thu, 16 Dec 2010)
New Revision: 20616
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
trunk/ui/output/ui/src/main/templates/menugroup.template.xml
trunk/ui/output/ui/src/main/templates/menuitem.template.xml
Log:
RF-9989 Menu group: StringIndexOutOfBoundsException for attribute icon
- isStringEmpty method was implemented instead of CDK isEmpty method.
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-16
15:25:30 UTC (rev 20615)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-16
15:32:54 UTC (rev 20616)
@@ -91,4 +91,16 @@
}
return DEFAULT_MIN_POPUP_WIDTH;
}
+
+ /**
+ * It is introduced due to RF-10004 CDK: isEmpty method is generated incorrectly
+ * @param str
+ * @return
+ */
+ protected boolean isStringEmpty(String str) {
+ if (str != null && str.trim().length() > 0) {
+ return false;
+ }
+ return true;
+ }
}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-16
15:25:30 UTC (rev 20615)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-16
15:32:54 UTC (rev 20616)
@@ -97,14 +97,14 @@
protected String getOnClickFunction(FacesContext facesContext, UIComponent component)
{
AbstractMenuItem menuItem = (AbstractMenuItem) component;
String subminMode = resolveSubmitMode(menuItem);
- if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode))
{
+ if (menuItem.isDisabled()) {
+ return "";
+ } else if (subminMode == null ||
MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
return getServerSubmitFunction(menuItem);
} else if (MenuComponent.MODE_AJAX.equalsIgnoreCase(subminMode)) {
return getOnClick(facesContext, menuItem);
- } else if (menuItem.isDisabled()) {
+ } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
return "";
- } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
- return "";
}
return "";
@@ -173,4 +173,16 @@
}
return null;
}
+
+ /**
+ * It is introduced due to RF-10004 CDK: isEmpty method is generated incorrectly
+ * @param str
+ * @return
+ */
+ protected boolean isStringEmpty(String str) {
+ if (str != null && str.trim().length() > 0) {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/ui/output/ui/src/main/templates/menugroup.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/menugroup.template.xml 2010-12-16 15:25:30 UTC
(rev 20615)
+++ trunk/ui/output/ui/src/main/templates/menugroup.template.xml 2010-12-16 15:32:54 UTC
(rev 20616)
@@ -40,7 +40,7 @@
<c:when test="iconFacet != null and iconFacet.isRendered()">
<cdk:call expression="iconFacet.encodeAll(facesContext)" />
</c:when>
- <c:when test="#{not empty iconAttribute}">
+ <c:when test="#{not isStringEmpty(iconAttribute)}">
<img width="16" height="16"
src="#{RenderKitUtils.getResourceURL(iconAttribute, facesContext)}"
alt="" />
</c:when>
<c:otherwise>
Modified: trunk/ui/output/ui/src/main/templates/menuitem.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/menuitem.template.xml 2010-12-16 15:25:30 UTC
(rev 20615)
+++ trunk/ui/output/ui/src/main/templates/menuitem.template.xml 2010-12-16 15:32:54 UTC
(rev 20616)
@@ -43,7 +43,7 @@
<c:when test="#{iconFacet != null and iconFacet.isRendered()}">
<cdk:call expression="iconFacet.encodeAll(facesContext)" />
</c:when>
- <c:when test="#{not empty iconAttribute}">
+ <c:when test="#{not isStringEmpty(iconAttribute)}">
<img width="16" height="16"
src="#{RenderKitUtils.getResourceURL(iconAttribute, facesContext)}"
alt="" />
</c:when>
<c:otherwise>