You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2006/08/01 23:33:25 UTC

recursive rendering

Every once in a while I'll need to do some recursive rendering. Does
anyone know of a simple example of this using @Block?

-- 
Dan Adams
Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: recursive rendering

Posted by Bernard Lange <be...@man.poznan.pl>.
Dan Adams wrote:
> Thanks Bernard. Your template seems really straight forward. 

No problem :)

> The problem I having right now is that the block that is rendered is returned via an
> ognl expression and the expression is only being evaluated once. Do you
> know a way around this?

I'm not sure if I got it right, are we talking about this particular
part of the template?

<!-- render recursively child groups -->	
<condition jwcid="@Conditional"
  condition="ognl:group.reportGroups.size() > 0">
   <loop jwcid="@Foreach" source="ognl:group.reportGroups"
      value="ognl:group" >
 	<span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>
					  ^^^^^^^^^^^^^^^^^^^^^^^^^^^?
   </loop>
</condition>

When Foreach is rendered the ognl expression in

<span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>

is evaluated every time the RenderBlock gets rendered :) You can replace
it with a call to Java method and there return different blocks of your
choice.

I'm not sure if I understand what the problem really is. So you want
recursion or not :-) or you want block to change from time to time or
you neeed both?

Can you tell me what excactly are you trying to achieve and I may be
able to help?

Regards,
Bernard



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: recursive rendering

Posted by Dan Adams <da...@ifactory.com>.
Thanks Bernard. Your template seems really straight forward. The problem
I having right now is that the block that is rendered is returned via an
ognl expression and the expression is only being evaluated once. Do you
know a way around this?

On Wed, 2006-08-02 at 15:49 +0200, Bernard Lange wrote:
> Dan Adams wrote:
> > Every once in a while I'll need to do some recursive rendering. Does
> > anyone know of a simple example of this using @Block?
> 
> We do it that way. This renders tree-like, no folding though, recursive
> structure of report groups containing other report groups (which are
> compound nodes) and reports (leafs). Root group is given as a parameter,
> but it may be as well page property with initial value set to sth. You
> also need some exit condition, which in this case is size of
> reportGroups property.
> 
> Note that the group property is updated in the second loop so that the
> recursive call to "groupBlock" could render its children properly.
> 
> Some styling has been removed for a sake of readability:
> 
> *<HTML template>*
> <span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>
> 
> <block jwcid="groupBlock@Block" >
>   <!-- current group name -->
>   <span jwcid="@Insert" value="ognl:group.name" />
> 	
>   <!-- list of children reports) -->
>   <loop jwcid="@Foreach" source="ognl:group.reports"
> 	value="ognl:report" element="ul">
> 					
>     <li><span jwcid="@Insert" value="ognl:report.name" /></li>
>   </loop>
> 
>   <!-- render recursively child groups -->	
>   <condition jwcid="@Conditional"
> condition="ognl:group.reportGroups.size() > 0">
>     <loop jwcid="@Foreach" source="ognl:group.reportGroups"
> value="ognl:group" >
> 	<span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>
>     </loop>
>  </condition>
> 
> </block>
> 
> 
> *<JWCID>*
> <component-specification class="org.apache.tapestry.BaseComponent"
>     allow-body="no" allow-informal-parameters="no">
> 
>     <parameter name="group" type="YYY"
>     	required="yes"
>     	direction="auto"
>     />
> 
>     <property-specification name="report" type="XXX"/>
> 
> </component-specification>
> 
> 
> best regards,
> Bernard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: recursive rendering

Posted by Bernard Lange <be...@man.poznan.pl>.
Dan Adams wrote:
> Every once in a while I'll need to do some recursive rendering. Does
> anyone know of a simple example of this using @Block?

We do it that way. This renders tree-like, no folding though, recursive
structure of report groups containing other report groups (which are
compound nodes) and reports (leafs). Root group is given as a parameter,
but it may be as well page property with initial value set to sth. You
also need some exit condition, which in this case is size of
reportGroups property.

Note that the group property is updated in the second loop so that the
recursive call to "groupBlock" could render its children properly.

Some styling has been removed for a sake of readability:

*<HTML template>*
<span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>

