Author: Alex.Kolonitsky
Date: 2009-02-27 14:55:31 -0500 (Fri, 27 Feb 2009)
New Revision: 12779
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-6338
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
---
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2009-02-27
19:17:11 UTC (rev 12778)
+++
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2009-02-27
19:55:31 UTC (rev 12779)
@@ -43,6 +43,11 @@
public static final String EXPAND_MODE_SERVER = "server";
public static final String EXPAND_MODE_NONE = "none";
+ /*
+ * It is same as "none" if you don't set expand mode
+ * */
+ public static final String EXPAND_MODE_EMPTY = "";
+
public abstract String getStyleClass();
public abstract void setStyleClass(String styleClass);
@@ -74,6 +79,7 @@
public abstract String getIconStyle();
public abstract void setIconStyle(String iconStyle);
public abstract String getOncollapse();
+
public abstract void setOncollapse(String ongroupcollapse);
public abstract String getOnexpand();
public abstract void setOnexpand(String ongroupexpand);
@@ -164,6 +170,11 @@
super.broadcast(event);
}
}
-
+ public boolean isNoneExpandMode() {
+ String trimedMode = this.getExpandMode().trim().toLowerCase();
+ return EXPAND_MODE_NONE.equals(trimedMode)
+ || EXPAND_MODE_EMPTY.equals(trimedMode);
+ }
+
}
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2009-02-27
19:17:11 UTC (rev 12778)
+++
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2009-02-27
19:55:31 UTC (rev 12779)
@@ -323,8 +323,7 @@
public void renderChildren(FacesContext facesContext, UIComponent component)
throws IOException {
- String mode = ((UIPanelMenuGroup) component).getExpandMode();
- if (UIPanelMenuGroup.EXPAND_MODE_NONE.equalsIgnoreCase(mode)
+ if (((UIPanelMenuGroup) component).isNoneExpandMode()
|| isOpened(facesContext, component)) {
super.renderChildren(facesContext, component);
}
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
---
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2009-02-27
19:17:11 UTC (rev 12778)
+++
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2009-02-27
19:55:31 UTC (rev 12779)
@@ -126,7 +126,7 @@
}
boolean childRendered = child.isRendered();
- if (!childRendered || !parentRendered || isParentDisabled(child) ||
!isParentExpended(child)) {
+ if (!childRendered || !parentRendered || isParentDisabled(child)/* ||
!isParentExpended(child)*/) {
continue;
}
@@ -221,29 +221,26 @@
}
private String getHoverClass(UIPanelMenu panelMenu, UIComponent child) {
+ String hoveredClass = (child instanceof UIPanelMenuGroup ?
+ panelMenu.getHoveredGroupClass() : panelMenu.getHoveredItemClass())
+ + " " + (child instanceof UIPanelMenuGroup ?
+ ((UIPanelMenuGroup)child).getHoverClass() :
((UIPanelMenuItem)child).getHoverClass());
+ String [] hoveredClasses = hoveredClass.trim().split(" ");
+
StringBuffer buffer = new StringBuffer();
-
+
buffer.append("new Array(");
- if (child instanceof UIPanelMenuGroup) {
- String hoveredGroupClass = panelMenu.getHoveredGroupClass();
- if (!"".equals(hoveredGroupClass)) {
-
buffer.append("\"").append(hoveredGroupClass).append("\"");
+ for (int i = 0; i < hoveredClasses.length; i++) {
+ if (!"".equals(hoveredClasses[i])) {
+
buffer.append("\"").append(hoveredClasses[i]).append("\"");
+
+ if (i != hoveredClasses.length - 1){
+ buffer.append(",");
+ }
}
- } else {
- String hoveredItemClass = panelMenu.getHoveredItemClass();
- if (!"".equals(hoveredItemClass)) {
-
buffer.append("\"").append(hoveredItemClass).append("\"");
- }
-
- buffer.append(",");
-
- String hoverClass = child instanceof UIPanelMenuGroup
- ? ((UIPanelMenuGroup)child).getHoverClass() :
((UIPanelMenuItem)child).getHoverClass();
- if (!"".equals(hoverClass)) {
-
buffer.append("\"").append(hoverClass).append("\"");
- }
}
buffer.append("),");
+
return buffer.toString();
}