You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/06/26 05:13:00 UTC

svn commit: r671709 - in /myfaces/tomahawk/trunk: core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/ examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/ examples/simple/src/main/webapp/

Author: lu4242
Date: Wed Jun 25 20:12:59 2008
New Revision: 671709

URL: http://svn.apache.org/viewvc?rev=671709&view=rev
Log:
TOMAHAWK-1110 Action / ActionListener on t:headerLink, TOMAHAWK-406 <t:collapsiblePanel> does not allow valueChangeListener, TOMAHAWK-1046 t:collapsiblePanel doesn't work inside a t:panelTabbedPane and a s:subform.

Added:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java   (with props)
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java   (with props)
    myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java   (with props)
Removed:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLink.java
Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/collapsiblePanel.jsp

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java?rev=671709&r1=671708&r2=671709&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java Wed Jun 25 20:12:59 2008
@@ -56,6 +56,10 @@
     public static final String COMPONENT_FAMILY = "javax.faces.Panel";
     private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.CollapsiblePanel";
         
+    private static final String HEADER_FACET_NAME = "header";
+    
+    private static final String CLOSED_CONTENT_FACET_NAME = "closedContent";
+        
     private boolean _currentlyCollapsed;
     
     public void setCurrentlyCollapsed(boolean collapsed)
@@ -68,6 +72,32 @@
         return _currentlyCollapsed;
     }
     
+    public void setHeader(UIComponent header)
+    {
+        getFacets().put(HEADER_FACET_NAME, header);
+    }
+
+    /**
+     * @JSFFacet
+     */
+    public UIComponent getHeader()
+    {
+        return (UIComponent) getFacets().get(HEADER_FACET_NAME);
+    }
+    
+    public void setClosedContent(UIComponent closedContent)
+    {
+        getFacets().put(CLOSED_CONTENT_FACET_NAME, closedContent);
+    }
+
+    /**
+     * @JSFFacet
+     */
+    public UIComponent getClosedContent()
+    {
+        return (UIComponent) getFacets().get(CLOSED_CONTENT_FACET_NAME);
+    }
+    
     //private static final Log log = LogFactory.getLog(HtmlCollapsiblePanel.class);
 
     public void processDecodes(FacesContext context)
