You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2007/10/24 11:58:00 UTC
Renderer and encodeChildren
Hi!
In JSF 1.1 I am curious about the javax.faces.renderer.Renderer class in
JSF 1.1, in particular the following piece of code:
public void encodeChildren(FacesContext context,
UIComponent component)
throws IOException
{
if (context == null) throw new NullPointerException("context");
if (component == null) throw new NullPointerException("component");
List children = component.getChildren();
for (int i=0; i<children.size(); i++)
{
UIComponent child = (UIComponent) children.get(i);
if (!child.isRendered())
{
continue;
}
child.encodeBegin(context);
if (child.getRendersChildren())
{
child.encodeChildren(context);
}
child.encodeEnd(context);
}
}
I wonder WHEN are the children rendered if the component returns false
on getRendersChildren here.
And how/why does it work when mixing things, lets say you have
t:div/h:panelGroup/t:div
where t:div returns false on getRendersChildren() and h:panelGroup
returns true.
Is there a simple answer to this?
Ciao,
Mario
Re: Renderer and encodeChildren
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> if getRendersChildren() returns fals, the JSP-tag will call encodeChildren().
>
I still wonder how the mixing of rendersChildren true/false/true/false
is going to work, but I've seen the code in >JSF1.1 is much easier so I
am not going to spend any more time on this topic.
Thanks!
Ciao,
Mario
Re: Renderer and encodeChildren
Posted by Martin Marinschek <ma...@gmail.com>.
Hi Mario,
if getRendersChildren() returns fals, the JSP-tag will call encodeChildren().
regards,
Martin
On 10/24/07, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
> In JSF 1.1 I am curious about the javax.faces.renderer.Renderer class in
> JSF 1.1, in particular the following piece of code:
>
> public void encodeChildren(FacesContext context,
> UIComponent component)
> throws IOException
> {
> if (context == null) throw new NullPointerException("context");
> if (component == null) throw new NullPointerException("component");
>
> List children = component.getChildren();
> for (int i=0; i<children.size(); i++)
> {
> UIComponent child = (UIComponent) children.get(i);
>
> if (!child.isRendered())
> {
> continue;
> }
>
> child.encodeBegin(context);
> if (child.getRendersChildren())
> {
> child.encodeChildren(context);
> }
> child.encodeEnd(context);
> }
> }
>
>
> I wonder WHEN are the children rendered if the component returns false
> on getRendersChildren here.
> And how/why does it work when mixing things, lets say you have
> t:div/h:panelGroup/t:div
> where t:div returns false on getRendersChildren() and h:panelGroup
> returns true.
>
> Is there a simple answer to this?
>
> Ciao,
> Mario
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: Renderer and encodeChildren
Posted by Sochor Zdeněk <zd...@ataco.cz>.
Hi,
as to why does it work, the answer should be simple - almost all
renderers in MyFaces do ALL encoding work in encodeEnd method
(including rendering children).
But what do i wonder more is why page's component tree contains ALL
previously rendered/encoded components.
Wouldn't it make sense to remove non-rendered components from it?
I came across this issue when discussing topic: "TabbedPane does not
validate non-selected tabs in server side tab switching mode (Relaed to
TOMAHAWK-1012 <https://issues.apache.org/jira/browse/TOMAHAWK-1012>)."
Best regards,
Zdenek
Mario Ivankovits napsal(a):
> Hi!
>
> In JSF 1.1 I am curious about the javax.faces.renderer.Renderer class in
> JSF 1.1, in particular the following piece of code:
>
> public void encodeChildren(FacesContext context,
> UIComponent component)
> throws IOException
> {
> if (context == null) throw new NullPointerException("context");
> if (component == null) throw new NullPointerException("component");
>
> List children = component.getChildren();
> for (int i=0; i<children.size(); i++)
> {
> UIComponent child = (UIComponent) children.get(i);
>
> if (!child.isRendered())
> {
> continue;
> }
>
> child.encodeBegin(context);
> if (child.getRendersChildren())
> {
> child.encodeChildren(context);
> }
> child.encodeEnd(context);
> }
> }
>
>
> I wonder WHEN are the children rendered if the component returns false
> on getRendersChildren here.
> And how/why does it work when mixing things, lets say you have
> t:div/h:panelGroup/t:div
> where t:div returns false on getRendersChildren() and h:panelGroup
> returns true.
>
> Is there a simple answer to this?
>
> Ciao,
> Mario
>
>
>