<block jwcid="groupBlock@Block" >
  <!-- current group name -->
  <span jwcid="@Insert" value="ognl:group.name" />
	
  <!-- list of children reports) -->
  <loop jwcid="@Foreach" source="ognl:group.reports"
	value="ognl:report" element="ul">
					
    <li><span jwcid="@Insert" value="ognl:report.name" /></li>
  </loop>

  <!-- render recursively child groups -->	
  <condition jwcid="@Conditional"
condition="ognl:group.reportGroups.size() > 0">
    <loop jwcid="@Foreach" source="ognl:group.reportGroups"
value="ognl:group" >
	<span jwcid="@RenderBlock" block="ognl:components.groupBlock"/>
    </loop>
 </condition>

</block>


*<JWCID>*
<component-specification class="org.apache.tapestry.BaseComponent"
    allow-body="no" allow-informal-parameters="no">

    <parameter name="group" type="YYY"
    	required="yes"
    	direction="auto"
    />

    <property-specification name="report" type="XXX"/>

</component-specification>


best regards,
Bernard

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: recursive rendering

Posted by Dan Adams <da...@ifactory.com>.
Thanks Mike. Yeah, I've read that article at least twice now and read
through the code. :) I'm having a problem that you may have run into;
much like your code the block to render is returned via an ognl
expression and it apprears the the expression is only being evaluated
once and not each time. Did you ever have this problem?

On Tue, 2006-08-01 at 16:04 -0700, Mike Henderson wrote:
> Hi,
>   It's a T3 example but it should show how it's done:
> 
> http://www.behindthesite.com/blog/C1931765677/E923478269/index.html
> 
> Mike
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to specify a Component not in my Library?

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
Don't think you can do that. As a fix you could copy the Tapestry .jwc to 
your webapp and get the tap component that way.

"Jesse Kuhnert" <jk...@gmail.com> skrev i en meddelelse 
news:7926817e0608012124h3eeb9cbfod7c9ac1a406e061a@mail.gmail.com...
>I have to admit that I have no idea. If no one else come up with a quick
> answer I'll dig and find one.
>
> Does Framework:<Component Name> not work?
>
> On 8/2/06, Mark Stang <ms...@pingidentity.com> wrote:
>>
>> Jesse,
>> Thanks for the quick reply, however the components exist in "
>> PingCommon.Library".  What I want to do is to reference the "
>> Tapestry.Library" component with the same name.  You see, my component is
>> overriding the Tapestry Component for any component in my Library. 
>> Outside
>> of my Library, I can pick either one.  I guess I could change the name in
>> the .Library...
>>
>> Thoughts?
>>
>> thanks,
>>
>> Mark
>>
>>
>> -----Original Message-----
>> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
>> Sent: Tue 8/1/2006 9:15 PM
>> To: Tapestry users
>> Subject: Re: How to specify a Component not in my Library?
>>
>> Give your library a prefix by defining it in a .library file?
>>
>> ie markStangsLibrary:ComponentName
>> (I think you should literally make it markStangsLibrary, will make it
>> sound
>> more official )
>>
>> On 8/1/06, Mark Stang <ms...@pingidentity.com> wrote:
>> >
>> > I have a component in my Library that has the same name as one of the
>> > Tapestry Components.  How can I specify the "real" component?
>> >
>> > thanks,
>> >
>> > Mark
>> >
>> >
>>
>>
>> --
>> Jesse Kuhnert
>> Tacos/Tapestry, team member/developer
>>
>> Open source based consulting work centered around
>> dojo/tapestry/tacos/hivemind.
>>
>>
>>
>
>
> -- 
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: How to specify a Component not in my Library?

Posted by Mark Stang <ms...@pingidentity.com>.
Nope, tried Framework, framework and "tapestry".  None seemed to work.  I should have changed the name...But I left it up to Howard ;-).


-----Original Message-----
From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
Sent: Tue 8/1/2006 10:24 PM
To: Tapestry users
Subject: Re: How to specify a Component not in my Library?
 
I have to admit that I have no idea. If no one else come up with a quick
answer I'll dig and find one.

Does Framework:<Component Name> not work?

