Dependency between TreeNode type and tree2 facet name should be loosened, to 
enable rendering of generic trees
--------------------------------------------------------------------------------------------------------------

         Key: MYFACES-890
         URL: http://issues.apache.org/jira/browse/MYFACES-890
     Project: MyFaces
        Type: Wish
  Components: Tomahawk  
    Versions: 1.1.0    
    Reporter: Erik Dybdahl
    Priority: Minor


If, during rendering of a tree2, a node is found whose type does not correspond 
to the name of a facet under the tree2 widget, this error results:
javax.faces.FacesException: org.apache.jasper.JasperException: Unable to locate 
facet with the name: <value of TreeNode.getType()>
        at 
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:327)
        at 
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
        at 
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)

(this will also be the result if the value of som type is changed and cookies 
are retained between renderings, a fact that is described in other bug issues).
To a certain extent a view component has to know what the model look like, but 
the coupling should be as loose as possible.
For the tree2 widget, the use of string values to specify how a certain 
TreeNode type should be rendered, creates a somewhat too tight coupling.

A more generic approach would be to use the type of the node itself (the class) 
to determine how the node be rendered, provide a default rendering for 
TreeNodeBase, and enable more specfic rendering via references in the view to 
custom implementations of TreeNode.

Sorry if this issue has been discussed earlier. I've just started using myFaces.

Regards,
Erik

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to