@@ -96,10 +126,7 @@
             {
                 UIComponent child = (UIComponent)it.next();
 
-                if(!(child instanceof HtmlHeaderLink))
-                {
-                    child.processDecodes(context);
-                }
+                child.processDecodes(context);
             }
         }
 

Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java?rev=671709&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java Wed Jun 25 20:12:59 2008
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.collapsiblepanel;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.html.ext.HtmlCommandLink;
+
+/**
+ * Link used to collapse or expand a t:collapsiblePanel. 
+ * 
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ * 
+ * @JSFComponent
+ *   name = "t:headerLink"
+ *   class = "org.apache.myfaces.custom.collapsiblepanel.HtmlHeaderLink"
+ *   tagClass = "org.apache.myfaces.custom.collapsiblepanel.HtmlHeaderLinkTag"
+ * 
+ * @author Martin Marinschek (latest modification by $Author$)
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public abstract class AbstractHtmlHeaderLink extends HtmlCommandLink
+{
+    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlHeaderLink";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.HeaderLink";
+    
+    private static final String LINK_ID = "ToggleCollapsed".intern();
+    
+    public String getClientId(FacesContext context)
+    {
+        if (context == null) throw new NullPointerException("context");
+
+        String clientId;
+        
+        //Try to find its nearest parent that extends form HtmlCollapsiblePanel
+        //to calculate its id.
+        UIComponent collapsiblePanel = findParentCollapsiblePanel(this);
+        
+        if (collapsiblePanel == null)
+        {
+            //Calculate its id normally
+            clientId = super.getClientId(context);
+        }
+        else
+        {
+            //Create its id based on collapsiblePanel id.
+            //There only could exists one headerLink per collapsiblePanel.
+            String calculatedId = collapsiblePanel.getClientId(context) + LINK_ID;
+            
+            //Get the original
+            clientId = super.getClientId(context);
+            
+            //just change the final id with the calculated id.
+            int lastDoublePointLocation = clientId.lastIndexOf(':');
+            clientId = clientId.substring(0,lastDoublePointLocation) +
+                calculatedId.substring(lastDoublePointLocation);
+        }
+        
+        return clientId;
+    }
+    
+    protected static UIComponent findParentCollapsiblePanel(UIComponent component)
+    {
+        UIComponent currentComponent = component;
+
+        // Search for an ancestor that is a instance of HtmlCollapsiblePanel
+        while (null != (currentComponent = currentComponent.getParent()))
+        {
+            if (currentComponent instanceof HtmlCollapsiblePanel)
+            {
+                break;
+            }
+        }
+        return currentComponent;
+    }
+    
+    /**
+     * This property is no longer available since getClientId()
+     * is overridden to proper working of collapsiblePanel
+     * 
+     * @JSFProperty
+     *   tagExcluded = "true"
+     *   
+     * @return
+     */
+    public Boolean getForceId()
+    {
+        return Boolean.FALSE;
+    }
+    
+    public void setForceId(Boolean forceId){
+        throw new UnsupportedOperationException(); 
+    }
+    
+    /**
+     * This property is no longer available since getClientId()
+     * is overridden to proper working of collapsiblePanel
+     * 
+     * @JSFProperty
+     *   tagExcluded = "true"
+     *   
+     * @return
+     */
+    public Boolean getForceIdIndex()
+    {
+        return Boolean.TRUE;
+    }
+    
+    public void setForceIdIndex(Boolean forceIdIndex)
+    {
+        throw new UnsupportedOperationException();
+    }
+
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlHeaderLink.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java?rev=671709&r1=671708&r2=671709&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java Wed Jun 25 20:12:59 2008
@@ -18,14 +18,13 @@
  */
 package org.apache.myfaces.custom.collapsiblepanel;
 
-import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
 import javax.faces.application.Application;
 import javax.faces.application.ViewHandler;
+import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.component.html.HtmlCommandLink;
 import javax.faces.component.html.HtmlOutputText;