On 8/2/06, Mark Stang <ms...@pingidentity.com> wrote:
>
> Jesse,
> Thanks for the quick reply, however the components exist in "
> PingCommon.Library".  What I want to do is to reference the "
> Tapestry.Library" component with the same name.  You see, my component is
> overriding the Tapestry Component for any component in my Library.  Outside
> of my Library, I can pick either one.  I guess I could change the name in
> the .Library...
>
> Thoughts?
>
> thanks,
>
> Mark
>
>
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Tue 8/1/2006 9:15 PM
> To: Tapestry users
> Subject: Re: How to specify a Component not in my Library?
>
> Give your library a prefix by defining it in a .library file?
>
> ie markStangsLibrary:ComponentName
> (I think you should literally make it markStangsLibrary, will make it
> sound
> more official )
>
> On 8/1/06, Mark Stang <ms...@pingidentity.com> wrote:
> >
> > I have a component in my Library that has the same name as one of the
> > Tapestry Components.  How can I specify the "real" component?
> >
> > thanks,
> >
> > Mark
> >
> >
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.


Re: How to specify a Component not in my Library?

Posted by Jesse Kuhnert <jk...@gmail.com>.
I have to admit that I have no idea. If no one else come up with a quick
answer I'll dig and find one.

Does Framework:<Component Name> not work?

On 8/2/06, Mark Stang <ms...@pingidentity.com> wrote:
>
> Jesse,
> Thanks for the quick reply, however the components exist in "
> PingCommon.Library".  What I want to do is to reference the "
> Tapestry.Library" component with the same name.  You see, my component is
> overriding the Tapestry Component for any component in my Library.  Outside
> of my Library, I can pick either one.  I guess I could change the name in
> the .Library...
>
> Thoughts?
>
> thanks,
>
> Mark
>
>
> -----Original Message-----
> From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
> Sent: Tue 8/1/2006 9:15 PM
> To: Tapestry users
> Subject: Re: How to specify a Component not in my Library?
>
> Give your library a prefix by defining it in a .library file?
>
> ie markStangsLibrary:ComponentName
> (I think you should literally make it markStangsLibrary, will make it
> sound
> more official )
>
> On 8/1/06, Mark Stang <ms...@pingidentity.com> wrote:
> >
> > I have a component in my Library that has the same name as one of the
> > Tapestry Components.  How can I specify the "real" component?
> >
> > thanks,
> >
> > Mark
> >
> >
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

RE: How to specify a Component not in my Library?

Posted by Mark Stang <ms...@pingidentity.com>.
Jesse,
Thanks for the quick reply, however the components exist in "PingCommon.Library".  What I want to do is to reference the "Tapestry.Library" component with the same name.  You see, my component is overriding the Tapestry Component for any component in my Library.  Outside of my Library, I can pick either one.  I guess I could change the name in the .Library...

Thoughts?

thanks,

Mark


-----Original Message-----
From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
Sent: Tue 8/1/2006 9:15 PM
To: Tapestry users
Subject: Re: How to specify a Component not in my Library?
 
Give your library a prefix by defining it in a .library file?

ie markStangsLibrary:ComponentName
(I think you should literally make it markStangsLibrary, will make it sound
more official )

On 8/1/06, Mark Stang <ms...@pingidentity.com> wrote:
>
> I have a component in my Library that has the same name as one of the
> Tapestry Components.  How can I specify the "real" component?
>
> thanks,
>
> Mark
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.


Re: How to specify a Component not in my Library?

Posted by Jesse Kuhnert <jk...@gmail.com>.
Give your library a prefix by defining it in a .library file?

ie markStangsLibrary:ComponentName
(I think you should literally make it markStangsLibrary, will make it sound
more official )

On 8/1/06, Mark Stang <ms...@pingidentity.com> wrote:
>
> I have a component in my Library that has the same name as one of the
> Tapestry Components.  How can I specify the "real" component?
>
> thanks,
>
> Mark
>
>


-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

How to specify a Component not in my Library?

Posted by Mark Stang <ms...@pingidentity.com>.
I have a component in my Library that has the same name as one of the Tapestry Components.  How can I specify the "real" component?

thanks,

Mark

Re: recursive rendering

Posted by Mike Henderson <mh...@mac.com>.
Hi,
  It's a T3 example but it should show how it's done:

http://www.behindthesite.com/blog/C1931765677/E923478269/index.html

Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org