Author: nbelaevski
Date: 2009-04-02 15:07:12 -0400 (Thu, 02 Apr 2009)
New Revision: 13365
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/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
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/main/templates/org/richfaces/htmlMenuSeparator.jspx
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5226
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -130,7 +130,7 @@
styleClass = "";
}
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-border
rich-menu-list-border " + styleClass, null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-border " +
styleClass, null);
writer.writeAttribute(HTML.style_ATTRIBUTE, "display: none; z-index: 2; " +
style, null);
}
}
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -116,7 +116,7 @@
}
protected void processLayerStyles(FacesContext context, UIComponent layer,
ResponseWriter writer) throws IOException {
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-border
rich-menu-list-border", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-border", null);
writer.writeAttribute(HTML.style_ATTRIBUTE, "display: none; z-index: 2;",
null);
}
Modified: trunk/ui/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02
18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02
19:07:12 UTC (rev 13365)
@@ -97,35 +97,30 @@
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
within</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onmouseout</name>
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
away</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onmouseover</name>
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
onto</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onopen</name>
<classname>java.lang.String</classname>
<description>HTML: script expression; group was
opened</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onclose</name>
<classname>java.lang.String</classname>
<description>HTML: script expression; group was
closed</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
@@ -257,7 +252,6 @@
<classname>java.lang.String</classname>
<description>HTML: script expression; The onselect event occurs when
you select some menu item</description>
- <defaultvalue>""</defaultvalue>
</property>
<property hidden="true">
<name>ondblclick</name>
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -33,8 +33,6 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
@@ -165,13 +163,13 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId+"_menu", null);
processLayerStyles(context, layer, writer);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-bg
rich-menu-list-bg", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-bg", null);
encodeItems(context, layer);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut
rich-menu-list-strut", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-strut", null);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut
rich-menu-list-strut", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-strut", null);
writer.writeAttribute(HTML.width_ATTRIBUTE, "1", null);
writer.writeAttribute(HTML.height_ATTRIBUTE, "1", null);
writer.writeAttribute(HTML.style_ATTRIBUTE, width!=null && width.length() >
0 ? "width: " + HtmlUtil.qualifySize(width) : "", null);
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -23,7 +23,6 @@
import java.io.IOException;
-import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -31,6 +30,7 @@
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.richfaces.component.UIMenuGroup;
+import org.richfaces.component.UIMenuItem;
import org.richfaces.component.util.ViewUtil;
@@ -106,6 +106,11 @@
return delegate.getParentMenu(context, menuGroup);
}
+ protected String collectInlineStyles(FacesContext context, UIMenuItem menuItem,
boolean isOnmouseover) {
+ return delegate.collectInlineStyles(context, menuItem, isOnmouseover);
+ }
+
+ @Deprecated
protected String processInlineStyles(FacesContext context,
UIMenuGroup menuGroup, boolean 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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -36,8 +36,6 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -212,9 +210,9 @@
} else {
variables.setVariable("onmouseoutInlineStyles",
- processInlineStyles(context, menuItem, false));
+ collectInlineStyles(context, menuItem, false));
variables.setVariable("onmouseoverInlineStyles",
- processInlineStyles(context, menuItem, true));
+ collectInlineStyles(context, menuItem, true));
//-----------------------------------
StringBuffer scriptValue = new StringBuffer();
@@ -325,6 +323,11 @@
return MenuComponent.MODE_SERVER;
}
+ protected String collectInlineStyles(FacesContext context, UIMenuItem menuItem,
boolean isOnmouseover) {
+ return delegate.collectInlineStyles(context, menuItem, isOnmouseover);
+ }
+
+ @Deprecated
protected String processInlineStyles(FacesContext context, UIMenuItem menuItem,
boolean isOnmouseover) {
return delegate.processInlineStyles(context, menuItem, isOnmouseover);
}
Modified:
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -26,150 +26,91 @@
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.RendererBase;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+
public class MenuItemRendererDelegate extends RendererBase {
protected void initializeStyles(FacesContext context, UIComponent menuItem,
boolean disabled, ComponentVariables variables) {
UIComponent parentMenu = getParentMenu(context, menuItem);
- Object itemClass = "";
- Object itemStyle = "";
- Object disabledItemClass = "";
- Object disabledItemStyle = "";
- Object selectItemClass = "";
+ String itemClass = null;
+ String itemStyle = null;
+ String disabledItemClass = null;
+ String disabledItemStyle = null;
+ String selectItemClass = null;
if (parentMenu != null) {
- itemClass = parentMenu.getAttributes().get("itemClass");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
- disabledItemClass = parentMenu.getAttributes().get("disabledItemClass");
- disabledItemStyle = parentMenu.getAttributes().get("disabledItemStyle");
- selectItemClass = parentMenu.getAttributes().get("selectItemClass");
+ itemClass = (String) parentMenu.getAttributes().get("itemClass");
+ itemStyle = (String) parentMenu.getAttributes().get("itemStyle");
+ disabledItemClass = (String)
parentMenu.getAttributes().get("disabledItemClass");
+ disabledItemStyle = (String)
parentMenu.getAttributes().get("disabledItemStyle");
+ selectItemClass = (String)
parentMenu.getAttributes().get("selectItemClass");
}
- Object selectClass = menuItem.getAttributes().get("selectClass");
- Object styleClass = menuItem.getAttributes().get("styleClass");
- Object style = menuItem.getAttributes().get("style");
- Object labelClass = (String)menuItem.getAttributes().get("labelClass");
- Object disabledLabelClass =
(String)menuItem.getAttributes().get("labelClass");
- Object selectedLabelClass =
(String)menuItem.getAttributes().get("labelClass");
+ String selectClass = (String) menuItem.getAttributes().get("selectClass");
+ String styleClass = (String) menuItem.getAttributes().get("styleClass");
+ String style = (String) menuItem.getAttributes().get("style");
+ String labelClass = (String) menuItem.getAttributes().get("labelClass");
+ String disabledLabelClass = (String)
menuItem.getAttributes().get("labelClass");
+ String 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("menuItemClass", concatClasses("rich-menu-item
rich-menu-item-disabled", styleClass, itemClass, disabledItemClass));
+ variables.setVariable("menuItemStyle", concatStyles(itemStyle,
disabledItemStyle, style));
+ variables.setVariable("menuItemLabelClass",
concatClasses("rich-menu-item-label rich-menu-item-label-disabled", labelClass,
disabledLabelClass));
+ variables.setVariable("menuGroupClass", concatClasses("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("menuItemItemLabelClass",
concatClasses("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("menuItemCustomClass", concatClasses(styleClass,
itemClass));
+ variables.setVariable("menuItemClass", concatClasses("rich-menu-item
rich-menu-item-enabled", styleClass, itemClass));
+ variables.setVariable("menuItemStyle", concatStyles(itemStyle, style));
+ variables.setVariable("menuItemHoverClass", concatClasses(styleClass,
selectClass, selectItemClass));
+ variables.setVariable("menuItemLabelClass",
concatClasses("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("menuGroupClass", concatClasses("rich-menu-group
rich-menu-group-enabled", itemClass, styleClass));
+ variables.setVariable("menuGroupCustomClass", concatClasses(itemClass,
styleClass));
variables.setVariable("menuItemMouseMove",
menuItem.getAttributes().get("onmousemove"));
- variables.setVariable("menuGroupItemIconClass",
"rich-menu-item-icon-enabled rich-menu-group-icon ");
- variables.setVariable("menuGroupItemLabelClass", "rich-menu-item-label
rich-menu-group-label " + labelClass);
- variables.setVariable("menuGroupItemFolderClass",
"rich-menu-item-folder rich-menu-group-folder ");
- variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context,
menuItem, false));
- variables.setVariable("onmouseoverInlineStyles",
processInlineStyles(context, menuItem, true));
+ variables.setVariable("menuGroupItemIconClass",
"rich-menu-item-icon-enabled rich-menu-group-icon");
+ variables.setVariable("menuGroupItemLabelClass",
concatClasses("rich-menu-item-label rich-menu-group-label", labelClass));
+ variables.setVariable("menuGroupItemFolderClass",
"rich-menu-item-folder rich-menu-group-folder");
+ variables.setVariable("onmouseoutInlineStyles", collectInlineStyles(context,
menuItem, false));
+ variables.setVariable("onmouseoverInlineStyles",
collectInlineStyles(context, menuItem, true));
- variables.setVariable("menuGroupHoverClass",
"this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
- itemClass + " " + selectItemClass + " " + styleClass +
"'");
+ variables.setVariable("menuGroupHoverClass",
concatClasses(itemClass, selectItemClass, styleClass));
}
}
- protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean
isOnmouseover) {
+ protected String collectInlineStyles(FacesContext context, UIComponent menuItem, boolean
isOnmouseover) {
+ String style = (String) menuItem.getAttributes().get("style");
+ String selectStyle = (String) menuItem.getAttributes().get("selectStyle");
- StringBuffer buffer = new StringBuffer();
- Object style = menuItem.getAttributes().get("style");
- Object selectStyle = menuItem.getAttributes().get("selectStyle");
-
UIComponent parentMenu = getParentMenu(context, menuItem);
- Object selectItemStyle = null;
- Object itemStyle = null;
+ String selectItemStyle = null;
+ String itemStyle = null;
if (parentMenu != null) {
- selectItemStyle = parentMenu.getAttributes().get("selectItemStyle");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
-
+ selectItemStyle = (String)
parentMenu.getAttributes().get("selectItemStyle");
+ itemStyle = (String) 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() + ";';");
+ return concatStyles(style, itemStyle, selectItemStyle, selectStyle);
} else {
- buffer.append(itemStyle.toString() + ";';");
+ return concatStyles(style, itemStyle);
}
-
- return buffer.toString();
}
+ @Deprecated
+ protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean
isOnmouseover) {
+ return ("$('" + menuItem.getClientId(context) +
"').style.cssText='" + collectInlineStyles(context, menuItem,
isOnmouseover) + "';");
+ }
+
protected UIComponent getParentMenu(FacesContext context, UIComponent menuItem) {
UIComponent parent = menuItem.getParent();
while (null != parent) {
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
---
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2009-04-02
19:07:12 UTC (rev 13365)
@@ -6,12 +6,12 @@
<f:verbatim><![CDATA[
-.dr-menu-list-border {
+.rich-menu-list-border {
border : 1px solid;
float : left;
position : absolute;
}
-.dr-menu-list-bg {
+.rich-menu-list-bg {
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
@@ -39,7 +39,7 @@
cursor : pointer;
}
-.dr-menu-list-strut {
+.rich-menu-list-strut {
font-size : 0px;
border: 0px;
margin : 0px;
@@ -64,12 +64,12 @@
<u:style name="font-weight" skin="headerWeightFont" />
</u:selector>
-<u:selector name=".dr-menu-list-border">
+<u:selector name=".rich-menu-list-border">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="background-color" skin="additionalBackgroundColor"
/>
</u:selector>
-<u:selector name=".dr-menu-list-bg">
+<u:selector name=".rich-menu-list-bg">
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.background.MenuListBackground"/>
</u:style>
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
===================================================================
---
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2009-04-02
19:07:12 UTC (rev 13365)
@@ -5,26 +5,26 @@
<f:verbatim><![CDATA[
-.dr-menu-separator {
+.rich-menu-separator {
font-size : 0px;
border-top: 1px solid;
margin : 2px 0px 2px 24px;
cursor: default;
}
-.dr-menu-item {
+.rich-menu-item, .rich-menu-group {
padding : 1px 35px 1px 1px;
white-space : nowrap;
position : relative;
}
-.dr-menu-item-enabled {
+.rich-menu-item-enabled, .rich-menu-group-enabled {
border : 0px solid transparent;
padding : 2px 36px 2px 2px;
}
-.dr-menu-item-hover {
+.rich-menu-item-hover, .rich-menu-group-hover {
border : 1px solid;
cursor : pointer;
}
-.dr-menu-item-disabled {
+.rich-menu-item-disabled, .rich-menu-group-disabled {
border : 0px solid transparent;
cursor : default;
}
@@ -34,7 +34,7 @@
.dr-menu-icon img {
vertical-align: middle;
}
-.dr-menu-item a {
+.rich-menu-item a, .rich-menu-group a {
text-decoration : none;
}
@@ -47,16 +47,16 @@
right : 1px;
}
-.dr-menu-item-disabled .dr-menu-node {
+.rich-menu-item-disabled .dr-menu-node, .rich-menu-group-disabled .dr-menu-node {
background-position : bottom;
}
-.dr-menu-list-border {
+.rich-menu-list-border {
border : 1px solid;
float : left;
position : absolute;
}
-.dr-menu-list-bg {
+.rich-menu-list-bg {
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
@@ -84,7 +84,7 @@
cursor : pointer;
}
-.dr-menu-list-strut {
+.rich-menu-list-strut {
font-size : 0px;
border: 0px;
margin : 0px;
@@ -104,21 +104,22 @@
</f:verbatim>
-<u:selector name=".dr-menu-separator">
+<u:selector name=".rich-menu-separator">
<u:style name="border-top-color" skin="panelBorderColor" />
</u:selector>
-<u:selector name=".dr-menu-item, .dr-menu-item a, .dr-menu-item a:hover,
.dr-menu-item a:visited">
+<u:selector name=".rich-menu-item, .rich-menu-item a, .rich-menu-item a:hover,
.rich-menu-item a:visited,
+ .rich-menu-group, .rich-menu-group a, .rich-menu-group a:hover, .rich-menu-group
a:visited">
<u:style name="color" skin="generalTextColor" />
<u:style name="font-family" skin="generalFamilyFont" />
<u:style name="font-size" skin="generalSizeFont" />
</u:selector>
-<u:selector name=".dr-menu-item-disabled">
+<u:selector name=".rich-menu-item-disabled, .rich-menu-group-disabled">
<u:style name="color" skin="tabDisabledTextColor" />
</u:selector>
-<u:selector name=".dr-menu-item-hover">
+<u:selector name=".rich-menu-item-hover, .rich-menu-group-hover">
<u:style name="background-position" value="top left"/>
<u:style name="background-repeat" value="repeat-x"/>
<u:style name="border-color" skin="tipBorderColor" />
@@ -135,12 +136,12 @@
<u:style name="font-weight" skin="headerWeightFont" />
</u:selector>
-<u:selector name=".dr-menu-list-border">
+<u:selector name=".rich-menu-list-border">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="background-color" skin="additionalBackgroundColor"
/>
</u:selector>
-<u:selector name=".dr-menu-list-bg">
+<u:selector name=".rich-menu-list-bg">
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.background.MenuListBackground"/>
</u:style>
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02
19:07:12 UTC (rev 13365)
@@ -1297,8 +1297,10 @@
}
};
RichFaces.Menu.Items = {
- classNames: ['dr-menu-item-enabled', 'rich-menu-item-enabled'],
- hoverClassNames : ['dr-menu-item-hover', 'rich-menu-item-hover'],
+ itemClassNames: ['rich-menu-item-enabled'],
+ groupClassNames: ['rich-menu-group-enabled'],
+ itemHoverClassNames: ['rich-menu-item-hover'],
+ groupHoverClassNames: ['rich-menu-group-hover'],
iconClassNames : [],
hoverIconClassNames: ['dr-menu-icon-selected',
'rich-menu-item-icon-selected'],
labelClassNames: [],
@@ -1310,6 +1312,22 @@
$A(toAdd).each(function(className) {e.addClassName(className)});
},
+ getHoverClassNames: function (item) {
+ if (item.options.flagGroup == 1) {
+ return this.groupHoverClassNames;
+ } else {
+ return this.itemHoverClassNames;
+ }
+ },
+
+ getClassNames: function (item) {
+ if (item.options.flagGroup == 1) {
+ return this.groupClassNames;
+ } else {
+ return this.itemClassNames;
+ }
+ },
+
onmouseover: function(item) {
var element = item.getElement();
var icon = item.getIcon();
@@ -1323,7 +1341,7 @@
var hoverStyle = item.getHoverStyle();
element.style.cssText = inlineStyle.concat(hoverStyle);
- this.replaceClasses(element, this.classNames,
this.hoverClassNames.concat(hoverClass));
+ this.replaceClasses(element, this.getClassNames(item),
this.getHoverClassNames(item).concat(hoverClass));
this.replaceClasses(icon, this.iconClassNames,
this.hoverIconClassNames.concat(iconHoverClass));
this.replaceClasses(labl, this.labelClassNames,
this.hoverLabelClassNames.concat(labelHoverClass));
},
@@ -1339,7 +1357,7 @@
var inlineStyle = item.getInlineStyle();
element.style.cssText = inlineStyle;
- this.replaceClasses(element, this.hoverClassNames.concat(hoverClass),
this.classNames);
+ this.replaceClasses(element, this.getHoverClassNames(item).concat(hoverClass),
this.getClassNames(item));
this.replaceClasses(icon, this.hoverIconClassNames.concat(iconHoverClass),
this.iconClassNames);
this.replaceClasses(labl, this.hoverLabelClassNames.concat(labelHoverClass),
this.labelClassNames);
}
@@ -1493,10 +1511,9 @@
},
highLightGroup: function(light) {
if (light) {
- Element.removeClassName(this.id,"dr-menu-item-enabled");
- Element.addClassName(this.id,"dr-menu-item-hover");
+ Element.removeClassName(this.id,"rich-menu-group-enabled");
+
Element.addClassName(this.id,"rich-menu-group-hover");
- Element.addClassName(this.id,"rich-menu-item-hover");
if (this.options.selectClass) {
Element.addClassName(this.id, this.options.selectClass);
}
@@ -1507,10 +1524,10 @@
Element.addClassName(this.id+":anchor","rich-menu-group-label-selected");
} else {
if (!this.mouseOver) {
- Element.removeClassName(this.id,"dr-menu-item-hover");
Element.removeClassName(this.id,"rich-menu-group-hover");
- Element.removeClassName(this.id,"rich-menu-item-hover");
- Element.addClassName(this.id,"dr-menu-item-enabled");
+
+ Element.addClassName(this.id,"rich-menu-group-enabled");
+
if (this.options.selectClass) {
Element.removeClassName(this.id, this.options.selectClass);
}
@@ -1518,6 +1535,8 @@
Element.removeClassName(this.id+":anchor","rich-menu-item-label-selected");
Element.removeClassName(this.id+":icon","rich-menu-group-icon-selected");
Element.removeClassName(this.id+":anchor","rich-menu-group-label-selected");
+ } else {
+ debugger;
}
}
}
@@ -1537,7 +1556,7 @@
RichFaces.Menu.updateItem = function (event, element, attr) {
var menuItem = RichFaces.Menu.findMenuItem(element.id);
- var classes = 'dr-menu-item dr-menu-item-enabled rich-menu-item
rich-menu-item-enabled';
+ var classes = 'rich-menu-item rich-menu-item-enabled';
if (menuItem) {
if (menuItem.options.styleClass) classes =+ ' '+menuItem.options.styleClass;
element.className = classes;
@@ -1558,3 +1577,45 @@
Richfaces.jsFormSubmit(element.id,form.id,target,params);
return false;
}
+
+RichFaces.Menu.groupMouseOut = function(event, element, menuGroupClass, menuGroupStyle)
{
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-group rich-menu-group-enabled ' + (menuGroupClass
? menuGroupClass : '');
+ element.style.cssText = menuGroupStyle;
+}
+
+RichFaces.Menu.itemMouseOut = function(event, element, menuItemClass, menuItemStyle,
iconClass) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-item rich-menu-item-enabled ' + (menuItemClass ?
menuItemClass : '');
+ element.style.cssText = menuItemStyle;
+ $(element.id + ':icon').className='dr-menu-icon rich-menu-item-icon ' +
(iconClass ? iconClass : '');
+ Element.removeClassName($(element.id + ':anchor'),
'rich-menu-item-label-selected');
+
+}
+
+RichFaces.Menu.groupMouseOver = function(event, element, menuGroupHoverClass,
menuGroupStyle) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-group rich-menu-group-enabled ' +
(menuGroupHoverClass ? menuGroupHoverClass : '');
+ element.style.cssText = menuGroupStyle;
+}
+
+RichFaces.Menu.itemMouseOver = function(event, element, menuItemHoverClass,
menuItemStyle, iconClass) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-item rich-menu-item-hover ' + (menuItemHoverClass
? menuItemHoverClass : '');
+ element.style.cssText = menuItemStyle;
+
+ $(element.id + ':icon').className='dr-menu-icon dr-menu-icon-selected
rich-menu-item-icon rich-menu-item-icon-selected ' + (iconClass ? iconClass :
'');
+ Element.addClassName($(element.id + ':anchor'),
'rich-menu-item-label-selected');
+}
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
---
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2009-04-02
19:07:12 UTC (rev 13365)
@@ -27,8 +27,8 @@
class="#{menuGroupClass}"
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}" >
+ onmouseout="RichFaces.Menu.groupMouseOut(event, this,
'#{menuGroupCustomClass}', '#{onmouseoutInlineStyles}');"
+ onmouseover="RichFaces.Menu.groupMouseOver(event, this,
'#{menuGroupHoverClass}', '#{onmouseoverInlineStyles}');">
<span id="#{clientId}:icon"
class="dr-menu-icon #{menuGroupItemIconClass}
#{component.attributes['iconClass']}">
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-04-02
18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-04-02
19:07:12 UTC (rev 13365)
@@ -41,7 +41,7 @@
<div id="#{clientId}"
class="#{menuItemClass}"
style="#{menuItemStyle}"
- onclick="Event.stop(event || window.event);">
+ onclick="Event.stop(event);">
<jsp:scriptlet><![CDATA[
} else {
@@ -58,16 +58,8 @@
<div id="#{clientId}"
class="#{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']}';
- 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']}';
- Element.addClassName($('#{clientId}:anchor'),
'rich-menu-item-label-selected');"
+ onmouseout="RichFaces.Menu.itemMouseOut(event, this,
'#{menuItemCustomClass}', '#{onmouseoutInlineStyles}',
'#{component.attributes['iconClass']}');"
+ onmouseover="RichFaces.Menu.itemMouseOver(event, this,
'#{menuItemHoverClass}', '#{onmouseoverInlineStyles}',
'#{component.attributes['iconClass']}');"
onmouseup="Event.stop(event); #{component.attributes['onmouseup']}"
onmousedown="Event.stop(event);
#{component.attributes['onmousedown']}"
Modified:
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx
===================================================================
---
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2009-04-02
19:07:12 UTC (rev 13365)
@@ -13,7 +13,7 @@
<f:clientid var="clientId"/>
- <div id="#{clientId}" class="dr-menu-separator
rich-menu-separator">
+ <div id="#{clientId}" class="rich-menu-separator">
</div>
</f:root>
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 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -30,19 +30,13 @@
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
-import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceBuilderImpl;
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.HtmlTestUtils;
import org.richfaces.component.html.HtmlMenuGroup;
import org.richfaces.renderkit.html.images.MenuNodeImage;
-import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -198,8 +192,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-disabled"));
assertTrue(classAttr.contains("rich-menu-group-disabled"));
assertTrue(classAttr.contains("rich-menu-group"));
@@ -231,7 +223,7 @@
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr
- .contains("dr-menu-item dr-menu-item-enabled
rich-menu-group"));
+ .contains("rich-menu-group rich-menu-group-enabled"));
div = page.getHtmlElementById(menuGroup.getClientId(facesContext) +
":folder");
assertNotNull(div);
Modified:
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
===================================================================
---
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -31,21 +31,15 @@
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.event.PhaseId;
-import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.event.EventsQueue;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceBuilderImpl;
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.HtmlTestUtils;
import org.ajax4jsf.tests.MockViewRoot;
import org.richfaces.component.html.HtmlMenuItem;
import org.richfaces.renderkit.html.images.background.MenuListBackground;
-import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -199,8 +193,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-disabled"));
assertTrue(classAttr.contains("rich-menu-item"));
assertTrue(classAttr.contains("rich-menu-item-disabled"));
@@ -245,8 +237,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-enabled"));
assertTrue(classAttr.contains("rich-menu-item"));
assertTrue(classAttr.contains("rich-menu-item-enabled"));
Modified:
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
===================================================================
---
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2009-04-02
18:00:13 UTC (rev 13364)
+++
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2009-04-02
19:07:12 UTC (rev 13365)
@@ -100,7 +100,6 @@
//System.out.println(page.asXml());
HtmlElement div =
page.getHtmlElementById(menuSeparator.getClientId(facesContext));
String classAttr = div.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-menu-separator"));
assertTrue(classAttr.contains("rich-menu-separator"));
classAttr = div.getAttributeValue("id");
assertEquals(menuSeparator.getClientId(facesContext), classAttr);