@@ -33,9 +32,11 @@
 import javax.faces.context.ResponseWriter;
 import javax.faces.convert.ConverterException;
 
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
+import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
 
 /**
  * @JSFRenderer
@@ -61,18 +62,8 @@
         HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel) uiComponent;
 
         UIComponent headerComp = collapsiblePanel.getFacet("header");
-        UIComponent linkToReset = null;
-        String resetId = null;
 
-        if (headerComp != null) {
-            linkToReset = RendererUtils.findComponent(headerComp, HtmlHeaderLink.class);
-
-            if (linkToReset != null) {
-                resetId = linkToReset.getId();
-                linkToReset.setId(collapsiblePanel.getId() + LINK_ID);
-            }
-        }
-        else {
+        if (headerComp == null){
             HtmlCommandLink link = getLink(facesContext, collapsiblePanel);
             collapsiblePanel.getChildren().add(link);
 
@@ -109,10 +100,6 @@
         }
 
         headerComp.setRendered(true);
-
-        if (linkToReset != null) {
-            linkToReset.setId(resetId);
-        }
     }
 
     public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
@@ -161,15 +148,41 @@
 
         if ((collapsiblePanel.getClientId(facesContext) + LINK_ID).equals(togglingIndicated)) {
             if (reqValue != null)
+            {
                 collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCurrentlyCollapsed());
+            }
             else
+            {
                 collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCollapsed());
+            }
+            
+            UIComponent header = collapsiblePanel.getFacet("header");
+            
+            if (header != null)
+            {
+                UICommand link = (UICommand)RendererUtils.findComponent(header,HtmlHeaderLink.class);
+                
+                if (link != null && link.isImmediate())
+                {
+                    //In this case we need to update the model directly, because
+                    //PROCESS_VALIDATIONS and UPDATE_MODEL phase is not called
+                    //(immediate=true), but we need to reflect the change
+                    //on the collapsed value.
+                    //In this case, no ValueChangeEvent is fired,
+                    //because it is an immediate call.
+                    Object convertedValue = getConvertedValue(facesContext,collapsiblePanel,
+                            collapsiblePanel.getSubmittedValue());
+                    
+                    collapsiblePanel.setValue(convertedValue);
+                    collapsiblePanel.setSubmittedValue(null);
+                    collapsiblePanel.updateModel(facesContext);
+                }
+            }
         }
         else {
             if (reqValue != null)
                 collapsiblePanel.setSubmittedValue("" + collapsiblePanel.isCurrentlyCollapsed());
         }
-
     }
 
     protected HtmlCommandLink getLink(FacesContext facesContext, HtmlCollapsiblePanel collapsiblePanel)
@@ -179,7 +192,6 @@
         link.setId(collapsiblePanel.getId() + LINK_ID);
         link.setTransient(true);
         link.setImmediate(true);
-        //link.addActionListener(new ChangeCollapsedHandler());
 
         List children = link.getChildren();
         // Create the indicator. You could later make this conditional and render optional images instead
@@ -211,30 +223,4 @@
 
         return super.getConvertedValue(context, component, submittedValue);
     }
-
-    // Couldn't get an ActionListner for a link to work properly. With each page submit, one more
-    // event was fired. I assume it is because the link component was set to transparent, and I didn't
-    // know how to get a reference to it back in a new encoding phase
-    /*
-    public static class ChangeCollapsedHandler implements ActionListener {
-    	// Can't make this class anonymous, because it won't work with state saving
-    	// refer to http://forum.java.sun.com/thread.jspa?messageID=2885214&#2885214
-
-		  /* (non-Javadoc)
-		  * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
-		  */
-    /*
-      public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
-    		log.info("Got action event, processing " + actionEvent.getComponent().getId() + ", phase id " + actionEvent.getPhaseId() );
-    		if (!(actionEvent.getComponent().getParent() instanceof HtmlCollapsiblePanel) )
-    			throw new AbortProcessingException("The parent of the action source was of unexpected type, HtmlCollapsiblePanel was expected");
-    		HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel)actionEvent.getComponent().getParent();
-    		collapsiblePanel.setFirstCollapsed(!collapsiblePanel.isFirstCollapsed() );
-        // Note that we need to remove the listeners here, otherwise they will be fired again for old components,
-        // don't quite understand why
-        ActionListener[] listeners = collapsiblePanel.getLink().getActionListeners();
-        for (int i= 0; i< listeners.length; i++) collapsiblePanel.getLink().removeActionListener(listeners[i]);
-    	}
-		}
-    */
 }

Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java?rev=671709&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java Wed Jun 25 20:12:59 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.collapsiblepanel;
+
+import org.apache.myfaces.renderkit.html.ext.HtmlLinkRenderer;
+
+/**
+ * @JSFRenderer
+ *   renderKitId = "HTML_BASIC"
+ *   family = "javax.faces.Command"
+ *   type = "org.apache.myfaces.HeaderLink" 
+ * 
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlHeaderLinkRenderer extends HtmlLinkRenderer
+{
+    
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlHeaderLinkRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java?rev=671709&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java Wed Jun 25 20:12:59 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.collapsiblepanel;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class CollapsiblePanelValueChangeListener implements ValueChangeListener
+{
+    private static Log log = LogFactory
+            .getLog(CollapsiblePanelValueChangeListener.class);
+
+    public void processValueChange(ValueChangeEvent event)
+            throws AbortProcessingException
+    {
+        log.info("Collapsible Panel from "+event.getOldValue()+" to "+ event.getNewValue());
+    }
+}

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/collapsiblepanel/CollapsiblePanelValueChangeListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/collapsiblePanel.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/collapsiblePanel.jsp?rev=671709&r1=671708&r2=671709&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/collapsiblePanel.jsp (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/collapsiblePanel.jsp Wed Jun 25 20:12:59 2008
@@ -36,7 +36,7 @@
     <t:saveState value="#{thirdCollapsiblePanelBean}"/>
 
     <h:form id="form">
-
+        <t:messages/>
         <t:collapsiblePanel id="test1" value="#{firstCollapsiblePanelBean.collapsed}" title="testTitle">
             <h:panelGrid>
                 <h:outputText value="#{firstCollapsiblePanelBean.firstName}"/>
@@ -45,39 +45,42 @@
             </h:panelGrid>
         </t:collapsiblePanel>
 
-        <t:collapsiblePanel id="test2" value="#{secondCollapsiblePanelBean.collapsed}" title="testTitle"
-                            var="test2collapsed">
-            <f:facet name="header">
-                <t:div style="width:500px;background-color:#CCCCCC;">
-                    <h:outputText value="Person"/>
-                    <t:headerLink immediate="true">
-                        <h:outputText value="> Details" rendered="#{test2collapsed}"/>
-                        <h:outputText value="v Overview" rendered="#{!test2collapsed}"/>
-                    </t:headerLink>
-                </t:div>
-            </f:facet>
-            <f:facet name="closedContent">
-                <h:panelGroup>
-                    <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
-                    <h:outputText value=" "/>
-                    <h:outputText value="#{secondCollapsiblePanelBean.surName}"/>
-                    <h:outputText value=", born on: "/>
-                    <h:outputText value="#{secondCollapsiblePanelBean.birthDate}"/>
-                </h:panelGroup>
-            </f:facet>
-            <h:panelGrid>
-                <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
-                <h:inputText value="#{secondCollapsiblePanelBean.surName}"/>
-                <t:inputCalendar value="#{secondCollapsiblePanelBean.birthDate}" renderAsPopup="true"/>
-            </h:panelGrid>
-        </t:collapsiblePanel>
+        <t:subform id="subform">
+	        <t:collapsiblePanel id="test2" value="#{secondCollapsiblePanelBean.collapsed}" title="testTitle"
+	                            var="test2collapsed">
+	            <f:facet name="header">
+	                <t:div style="width:500px;background-color:#CCCCCC;">
+	                    <h:outputText value="Person"/>
+	                    <t:headerLink immediate="true" actionFor="subform">
+	                        <h:outputText value="> Details" rendered="#{test2collapsed}"/>
+	                        <h:outputText value="v Overview" rendered="#{!test2collapsed}"/>
+	                    </t:headerLink>
+	                </t:div>
+	            </f:facet>
+	            <f:facet name="closedContent">
+	                <h:panelGroup>
+	                    <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
+	                    <h:outputText value=" "/>
+	                    <h:outputText value="#{secondCollapsiblePanelBean.surName}"/>
+	                    <h:outputText value=", born on: "/>
+	                    <h:outputText value="#{secondCollapsiblePanelBean.birthDate}"/>
+	                </h:panelGroup>
+	            </f:facet>
+	            <h:panelGrid>
+	                <h:outputText value="#{secondCollapsiblePanelBean.firstName}"/>
+	                <h:inputText value="#{secondCollapsiblePanelBean.surName}"/>
+	                <t:inputCalendar value="#{secondCollapsiblePanelBean.birthDate}" renderAsPopup="true"/>
+	            </h:panelGrid>
+	        </t:collapsiblePanel>
+        </t:subform>
 
         <t:collapsiblePanel id="test3" value="#{thirdCollapsiblePanelBean.collapsed}" title="testTitle"
                             var="test2collapsed">
+            <f:valueChangeListener type="org.apache.myfaces.examples.collapsiblepanel.CollapsiblePanelValueChangeListener" />                            
             <f:facet name="header">
                 <t:div style="width:500px;background-color:#CCCCCC;">
                     <h:outputText value="Person"/>
-                    <t:headerLink immediate="true">
+                    <t:headerLink>
                         <h:outputText value="> Details" rendered="#{test2collapsed}"/>
                         <h:outputText value="v Overview" rendered="#{!test2collapsed}"/>
                     </t:headerLink>