You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2007/01/17 08:54:08 UTC

[Trinidad] NavigationPanelRenderer bug

Hi, I was wondering why this fragment renders well all its MenuModel tabs:  
  
         <tr:navigationPane hint="tabs" value="#{tabBean.tabData}" var="tab">  
            <f:facet name="nodeStamp">  
                 <tr:commandNavigationItem text="#{tab.label}" action="#{tab.action}"/>  
             </f:facet>  
             <tr:commandNavigationItem/>  
        </tr:navigationPane>  
  
while this renders nothing:  
  
         <tr:navigationPane hint="tabs" value="#{tabBean.tabData}" var="tab">  
            <f:facet name="nodeStamp">  
                 <tr:commandNavigationItem text="#{tab.label}" action="#{tab.action}"/>  
             </f:facet>  
         </tr:navigationPane>  
  
The problem is located in NavigationPanelRenderer.encodeAll() method, which
skips rendering if there are no children. However tabs can be defined either
by children or by stamping, so that having at least one dummy child like in my
example is enough to trigger rendering (rendering actually occurs by stamping,
they are mutually exclusive).  
I think that the test:  
  
    if (renderedItemCount > 0)  
  
should be something like:  
  
    int renderedRowCount = ((UIXHierarchy)component).getRowCount();  
    if (renderedItemCount > 0 || renderedRowCount > 0)  
  
Btw, I'm using a simple one-level MenuModel for this. It works, exept for
method getAction on items which is never called. GetLabel is called, though.  
  
\-- Renzo  
  
  
  


Re: [Trinidad] NavigationPanelRenderer bug

Posted by Renzo Tomaselli <re...@tecnotp.it>.
Chris, see my second bug posting. I patched NavigationPanelRenderer for 
both issues as suggested, and now everything seems working fine (I tried 
with an event listener).

Renzo

Chris Hansen wrote:
> I¹ve had the same problems. If you are using facelets, you can put a comment
> (<!--  -->) in the tr:navigationPane instead of using a dummy tag.
>
> What is really frustrating to me (since there is no workaround) is that the
> action never gets called on tr:commandNavigationItem used in this way. I
> thought I may have been doing something wrong at first, but now I think it
> is likely a bug.
>
> Thanks,
>   

Re: [Trinidad] NavigationPanelRenderer bug

Posted by Chris Hansen <ch...@overstock.com>.
I¹ve had the same problems. If you are using facelets, you can put a comment
(<!--  -->) in the tr:navigationPane instead of using a dummy tag.

What is really frustrating to me (since there is no workaround) is that the
action never gets called on tr:commandNavigationItem used in this way. I
thought I may have been doing something wrong at first, but now I think it
is likely a bug.

Thanks,
-- 
Chris Hansen
Overstock.com
Internal Applications
6350 South 3000 East
Salt Lake City, Utah 84121
Toll Free: 800.The.Big.O (843-2446)
www.overstock.com

On 1/17/07 1:54 AM, "Renzo Tomaselli" <re...@tecnotp.it> wrote:

> Hi, I was wondering why this fragment renders well all its MenuModel tabs:
> 
>          <tr:navigationPane hint="tabs" value="#{tabBean.tabData}" var="tab">
>             <f:facet name="nodeStamp">
>                  <tr:commandNavigationItem text="#{tab.label}"
> action="#{tab.action}"/>
>              </f:facet>
>              <tr:commandNavigationItem/>
>         </tr:navigationPane>
> 
> while this renders nothing:
> 
>          <tr:navigationPane hint="tabs" value="#{tabBean.tabData}" var="tab">
>             <f:facet name="nodeStamp">
>                  <tr:commandNavigationItem text="#{tab.label}"
> action="#{tab.action}"/>
>              </f:facet>
>          </tr:navigationPane>
> 
> The problem is located in NavigationPanelRenderer.encodeAll() method, which
> skips rendering if there are no children. However tabs can be defined either
> by children or by stamping, so that having at least one dummy child like in my
> example is enough to trigger rendering (rendering actually occurs by stamping,
> they are mutually exclusive).
> I think that the test:
> 
>     if (renderedItemCount > 0)
> 
> should be something like:
> 
>     int renderedRowCount = ((UIXHierarchy)component).getRowCount();
>     if (renderedItemCount > 0 || renderedRowCount > 0)
> 
> Btw, I'm using a simple one-level MenuModel for this. It works, exept for
> method getAction on items which is never called. GetLabel is called, though.
> 
> -- Renzo
> 
> 
> 
>