[richfaces-svn-commits] JBoss Rich Faces SVN: r15195 - in branches/community/3.3.X/ui/simpleTogglePanel/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
Tue Aug 18 07:02:59 EDT 2009


Author: Alex.Kolonitsky
Date: 2009-08-18 07:02:59 -0400 (Tue, 18 Aug 2009)
New Revision: 15195

Modified:
   branches/community/3.3.X/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
   branches/community/3.3.X/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
Log:
simpleTogglePanel: doesn't became collapsed in ajax and server mode.
https://jira.jboss.org/jira/browse/RF-7704

Modified: branches/community/3.3.X/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- branches/community/3.3.X/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java	2009-08-18 10:06:11 UTC (rev 15194)
+++ branches/community/3.3.X/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java	2009-08-18 11:02:59 UTC (rev 15195)
@@ -39,6 +39,7 @@
 import org.ajax4jsf.renderkit.AjaxRendererUtils;
 import org.ajax4jsf.renderkit.RendererUtils;
 import org.richfaces.component.UISimpleTogglePanel;
+import org.richfaces.component.util.HtmlUtil;
 import org.richfaces.event.SimpleToggleEvent;
 import org.richfaces.event.SimpleTogglePanelSwitchEvent;
 
@@ -182,8 +183,8 @@
 
     public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
         UISimpleTogglePanel comp = (UISimpleTogglePanel) component;
-        if (!(((comp.getSwitchType() == null) || (comp.getSwitchType().equals(UISimpleTogglePanel.CLIENT_SWITCH_TYPE) != true)) && (!comp.isOpened())))
-        {
+        String switchType = comp.getSwitchType();
+        if (UISimpleTogglePanel.CLIENT_SWITCH_TYPE.equals(switchType) || comp.isOpened()) {
             super.encodeChildren(context, component);
         }
     }
@@ -199,8 +200,9 @@
         String width = convertToString(component.getAttributes().get("width"));
         if (!isEmpty(width)) {
             width = "width: " + convertToString(width);
-            style = width + (isEmpty(style) ? ";" : "; " + style + ";");
         }
+        
+        style = HtmlUtil.concatStyles(style, width);
         if (!isEmpty(style)) {
             getUtils().writeAttribute(writer, "style",  style); 
         }
@@ -230,17 +232,17 @@
         getUtils().writeAttribute(writer, "class", "rich-stglpanel-body " + convertToString(component.getAttributes().get("bodyClass")) );
         getUtils().writeAttribute(writer, "id", convertToString(clientId) + "_body" );
         
-        String display = convertToString(component.getAttributes().get("display"));
-        if (!isEmpty(display)) {
-            display = "display: " + convertToString(display) + "; ";
+        String display = "";
+        if (!component.isOpened()) {
+            display = "display: none";
         }
 
         String height = convertToString(component.getAttributes().get("height"));
         if (!isEmpty(height)) {
-            height = "height: " + convertToString(component.getAttributes().get("height")) + ";";
+            height = "height: " + height;
         }
         
-        String style = display + height;
+        String style = HtmlUtil.concatStyles(display, height);
         if (!isEmpty(style)) {
             getUtils().writeAttribute(writer, "style", style);
         }

Modified: branches/community/3.3.X/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
===================================================================
--- branches/community/3.3.X/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js	2009-08-18 10:06:11 UTC (rev 15194)
+++ branches/community/3.3.X/ui/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js	2009-08-18 11:02:59 UTC (rev 15195)
@@ -88,7 +88,6 @@
 			{
 				result = eventFunction.call(element, eventObj);
 			}
-			catch (e) { LOG.warn("Exception: "+e.Message + "\n[on"+eventName + "]"); }
 
 		}
 		
@@ -142,9 +141,13 @@
 	
 	var thePanel = this.panels.get(panelId);
 	if (thePanel.status == "true") {
-		return thePanel.invokeEvent("collapse",event,"true",element);
+		var res = thePanel.invokeEvent("collapse",event,"true",element);
+		Element.hide(panelId+"_body");
+		return res
 	} else {
-		return thePanel.invokeEvent("expand",event,"false",element);
+		var res = thePanel.invokeEvent("expand",event,"false",element); 
+		Element.show(panelId+"_body");
+		return res
 	}
 }
 



More information about the richfaces-svn-commits mailing list