You need to rewrite your recursive approach as a non-recursive one.

Take a look at the wiki for the Tree component:
http://wiki.apache.org/tapestry/Tapestry5TreeComponent?highlight=%28Tapestry
5%29

The code is a bit out of date because of changes to the handling of
Javascript, but you can see how something that is normally recursive is done
in Tapestry.

Jonathan



> -----Original Message-----
> From: Antonio Ordoñez [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 22, 2008 10:56
> To: Tapestry users
> Subject: Question about recursion in a component
> 
> Hallo everybody.
> 
> My question is about how could I implement a recursion in tapestry 5?
> exactly in a tree component. I have a collection of nodes with a Node
> father and a Collection children, then in the tml I have a loop and
> check if the actual node is father or not, but I want execute again the
> same control for each children.
> 
> <t:loop t:source="source" t:value="item">
>            <t:if t:test="father">
>                <tr>
>                    <td width="1%" valign="top" style="cursor:pointer">
>                        <img src="images/plus.gif" border="0"
> onclick="javascript:UTILS_Change_Display('${item.identifier}')"/>
>                    </td>
>                    <td width="1%" valign="top">
>                        <img src="images/folder.gif" border="0"
> alt="${item.identifier}"/>
>                    </td>
>                    <td width="1%" nowrap="true" valign="top"
> onClick="javascript:UTILS_Change_Color('name_${item.identifier}',
> 'black', '#0000ff');">
>                        <span id="name_${item.identifier}"
> style="cursor:pointer">
>                            ${item.name}
>                        </span>
>                    </td>
>                    <td width="*" valign="top">
>                        <div id="${item.identifier}"
> name="${item.identifier}" style="display:none">
>                            <table border="0" cellspacing="0"
> cellpadding="0">
>                               Here I want implements the recursion (at
> the momment I have another loop):
>                                <t:loop t:source="item.children"
> t:value="item">
>                                    <tr>
>                                        <td width="1%">
> 
>                                        </td>
>                                        <td width="1%" valign="top"
> style="padding-right:1mm">
>                                            <img src="images/folder.gif"
> border="0"/>
>                                        </td>
>                                        <td valign="top">
>                                            ${item.name}
>                                        </td>
>                                    </tr>
>                                </t:loop>
>                            </table>
>                        </div>
>                        &#160;
>                    </td>
>                </tr>
>            </t:if>
> </t:loop>
> 
> I'm new in tapestry and I don't know if is possible or not.
> 
> Thank you very much in advanced.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to