[richfaces-svn-commits] JBoss Rich Faces SVN: r836 - trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed May 23 05:41:34 EDT 2007


Author: sergeyhalipov
Date: 2007-05-23 05:41:34 -0400 (Wed, 23 May 2007)
New Revision: 836

Modified:
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
   trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
Log:
Panel menu: fix some problems with action in ajax mode.

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java	2007-05-22 19:26:59 UTC (rev 835)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java	2007-05-23 09:41:34 UTC (rev 836)
@@ -34,6 +34,7 @@
 import org.richfaces.component.UISwitchablePanel;
 import org.richfaces.component.panelmenu.UIPanelMenu;
 import org.richfaces.component.panelmenu.UIPanelMenuGroup;
+import org.richfaces.event.SwitchablePanelSwitchEvent;
 
 public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
 	protected Class getComponentClass() {
@@ -56,10 +57,9 @@
 			
 		}
 		if(isSubmitted(context, component)){
-			if (UISwitchablePanel.SERVER_METHOD.equals(getItemMode(group))) {
-				ActionEvent actionEvent = new ActionEvent(component);
-				component.queueEvent(actionEvent);
-			} else if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(group))) {
+			new SwitchablePanelSwitchEvent(findMenu(component), null, component).queue();
+            new ActionEvent(component).queue();
+            if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
                 new AjaxEvent(component).queue();
             }
 		}

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java	2007-05-22 19:26:59 UTC (rev 835)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java	2007-05-23 09:41:34 UTC (rev 836)
@@ -29,11 +29,14 @@
 import javax.faces.context.ResponseWriter;
 import javax.faces.event.ActionEvent;
 
+import org.ajax4jsf.framework.ajax.AjaxEvent;
 import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
 import org.ajax4jsf.framework.util.style.CSSFormat;
+import org.richfaces.component.UISwitchablePanel;
 import org.richfaces.component.panelmenu.UIPanelMenu;
 import org.richfaces.component.panelmenu.UIPanelMenuGroup;
 import org.richfaces.component.panelmenu.UIPanelMenuItem;
+import org.richfaces.event.SwitchablePanelSwitchEvent;
 
 public class PanelMenuItemRenderer extends PanelMenuRendererBase {
 	protected Class getComponentClass() {
@@ -44,9 +47,12 @@
 		
 	}
 	protected void doDecode(FacesContext context, UIComponent component) {
-		if(isSubmitted(context, component)){
-			ActionEvent actionEvent = new ActionEvent(component);
-			component.queueEvent(actionEvent);
+		if(isSubmitted(context, component)) {
+			new SwitchablePanelSwitchEvent(findMenu(component), null, component).queue();
+            new ActionEvent(component).queue();
+            if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
+                new AjaxEvent(component).queue();
+            }
 		}
 	}
 	

Modified: trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
===================================================================
--- trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java	2007-05-22 19:26:59 UTC (rev 835)
+++ trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java	2007-05-23 09:41:34 UTC (rev 836)
@@ -331,11 +331,14 @@
 						buffer.append(","+'"'+ ("".equals(sourceIconNodeOpened)?iconExpandedSource:sourceIconNodeOpened) + '"').append(","+
 								'"'+("".equals(sourceIconNodeClosed)?iconCollapsedSource:sourceIconNodeClosed)+'"'+";");
 					} else 	if("".equals(iconExpanded)){
-						buffer.append(","+'"'+iconCollapsedSource+'"').append(","+'"'+iconCollapsedSource+'"');
+						buffer.append(","+'"'+iconCollapsedSource+'"')
+							.append(","+'"'+iconCollapsedSource+'"');
 					} else if ("".equals(iconCollapsed)) {
-						buffer.append(","+'"'+iconExpandedSource+'"').append(","+'"'+iconExpandedSource+'"');
+						buffer.append(","+'"'+iconExpandedSource+'"')
+							.append(","+'"'+iconExpandedSource+'"');
 					} else {
-						buffer.append(","+'"'+iconExpandedSource+'"').append(","+'"'+iconCollapsedSource+'"');
+						buffer.append(","+'"'+iconExpandedSource+'"')
+							.append(","+'"'+iconCollapsedSource+'"');
 					}
 				} else if (iconNodeClosed.equals("custom")){					
 					buffer.append(",\"" + ("".equals(iconExpanded)? sourceIconNodeOpened : iconExpandedSource) + '"').
@@ -357,20 +360,24 @@
 			if (!"".equals(iconItem)){
 				if (!iconItem.equals("custom")){
 					if(component.getAttributes().get("icon").equals("")){
-						buffer.append(","+'"'+sourceIconItem+'"').append(","+'"'+sourceIconItem+'"'+" ");
+						buffer.append(","+'"'+sourceIconItem+'"')
+							.append(","+'"'+sourceIconItem+'"'+" ");
 					} else {
-						buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+" ");
+						buffer.append(","+'"'+customIconSource+'"')
+							.append(","+'"'+customIconSource+'"'+" ");
 					}
 				} else {
 					if(component.getAttributes().get("icon").equals("")){
-						buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"').append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+" ");
+						buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"')
+							.append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+" ");
 					} else {
 						buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+" ");
 					}					
 				}
 			} else {
-				buffer.append(" ");					
+				buffer.append(",\"\" ");					
 			}
+			buffer.append(",\"\" ");
 		}
 	}
 	




More information about the richfaces-svn-commits mailing list