Author: sergeyhalipov
Date: 2008-03-05 13:12:24 -0500 (Wed, 05 Mar 2008)
New Revision: 6573
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1650
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2008-03-05
17:42:54 UTC (rev 6572)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2008-03-05
18:12:24 UTC (rev 6573)
@@ -58,6 +58,7 @@
Object itemStyle = parentMenu.getAttributes().get("itemStyle");
Object disabledItemClass =
parentMenu.getAttributes().get("disabledItemClass");
Object disabledItemStyle =
parentMenu.getAttributes().get("disabledItemStyle");
+ Object selectItemClass = parentMenu.getAttributes().get("selectItemClass");
if (null == itemClass) {
itemClass = "";
@@ -71,6 +72,9 @@
if (null == disabledItemStyle) {
disabledItemStyle = "";
}
+ if (null == selectItemClass) {
+ selectItemClass = "";
+ }
if (menuGroup.isDisabled()) {
variables.setVariable("menuGroupClass", "dr-menu-item
dr-menu-item-disabled rich-menu-group rich-menu-group-disabled " +
@@ -84,12 +88,16 @@
} else {
variables.setVariable("menuGroupClass", "dr-menu-item
dr-menu-item-enabled rich-menu-group " +
itemClass + " " + menuGroup.getStyleClass());
+ variables.setVariable("menuGroupHoverClass",
"this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
+ itemClass + " " + selectItemClass + " " +
menuGroup.getStyleClass() + "'");
variables.setVariable("menuGroupStyle",
itemStyle + "; " + menuGroup.getStyle());
variables.setVariable("menuGroupMouseMove",
menuGroup.getAttributes().get("onmousemove"));
variables.setVariable("menuGroupItemIconClass",
"rich-menu-item-icon-enabled");
variables.setVariable("menuGroupItemLabelClass",
"rich-menu-item-label");
variables.setVariable("menuGroupItemFolderClass",
"rich-menu-item-folder");
+ variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context,
menuGroup, false));
+ variables.setVariable("onmouseoverInlineStyles",
processInlineStyles(context, menuGroup, true));
}
}
@@ -144,4 +152,42 @@
throw new FacesException( "Parent menu for menu group (id="
+ menuGroup.getClientId(context) + ") has not been found.");
}
+
+ protected String processInlineStyles(FacesContext context,
+ UIMenuGroup menuGroup, boolean isOnmouseover) {
+
+ StringBuffer buffer = new StringBuffer();
+ Object style = menuGroup.getAttributes().get("style");
+ Object selectStyle = menuGroup.getAttributes().get("selectStyle");
+
+ UIComponent parentMenu = getParentMenu(context, menuGroup);
+ Object selectItemStyle = parentMenu.getAttributes().get("selectItemStyle");
+ Object itemStyle = parentMenu.getAttributes().get("itemStyle");
+
+ if (null == selectStyle) {
+ selectStyle = "";
+ }
+ if (null == selectItemStyle) {
+ selectItemStyle = "";
+ }
+ if (null == itemStyle) {
+ itemStyle = "";
+ }
+
+ selectStyle = itemStyle + "; " + selectItemStyle + "; " +
selectStyle;
+
+ buffer.append("$('ref" + menuGroup.getClientId(context) +
"').style.cssText='");
+
+ if (null != style) {
+ buffer.append(style.toString() + "; ");
+ }
+
+ if (isOnmouseover) {
+ buffer.append(selectStyle.toString() + ";';");
+ } else {
+ buffer.append(itemStyle.toString() + ";';");
+ }
+
+ return buffer.toString();
+ }
}
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
---
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2008-03-05
17:42:54 UTC (rev 6572)
+++
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2008-03-05
18:12:24 UTC (rev 6573)
@@ -25,8 +25,10 @@
<div id="ref#{clientId}"
class="#{menuGroupClass}"
- style="#{component.attributes['style']}"
- onmousemove="#{menuGroupMouseMove}">
+ style="#{menuGroupStyle}"
+ onmousemove="#{menuGroupMouseMove}"
+ onmouseout="this.className='#{menuGroupClass}';
#{onmouseoutInlineStyles}"
+ onmouseover="#{menuGroupHoverClass}; #{onmouseoverInlineStyles}" >
<span id="ref#{clientId}:icon"
class="dr-menu-icon #{menuGroupItemIconClass}
#{component.attributes['iconClass']}">