[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608255#action_12608255
 ] 

Leonardo Uribe commented on TOMAHAWK-1110:
------------------------------------------


This issue, TOMAHAWK-406 and TOMAHAWK-1046 hides some problems about this 
component. The changes affect all three issues, so
a solution must be done taking into account all three (very strange and 
difficult case, but a very nice myfaces puzzle).

t:collapsiblePanel extends from UIInput. The reason for do that is take advance 
of EditableValueHolder interface, and allow
this component work on dataTables (saving their state (collapsed-expanded) in 
its value property). In a datatable
the only property that is saved per cell is "value", because there is used a 
single component instance to render many cells.

The most important problem with this component is on encodeChildren(), the id 
of the inner headerLink component is set. This
is bad. After checking several options, in this case it is better to play with 
getClientId property, like in forceId 
components aware.

After do that, the second problem is decode() method of headerLink is not 
called. This exclusion is done explicitly in 
AbstractHtmlCollapsiblePanel. Do this is again bad, because this hides another 
problem with collapsiblePanel component.

t:collapsiblePanel should work when immediate="true" is used on t:headerLink. 
If decode() is called for headerLink (this
is done when a user click this link), an ActionEvent is added to the event 
queue, and update value code is not called
for t:collapsiblePanel, so the panel does not collapse or expand. The solution 
for this problem is at the end of 
t:collapsiblePanel decode() method, if the value is toggled, check if exists an 
inner t:headerLink and if the link has 
immediate="true", convert the submittedValue and update the model only for 
t:collapsiblePanel, because immediate="true"
skips process validation and update model phase.

The solution discussed before solves:

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.

The last problem is an undocumented feature about how to use t:collapsiblePanel 
with t:subform (only works if all previous
works!!). Look this example:

<h:form id="form">
    <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>
</h:form>

Since h:headerLink has been corrected, actionFor works and the expected result 
is obtained. 

I'll close all three issues as fixed (first we need some code cleanup).

> Action / ActionListener on t:headerLink
> ---------------------------------------
>
>                 Key: TOMAHAWK-1110
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1110
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.6
>         Environment: Java 5 + Tomcat 6
>            Reporter: Jesper Pedersen
>         Attachments: faces-config.patch, HtmlCollapsiblePanelRenderer.patch, 
> HtmlHeaderLinkRenderer.patch, RendererUtils.patch
>
>
> The action and actionListener attributes of t:headerLink are never evaluated.
> F.ex.
>   <t:collapsiblePanel id="p1"
>                       value="#{b.collapsed}" 
>                       title="p1">
>     <f:facet name="header">
>       <t:headerLink value="H1"
>                      action="#{b.goMenu}">
>         <f:actionListener 
> type="org.apache.test.menu.HeaderLinkActionListener" />
>       </t:headerLink>
>     </f:facet>
>     <h:panelGrid columns="1">
>       <h:panelGroup>
>         <h:outputText escape="false" value="Test"/>
>       </h:panelGroup>
>     </h:panelGrid>
>   </t:collapsiblePanel>
> Log statements in b.goMenu and processAction() are never displayed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to