Author: nbelaevski
Date: 2009-04-02 15:43:16 -0400 (Thu, 02 Apr 2009)
New Revision: 13366
Modified:
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/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.jboss.org/jira/browse/RF-5226
Modified: trunk/ui/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02
19:07:12 UTC (rev 13365)
+++ trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02
19:43:16 UTC (rev 13366)
@@ -127,13 +127,11 @@
<name>selectStyle</name>
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to selected
items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>selectClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconStyle</name>
@@ -144,13 +142,11 @@
<name>iconClass</name>
<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>
@@ -276,31 +272,26 @@
<name>selectClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>selectStyle</name>
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to selected
items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to icon element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconStyle</name>
<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 2009-04-02
19:07:12 UTC (rev 13365)
+++
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02
19:43:16 UTC (rev 13366)
@@ -82,24 +82,24 @@
protected String getItemScript(FacesContext context, UIComponent kid) {
String itemId = null;
- int flcloseonclick = 1;
- int flagGroup = 0;
+ boolean closeOnClick = true;
+ Integer flagGroup = null;
boolean disabled = false;
if (kid instanceof UIMenuItem) {
UIMenuItem menuItem = (UIMenuItem) kid;
itemId = kid.getClientId(context);
disabled = menuItem.isDisabled();
if (disabled) {
- flcloseonclick = 0;
+ closeOnClick = false;
}
} else if (kid instanceof UIMenuGroup) {
UIMenuGroup menuGroup = (UIMenuGroup) kid;
itemId = kid.getClientId(context);
- flcloseonclick = 0;
+ closeOnClick = false;
if ((disabled = menuGroup.isDisabled())) {
- flagGroup = 2;
+ flagGroup = Integer.valueOf(2);
} else {
- flagGroup = 1;
+ flagGroup = Integer.valueOf(1);
}
}
if (itemId != null) {
@@ -109,9 +109,12 @@
options.addEventHandler("onmouseout");
options.addEventHandler("onmouseover");
- options.addOption("closeOnClick", new Integer(flcloseonclick));
- options.addOption("flagGroup", new Integer(flagGroup));
+ if (closeOnClick) {
+ options.addOption("closeOnClick", Boolean.TRUE);
+ }
+ options.addOption("flagGroup", flagGroup);
+
options.addOption("styleClass");
options.addOption("style");
options.addOption("itemClass");
@@ -126,8 +129,11 @@
options.addOption("selectClass");
options.addOption("selectStyle");
options.addOption("iconClass");
- options.addOption("disabled", Boolean.valueOf(disabled));
+ if (disabled) {
+ options.addOption("disabled", Boolean.TRUE);
+ }
+
options.addEventHandler("onselect");
function.addParameter(options);
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
19:07:12 UTC (rev 13365)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02
19:43:16 UTC (rev 13366)
@@ -1115,7 +1115,7 @@
};
var mouseover = function(e) {
- if (options.disabled == false && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
+ if (!options.disabled && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
this.highlightLabel();
}
};
@@ -1126,7 +1126,7 @@
};
var mouseout = function(e){
- if (options.disabled == false && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
+ if (!options.disabled && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
this.unHighlightLabel();
}
};
@@ -1424,7 +1424,7 @@
onclick: function(e){
- if (this.options.closeOnClick == 1) {
+ if (this.options.closeOnClick) {
var menuLayer = this.menu;
while (menuLayer.level > 0) {
menuLayer =
RichFaces.Menu.Layers.layers[(RichFaces.Menu.Layers.father[menuLayer.id])];
@@ -1462,7 +1462,7 @@
},
isDisabled : function() {
- //console.log(this.id + (this.options.disabled));
+ //console.log(this.id + (!!this.options.disabled));
return this.options.disabled || false;
},
onmouseover : function(event) {