PartialViewContext#getRenderIds() implementation returns empty set
------------------------------------------------------------------

                 Key: RF-11112
                 URL: https://issues.jboss.org/browse/RF-11112
             Project: RichFaces
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: component-a4j-core
    Affects Versions: 4.0.0.Final
         Environment: Win7 x64, Eclipse Helios SR2, JBoss AS 6.0.0 Final, RF 
4.0.0 Final.
            Reporter: Bauke Scholtz


During invoke action phase we would like to retrieve a list of partial render 
IDs for some specific preprocessing (resetting submitted values for the case 
they're embedded in another form). Those IDs are normally available by 
{{PartialViewContext#getRenderIds()}}.

{code}
PartialViewContext partialViewContext = 
FacesContext.getCurrentInstance().getPartialViewContext();
Collection<String> renderIds = partialViewContext.getRenderIds();
{code}

This works fine in combination with standard JSF components, such as 
{{<h:commandLink><f:ajax render="foo"/></h:commandLink>}} However, when a 
RichFaces/A4J command component is been used, such as {{<a4j:commandLink 
render="foo" />}}, an empty collection is been returned instead. Debugging 
learns that the {{ExtendedPartialViewContextImpl}} implementation stores them 
in {{componentRenderIds}} instead of {{renderIds}} and never returns it on 
{{getRenderIds()}} method. The {{ExtendedPartialViewContextImpl}} also doesn't 
seem to use {{renderIds}} in a sensible manner anywhere else.

I believe that {{componentRenderIds}} really has to be {{renderIds}} instead.

As far now, we workarounded this by accessing the {{componentRenderIds}} field 
using reflection.

{code}
Collection<String> renderIds = partialViewContext.getRenderIds();

if (renderIds.isEmpty() && partialViewContext instanceof 
ExtendedPartialViewContextImpl) {
    try {
        Field componentRenderIds = 
ExtendedPartialViewContextImpl.class.getDeclaredField("componentRenderIds");
        componentRenderIds.setAccessible(true);
        renderIds = (Collection<String>) 
componentRenderIds.get(partialViewContext);
    } catch (Exception e) {
        // Handle.
    }
}
{code}

However, this introduced a nasty dependency in our code.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to