Author: sergeyhalipov
Date: 2008-03-06 13:28:05 -0500 (Thu, 06 Mar 2008)
New Revision: 6609
Added:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/ui/menu-components/src/main/config/component/menucomponents.xml
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
Log:
http://jira.jboss.com/jira/browse/RF-1650
http://jira.jboss.com/jira/browse/RF-2372
http://jira.jboss.com/jira/browse/RF-2066
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
===================================================================
---
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -57,7 +57,7 @@
buffer.append(".");
function = new JSFunction("asSubMenu");
function.addParameter(component.getParent().getClientId(context)+"_menu");
- function.addParameter("ref"+component.getClientId(context));
+ function.addParameter(component.getClientId(context));
String evt = (String) component.getAttributes().get("event");
if(evt == null || evt.trim().length() == 0){
evt = "onmouseover";
Modified:
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
---
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -57,7 +57,7 @@
buffer.append(".");
function = new JSFunction("asSubMenu");
function.addParameter(component.getParent().getClientId(context)+"_menu");
- function.addParameter("ref"+component.getClientId(context));
+ function.addParameter(component.getClientId(context));
String evt = (String) component.getAttributes().get("event");
if(evt == null || evt.trim().length() == 0){
evt = "onmouseover";
Modified: trunk/ui/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2008-03-06
18:26:15 UTC (rev 6608)
+++ trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2008-03-06
18:28:05 UTC (rev 6609)
@@ -143,6 +143,12 @@
<classname>java.lang.String</classname>
<description>Class to be applied to icon element</description>
<defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>labelClass</name>
+ <classname>java.lang.String</classname>
+ <description>Class to be applied to label element</description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>converter</name>
@@ -281,6 +287,12 @@
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to icon
element</description>
<defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>labelClass</name>
+ <classname>java.lang.String</classname>
+ <description>Class to be applied to label element</description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
&ajax_component_attributes;
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -93,7 +93,7 @@
}
} else if (kid instanceof UIMenuGroup) {
UIMenuGroup menuGroup = (UIMenuGroup) kid;
- itemId = "ref" + kid.getClientId(context);
+ itemId = kid.getClientId(context);
flcloseonclick = 0;
if ((disabled = menuGroup.isDisabled())) {
flagGroup = 2;
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-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -35,7 +35,13 @@
-public class MenuGroupRendererBase extends HeaderResourcesRendererBase {
+public class MenuGroupRendererBase extends HeaderResourcesRendererBase {
+
+ private MenuItemRendererDelegate delegate;
+
+ public MenuGroupRendererBase() {
+ delegate = new MenuItemRendererDelegate();
+ }
protected Class getComponentClass() {
return UIMenuGroup.class;
@@ -53,52 +59,7 @@
public void initializeStyleClasses(FacesContext context, UIMenuGroup menuGroup) {
ComponentVariables variables =
ComponentsVariableResolver.getVariables(this, menuGroup);
- UIComponent parentMenu = getParentMenu(context, menuGroup);
- Object itemClass = parentMenu.getAttributes().get("itemClass");
- 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 = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
- if (null == disabledItemClass) {
- disabledItemClass = "";
- }
- 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 " +
- itemClass + " " + disabledItemClass + " " +
menuGroup.getStyleClass());
- variables.setVariable("menuGroupStyle",
- itemStyle + "; " + disabledItemStyle + "; " +
menuGroup.getStyle());
- variables.setVariable("menuGroupMouseMove", "");
- variables.setVariable("menuGroupItemIconClass",
"rich-menu-item-icon-disabled");
- variables.setVariable("menuGroupItemLabelClass",
"rich-menu-item-label-disabled");
- variables.setVariable("menuGroupItemFolderClass",
"rich-menu-item-folder-disabled");
- } 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));
- }
+ delegate.initializeStyles(context, menuGroup, menuGroup.isDisabled(), variables);
}
public void initializeResources(FacesContext context, UIMenuGroup menuGroup)
@@ -142,52 +103,12 @@
}
protected UIComponent getParentMenu(FacesContext context, UIMenuGroup menuGroup) {
- UIComponent parent = menuGroup.getParent();
- while (null != parent) {
- if (parent instanceof org.richfaces.component.MenuComponent) {
- return parent;
- }
- parent = parent.getParent();
- }
- throw new FacesException( "Parent menu for menu group (id="
- + menuGroup.getClientId(context) + ") has not been found.");
+ return delegate.getParentMenu(context, menuGroup);
}
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();
+ return delegate.processInlineStyles(context, menuGroup, isOnmouseover);
}
}
Modified:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -47,6 +47,12 @@
public class MenuItemRendererBase extends CompositeRenderer {
+
+ private MenuItemRendererDelegate delegate;
+
+ public MenuItemRendererBase() {
+ delegate = new MenuItemRendererDelegate();
+ }
protected Class getComponentClass() {
return UIMenuItem.class;
@@ -136,11 +142,10 @@
context, menuItem);
}
variables.setVariable("icon", resource);
-
+
if (menuItem.isDisabled()) {
variables.setVariable("iconDisabledClasses",
"dr-menu-icon-disabled rich-menu-item-icon-disabled");
- variables.setVariable("menuItemLabelClass",
"rich-menu-item-label rich-menu-item-label-disabled");
} else {
variables.setVariable("onmouseoutInlineStyles",
@@ -195,7 +200,6 @@
if (resource.length() > 0) {
variables.setVariable("onclick", scriptValue.toString());
}
- variables.setVariable("menuItemLabelClass",
"rich-menu-item-label");
}
}
@@ -238,108 +242,17 @@
return MenuComponent.MODE_SERVER;
}
- protected String processInlineStyles(FacesContext context,
- UIMenuItem menuItem,
- boolean isOnmouseover) {
-
- StringBuffer buffer = new StringBuffer();
- Object style = menuItem.getAttributes().get("style");
- Object selectStyle = menuItem.getAttributes().get("selectStyle");
-
- UIComponent parentMenu = getParentMenu(context, menuItem);
- 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("$('" + menuItem.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();
+ protected String processInlineStyles(FacesContext context, UIMenuItem menuItem,
boolean isOnmouseover) {
+ return delegate.processInlineStyles(context, menuItem, isOnmouseover);
}
protected UIComponent getParentMenu(FacesContext context, UIMenuItem menuItem) {
- UIComponent parent = menuItem.getParent();
- while (null != parent) {
- if (parent instanceof org.richfaces.component.MenuComponent) {
- return parent;
- }
- parent = parent.getParent();
- }
- throw new FacesException( "Parent menu for menu item (id="
- + menuItem.getClientId(context) + ") has not been found.");
+ return delegate.getParentMenu(context, menuItem);
}
public void initializeStyles(FacesContext context, UIMenuItem menuItem) {
- ComponentVariables variables =
+ ComponentVariables variables =
ComponentsVariableResolver.getVariables(this, menuItem);
- UIComponent parentMenu = getParentMenu(context, menuItem);
- Object itemClass = parentMenu.getAttributes().get("itemClass");
- Object itemStyle = parentMenu.getAttributes().get("itemStyle");
- Object disabledItemClass =
parentMenu.getAttributes().get("disabledItemClass");
- Object disabledItemStyle =
parentMenu.getAttributes().get("disabledItemStyle");
- Object selectItemClass = parentMenu.getAttributes().get("selectItemClass");
- Object selectClass = menuItem.getAttributes().get("selectClass");
- Object styleClass = menuItem.getStyleClass();
-
- if (null == itemClass) {
- itemClass = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
- if (null == disabledItemClass) {
- disabledItemClass = "";
- }
- if (null == disabledItemStyle) {
- disabledItemStyle = "";
- }
- if (null == selectItemClass) {
- selectItemClass = "";
- }
- if (null == styleClass) {
- styleClass = "";
- }
- if (null == selectClass) {
- selectClass = "";
- }
-
- if (menuItem.isDisabled()) {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled
" +
- menuItem.getStyleClass() + " " +
- itemClass + " " + disabledItemClass);
- variables.setVariable("menuItemStyle",
- itemStyle + "; " + disabledItemStyle + "; " +
menuItem.getStyle());
- } else {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled "
+
- styleClass + " " + itemClass);
- variables.setVariable("menuItemStyle",
- itemStyle + "; " + menuItem.getStyle());
- variables.setVariable("menuItemHoverClass",
- "this.className='dr-menu-item dr-menu-item-hover rich-menu-item
rich-menu-item-hover " +
- styleClass + " " + selectClass +
- selectItemClass + "';");
- }
+ delegate.initializeStyles(context, menuItem, menuItem.isDisabled(), variables);
}
}
Added:
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
===================================================================
---
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
(rev 0)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -0,0 +1,175 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.RendererBase;
+
+public class MenuItemRendererDelegate extends RendererBase {
+
+ protected void initializeStyles(FacesContext context, UIComponent menuItem,
+ boolean disabled, ComponentVariables variables) {
+ UIComponent parentMenu = getParentMenu(context, menuItem);
+ Object itemClass = parentMenu.getAttributes().get("itemClass");
+ Object itemStyle = parentMenu.getAttributes().get("itemStyle");
+ Object disabledItemClass =
parentMenu.getAttributes().get("disabledItemClass");
+ Object disabledItemStyle =
parentMenu.getAttributes().get("disabledItemStyle");
+ Object selectItemClass = parentMenu.getAttributes().get("selectItemClass");
+ Object selectClass = menuItem.getAttributes().get("selectClass");
+ Object styleClass = menuItem.getAttributes().get("styleClass");
+ Object style = parentMenu.getAttributes().get("style");
+ Object labelClass = (String)menuItem.getAttributes().get("labelClass");
+ Object disabledLabelClass =
(String)menuItem.getAttributes().get("labelClass");
+ Object selectedLabelClass =
(String)menuItem.getAttributes().get("labelClass");
+
+ if (null == labelClass) {
+ labelClass = "";
+ }
+ if (null == disabledLabelClass) {
+ disabledLabelClass = "";
+ }
+ if (null == selectedLabelClass) {
+ selectedLabelClass = "";
+ }
+ if (null == itemClass) {
+ itemClass = "";
+ }
+ if (null == itemStyle) {
+ itemStyle = "";
+ }
+ if (null == disabledItemClass) {
+ disabledItemClass = "";
+ }
+ if (null == disabledItemStyle) {
+ disabledItemStyle = "";
+ }
+ if (null == selectItemClass) {
+ selectItemClass = "";
+ }
+ if (null == styleClass) {
+ styleClass = "";
+ }
+ if (null == selectClass) {
+ selectClass = "";
+ }
+ if (null == style) {
+ style = "";
+ }
+
+ if (disabled) {
+ variables.setVariable("menuItemClass",
+ "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled
" +
+ styleClass + " " +
+ itemClass + " " + disabledItemClass);
+ variables.setVariable("menuItemStyle",
+ itemStyle + "; " + disabledItemStyle + "; " + style);
+ variables.setVariable("menuItemLabelClass", "rich-menu-item-label
rich-menu-item-label-disabled " +
+ labelClass + " " + disabledLabelClass);
+ variables.setVariable("menuGroupClass", "dr-menu-item
dr-menu-item-disabled rich-menu-group rich-menu-group-disabled " +
+ itemClass + " " + disabledItemClass + " " + styleClass);
+ variables.setVariable("menuItemMouseMove", "");
+ variables.setVariable("menuItemItemIconClass",
"rich-menu-item-icon-disabled");
+ variables.setVariable("menuItemItemLabelClass",
"rich-menu-item-label-disabled " + labelClass);
+ variables.setVariable("menuItemItemFolderClass",
"rich-menu-item-folder-disabled");
+ } else {
+ variables.setVariable("menuItemClass",
+ "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled "
+
+ styleClass + " " + itemClass);
+ variables.setVariable("menuItemStyle", itemStyle + "; " + style);
+ variables.setVariable("menuItemHoverClass",
+ "this.className='dr-menu-item dr-menu-item-hover rich-menu-item
rich-menu-item-hover " +
+ styleClass + " " + selectClass +
+ selectItemClass + "';");
+ variables.setVariable("menuItemLabelClass", "rich-menu-item-label
" + labelClass);
+ variables.setVariable("selectLabelClass", selectedLabelClass);
+ variables.setVariable("menuGroupClass", "dr-menu-item
dr-menu-item-enabled rich-menu-group " +
+ itemClass + " " + styleClass);
+ variables.setVariable("menuItemMouseMove",
menuItem.getAttributes().get("onmousemove"));
+ variables.setVariable("menuGroupItemIconClass",
"rich-menu-item-icon-enabled");
+ variables.setVariable("menuGroupItemLabelClass", "rich-menu-item-label
" + labelClass);
+ variables.setVariable("menuGroupItemFolderClass",
"rich-menu-item-folder");
+ variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context,
menuItem, false));
+ variables.setVariable("onmouseoverInlineStyles",
processInlineStyles(context, menuItem, true));
+
+ variables.setVariable("menuGroupHoverClass",
"this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
+ itemClass + " " + selectItemClass + " " + styleClass +
"'");
+ }
+ }
+
+ protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean
isOnmouseover) {
+
+ StringBuffer buffer = new StringBuffer();
+ Object style = menuItem.getAttributes().get("style");
+ Object selectStyle = menuItem.getAttributes().get("selectStyle");
+
+ UIComponent parentMenu = getParentMenu(context, menuItem);
+ 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("$('" + menuItem.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();
+ }
+
+ protected UIComponent getParentMenu(FacesContext context, UIComponent menuItem) {
+ UIComponent parent = menuItem.getParent();
+ while (null != parent) {
+ if (parent instanceof org.richfaces.component.MenuComponent) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ throw new FacesException( "Parent menu for menu group (id="
+ + menuItem.getClientId(context) + ") has not been found.");
+ }
+
+ protected Class getComponentClass() {
+ return null;
+ }
+
+}
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
---
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-03-06
18:28:05 UTC (rev 6609)
@@ -1065,7 +1065,7 @@
this.level = RichFaces.Menu.Layers.layers[parentv].level + 1;
RichFaces.Menu.Layers.father[this.id] = parentv;
if(!refLayerName){
- refLayerName = 'ref' + parentv;
+ refLayerName = parentv;
}
var refLayer = $(refLayerName);
this.refItem = RichFaces.Menu.Layers.layers[parentv].items[refLayerName];
@@ -1297,7 +1297,7 @@
Event.extend(event);
//window.status = $(event.relatedTarget).inspect();
if (this.options.onmouseout) {
- if (this.options.onmouseover.call(element, event) == false) {
+ if (this.options.onmouseout.call(element, event) == false) {
Event.stop(event);
return;
};
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-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2008-03-06
18:28:05 UTC (rev 6609)
@@ -23,14 +23,14 @@
<f:resource name="/org/richfaces/renderkit/html/images/spacer.gif"
var="spacer" />
- <div id="ref#{clientId}"
+ <div id="#{clientId}"
class="#{menuGroupClass}"
- style="#{menuGroupStyle}"
- onmousemove="#{menuGroupMouseMove}"
- onmouseout="this.className='#{menuGroupClass}';
#{onmouseoutInlineStyles}"
- onmouseover="#{menuGroupHoverClass}; #{onmouseoverInlineStyles}" >
+ style="#{menuItemStyle}"
+ onmousemove="#{menuItemMouseMove}"
+ onmouseout="if (RichFaces.Menu.isWithin(event, this)) return;
this.className='#{menuGroupClass}'; #{onmouseoutInlineStyles}"
+ onmouseover="if (RichFaces.Menu.isWithin(event, this)) return;
#{menuGroupHoverClass}; #{onmouseoverInlineStyles}" >
- <span id="ref#{clientId}:icon"
+ <span id="#{clientId}:icon"
class="dr-menu-icon #{menuGroupItemIconClass}
#{component.attributes['iconClass']}">
<jsp:scriptlet>
<![CDATA[
@@ -53,7 +53,7 @@
<jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
</span>
- <span id="ref#{clientId}:anchor"
class="#{menuGroupItemLabelClass}">
+ <span id="#{clientId}:anchor"
class="#{menuGroupItemLabelClass}">
#{component.attributes['value']}
</span>
@@ -64,7 +64,7 @@
if (iconFolderFacet != null && iconFolderFacet.isRendered()) {
]]>
</jsp:scriptlet>
- <div id="ref#{clientId}:folder" class="dr-menu-node
#{menuGroupItemFolderClass}">
+ <div id="#{clientId}:folder" class="dr-menu-node
#{menuGroupItemFolderClass}">
<jsp:scriptlet>
<![CDATA[
renderChild(context, iconFolderFacet);
@@ -75,7 +75,7 @@
<jsp:scriptlet>
<![CDATA[} else if (component.getAttributes().get(iconFolder)!=null) {]]>
</jsp:scriptlet>
- <div id="ref#{clientId}:folder" class="dr-menu-node
#{menuGroupItemFolderClass} #{component.attributes['iconClass']}">
+ <div id="#{clientId}:folder" class="dr-menu-node
#{menuGroupItemFolderClass} #{component.attributes['iconClass']}">
<img width="16" height="16"
style="#{component.attributes['iconStyle']}"
src="#{actualIconFolder}"/>
@@ -83,7 +83,7 @@
<jsp:scriptlet>
<![CDATA[} else {]]>
</jsp:scriptlet>
- <div id="ref#{clientId}:folder" class="dr-menu-node
dr-menu-node-icon #{menuGroupItemFolderClass}"/>
+ <div id="#{clientId}:folder" class="dr-menu-node dr-menu-node-icon
#{menuGroupItemFolderClass}"/>
<jsp:scriptlet>
<![CDATA[}]]>
</jsp:scriptlet>
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-03-06
18:26:15 UTC (rev 6608)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-03-06
18:28:05 UTC (rev 6609)
@@ -56,14 +56,16 @@
<div id="#{clientId}"
class="#{menuItemClass}"
- onmouseout="this.className='#{menuItemClass}';
+ onmouseout="if (RichFaces.Menu.isWithin(event, this)) return;
+ this.className='#{menuItemClass}';
#{onmouseoutInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon rich-menu-item-icon
#{component.attributes['iconClass']}';
- $('#{clientId}:anchor').className='rich-menu-item-label';"
- onmouseover="#{menuItemHoverClass};
+ Element.removeClassName($('#{clientId}:anchor'),
'rich-menu-item-label-selected');"
+ onmouseover="if (RichFaces.Menu.isWithin(event, this)) return;
+ #{menuItemHoverClass};
#{onmouseoverInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected
rich-menu-item-icon rich-menu-item-icon-selected
#{component.attributes['iconClass']}';
- $('#{clientId}:anchor').className='rich-menu-item-label
rich-menu-item-label-selected';"
+ Element.addClassName($('#{clientId}:anchor'),
'rich-menu-item-label-selected');"
style="#{menuItemStyle}"
onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item
rich-menu-item-enabled #{component.attributes['styleClass']}'; #{onselect}
#{onclick}; Event.stop(event);"
onmouseup="Event.stop(event);
#{component.attributes['onmouseup']}">
Modified:
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
===================================================================
---
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2008-03-06
18:26:15 UTC (rev 6608)
+++
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2008-03-06
18:28:05 UTC (rev 6609)
@@ -100,8 +100,7 @@
HtmlPage page = renderView();
assertNotNull(page);
// System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById("ref"
- + menuGroup.getClientId(facesContext));
+ HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());