Search code examples
jsf-2treemyfacestrinidad

Trinidad tr:treeTable expand/collapse commands


I am using Trinidad 2.0. My problem is expand/collapse commands of treeTable. I think they are supposed to automatically expand/collapse tree nodes, but by clicking them, nothing happens and I got the exception

SEVERE: Error Rendering View[/MyXhtml.xhtml]
01/05/2012 15:31:08 org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer encodeAll   
SEVERE: Error displaying partial page   
java.lang.NullPointerException   
    at org.apache.myfaces.trinidad.render.CoreRenderer.getFacesBean(CoreRenderer.java:739)   
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.TreeTableRenderer.renderSpecialColumns(TreeTableRenderer.java:379)   
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopTableRenderer.renderSingleRow(DesktopTableRenderer.java:113)   
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TableRenderer.encodeAll(TableRenderer.java:388)   
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.TreeTableRenderer.encodeAll(TreeTableRenderer.java:177)

and I see this exception in FireBug:

_logError(varArgs="Invalid PPR response. T...ror></partial-response>") 

How is this caused and how can I solve it?

We are doing migration from JSF 1.2 to JSF 2.0. In JSF 1.2 the <tr:treeTable> works fine, but now with JSF 2.0 and trinidad 2.0 I have these errors when I try to expand or collapse nodes. By the way, component <tr:tree> from trinidad 2.0 works just fine, but we need <tr:treeTable>.

The JARs used by the webapplication are:

  • commons-beanutils-1.8.3.jar
  • commons-codec-1.3.jar
  • commons-collections-3.2.jar
  • commons-digester-1.8.jar
  • commons-logging-1.1.1.jar
  • myfaces-bundle-2.1.7.jar
  • myfaces-impl-2.1.7.jar
  • trinidad-api-2.0.0.jar
  • trinidad-impl-2.0.0.jar

I am using MyEclipse 10 as IDE.


Solution

  • According to the Trinidad 2.0.0 source code, this is what is happening around line 739 of CoreRenderer#getFacesBean():

    736   protected FacesBean getFacesBean(
    737     UIComponent component)
    738   {
    739     return ((UIXComponent) component).getFacesBean();
    740   }
    

    So, component is null.

    You probably don't want to hear this, but this is really a bug in Trinidad as it's only been used by Trinidad internal code. I'd start upgrading to the latest Trinidad 2.x version (which is currently 2.0.1). It might already be fixed in there. If not, then report it as a new bug to the Trinidad guys.