[richfaces-svn-commits] JBoss Rich Faces SVN: r258 - in trunk/richfaces/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 4 03:33:14 EDT 2007


Author: d.bulahov
Date: 2007-04-04 03:33:14 -0400 (Wed, 04 Apr 2007)
New Revision: 258

Modified:
   trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
   trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
Development. Has added closing the menu at a choice

Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java	2007-04-03 19:42:23 UTC (rev 257)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java	2007-04-04 07:33:14 UTC (rev 258)
@@ -187,16 +187,23 @@
 		for(Iterator it = children.iterator();it.hasNext();) {
 			UIComponent kid = (UIComponent)it.next();
 			String itemId = null;
+			int flcloseonclick=1;
 			if (kid instanceof UIMenuItem) {
+				UIMenuItem MenuItem=(UIMenuItem)kid;
 				itemId = kid.getClientId(context);
+				if (MenuItem.isDisabled()){
+					flcloseonclick=0;	
+				}
 			} else if (kid instanceof UIMenuGroup) {
 				itemId = "ref" + kid.getClientId(context);
+				flcloseonclick=0;
 			}
 			if(itemId != null){
 				buffer
 					.append(".addItem('")
 					.append(itemId)
-					.append("')");
+					.append("',")
+				    .append(flcloseonclick+")");
 			}
 		}
 		

Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js	2007-04-03 19:42:23 UTC (rev 257)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js	2007-04-04 07:33:14 UTC (rev 258)
@@ -738,33 +738,40 @@
 		}
 
 	},
-	addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
+	//addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
+	addItem: function(itemId, flag_close_onclick){
 		var dis = this;
 		var item = {};
-		item.hoverClass = hoverClass;// = hoverClass.split(" ");
-		item.plainClass = plainClass;//.split(" ");
-		if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
-		if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
+		//item.hoverClass = hoverClass;// = hoverClass.split(" ");
+		//item.plainClass = plainClass;//.split(" ");
+		//if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
+		//if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
 		item.id = itemId;
 		item.obj = $(itemId);
 		item.menu = this;
 		this.items[itemId] = item;
 		var onmouseover =
 			function(e){
-				if (this.hoverClass) $(this.id).className = this.hoverClass;
-				if(this.hoverStyle) {
-					Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
-				}
+				//if (this.hoverClass) $(this.id).className = this.hoverClass;
+				//if(this.hoverStyle) {
+				//	Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
+				//}
 				this.menu.closeMinors(this.id);
 			}.bindAsEventListener(item);
-		var onmouseout =
+		//var onmouseout =
+		//	function(e){
+				//if (this.plainClass) $(this.id).className = this.plainClass;
+				//if(this.hoverStyle) {
+				//	Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
+				//}
+		//	}.bindAsEventListener(item);
+
+		var onmouseclick =
 			function(e){
-				if (this.plainClass) $(this.id).className = this.plainClass;
-				if(this.hoverStyle) {
-					Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
-				}
+                  Exadel.Menu.Layers.shutdown();				
 			}.bindAsEventListener(item);
 
+
  		var binding = new Exadel.Menu.Layer.Binding (
  				item.id,
  				"mouseover",
@@ -772,12 +779,21 @@
 
  		this.bindings.push(binding);
  		binding.refresh();
+ 		//binding = new Exadel.Menu.Layer.Binding (
+ 		//		item.id,
+ 		//		"mouseout",
+ 		//		onmouseout);
+ 		//this.bindings.push(binding);
+ 		//binding.refresh();
+        if (flag_close_onclick==1){
  		binding = new Exadel.Menu.Layer.Binding (
  				item.id,
- 				"mouseout",
- 				onmouseout);
+ 				"click",
+ 				onmouseclick);
  		this.bindings.push(binding);
  		binding.refresh();
+        }
+
 		return this;
 	},
 	hideMe: function(e){




More information about the richfaces-svn-commits mailing list