The specification is really messy in this case, stating that: "These methods are called during the render response phase in the request processing life cycle. EncodeAll () will call this component and all its children and faces that return true from isRendered (), which regardless of the return value getRendersChildren () will be rendered. encodeBegin (), encodeChildren () and encodeEnd () are responsible for creating response data to start this component, these are child components (only for calling if the component's rendersChildren property is true ), and the ending of this component, respectively. "
However, this seems to be a mixture of new and old functions, where the new functionality (encodeAll) seems to be incomplete in some respects:
I tried the following:
A) Calling a component directly on the page (without wrapping)
Extend UIComponentBase (or another UIComponent class, such as UIInput, UIOutput, etc.), declare it as a tag and use it in the user interface. In this case, the encodeAll method is called if it is present (overridden) if the encodeBegin and encodeEnd methods are not called !!
Another thing to note is to create a custom Renderer for the component so that you can separate processing logic from behavior. (creating another class that extends Renderer and annotates it with @FacesRenderer) Here it becomes interesting; Renderer defines only encodeBegin, encodeChildren and encodeEnd (without mentioning encodeAll). Now the logic looks something like this: if (encodeAll is present) encodeAll is called (and rendering is ignored!) Else if (any of encodeBegin, Children or end exists in a class that extends UIComponent) method call that was found in this component else if (encodeBegin , children or end exist in the class that Renderer extends) call the appropriate method that was found.
So, this means that the implementation of encodeAll (or encodeBegin .. etc.) in a class extending UIComponent forces the visualizer to be ignored!
B) The flow around a component (cc: implementation .. etc)
In this case, the same thing happens as above, except that encodeAll was not called in any way, no matter what I did.
Conclusion: It seems that encodeAll is some kind of new functionality (or shortcut) for implementing the rendering code, and it seems that cc: implementation has an error in this case (it does not look for encodeAll).
I hope this is at least some value for you, unfortunately, I canβt give a more thorough answer. :( It also seems that no one else knows.
source share