You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Haselbach <ch...@tngtech.com> on 2007/03/01 11:09:11 UTC

[T4] Adding body of a sub-component w/o using a template

Hello,

is it possible to add a body to a sub-component w/o using a template? I
tried to inject the sub-component (which is specified in the jwc) into
the class and than use addBody(). However, doing this during render adds
a new body during each render. Doing it during finishLoad is not
possible, because i cannot access the sub-component.

Any ideas? Thanks in advance.

Regards,
Christian
-- 
Christian Haselbach - christian.haselbach@tngtech.com - +49 176 2082 5804
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Gerhard Müller, Eike Reinel
Amtsgericht München, HRB 135082

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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by Jesse Kuhnert <jk...@gmail.com>.
Yes. What Richard says.

This is how the Shell component renders javascript includes for instance...

On 3/5/07, Richard Kirby <rb...@capdm.com> wrote:
> Hi Christian,
>
> Assuming your LinkSubmit subcomponent extends the
> org.apache.tapestry.form.LinkSubmit class, just override the
>
> public void renderBody(IMarkupWriter writer, IRequestCycle cycle)
>
> method and put in whatever code you like.
>
> Cheers
>
> Richard
>
> Christian Haselbach wrote:
> > On Sun, Mar 04, 2007 at 03:29:04AM +0200, andyhot wrote:
> >
> >> You can't dynamically change the component structure
> >>
> >
> > Well, I do not really want to change it dynamically, so this is not the
> > problem.
> >
> >
> >> Now, i still can't understand your use case, so i can't offer any help there
> >> (what's the meaning of "influence its body w/o using a template"), but
> >>
> >
> > Let me refrase this:
> > When using a template I can give a subcomponent a body. How can I do it
> > w/o using a template? I have a LinkSubmit subcomponent, which I want to
> > have render its content with a certain body. While I can define this
> > body using a template, the template looks ugly (in this case, not in
> > general). It is better understandable when written programmatically.
> >
> >
> >> perhaps you can build a custom component and pass parameters to it...
> >>
> >
> > Sure, but that would be mostly a rewriting of LinkSubmit. I rather hoped
> > I could reuse LinkSubmit.
> >
> > The use case is pretty simple: A specialized LinkSubmit component.
> >
> > Regards,
> > Christian
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by Richard Kirby <rb...@capdm.com>.
Hi Christian,

Assuming your LinkSubmit subcomponent extends the 
org.apache.tapestry.form.LinkSubmit class, just override the

public void renderBody(IMarkupWriter writer, IRequestCycle cycle)

method and put in whatever code you like.

Cheers

Richard

Christian Haselbach wrote:
> On Sun, Mar 04, 2007 at 03:29:04AM +0200, andyhot wrote:
>   
>> You can't dynamically change the component structure
>>     
>
> Well, I do not really want to change it dynamically, so this is not the
> problem.
>
>   
>> Now, i still can't understand your use case, so i can't offer any help there
>> (what's the meaning of "influence its body w/o using a template"), but
>>     
>
> Let me refrase this:
> When using a template I can give a subcomponent a body. How can I do it
> w/o using a template? I have a LinkSubmit subcomponent, which I want to
> have render its content with a certain body. While I can define this
> body using a template, the template looks ugly (in this case, not in
> general). It is better understandable when written programmatically.
>
>   
>> perhaps you can build a custom component and pass parameters to it...
>>     
>
> Sure, but that would be mostly a rewriting of LinkSubmit. I rather hoped
> I could reuse LinkSubmit.
>
> The use case is pretty simple: A specialized LinkSubmit component.
>
> Regards,
> Christian
>
>   


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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by Christian Haselbach <ch...@tngtech.com>.
On Sun, Mar 04, 2007 at 03:29:04AM +0200, andyhot wrote:
> You can't dynamically change the component structure

Well, I do not really want to change it dynamically, so this is not the
problem.

> Now, i still can't understand your use case, so i can't offer any help there
> (what's the meaning of "influence its body w/o using a template"), but

Let me refrase this:
When using a template I can give a subcomponent a body. How can I do it
w/o using a template? I have a LinkSubmit subcomponent, which I want to
have render its content with a certain body. While I can define this
body using a template, the template looks ugly (in this case, not in
general). It is better understandable when written programmatically.

> perhaps you can build a custom component and pass parameters to it...

Sure, but that would be mostly a rewriting of LinkSubmit. I rather hoped
I could reuse LinkSubmit.

The use case is pretty simple: A specialized LinkSubmit component.

Regards,
Christian

-- 
Christian Haselbach - christian.haselbach@tngtech.com - +49 176 2082 5804
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Gerhard Müller, Eike Reinel
Amtsgericht München, HRB 135082

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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by andyhot <an...@di.uoa.gr>.
You can't dynamically change the component structure

See http://tapestry.apache.org/tapestry5/
the part discussing "Principal 1 -- Static Structure, Dynamic Behavior"

Now, i still can't understand your use case, so i can't offer any help there
(what's the meaning of "influence its body w/o using a template"), but
perhaps you can build a custom component and pass parameters to it...


Christian Haselbach wrote:
> On Thu, Mar 01, 2007 at 08:56:58PM +0200, andyhot wrote:
>   
>> Can you give an example of what you're trying to accomplish ?
>>     
>
> In this case I want to render customized LinkSubmit. For that I have
> LinkSubmit as subcomponent, but want to influence its body w/o using a
> template. With the addBody function I can add the custom renderer, but I
> cannot find the right way to do it, as I explained formerly.
>
> Regards,
> Christian
>
>   


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by Christian Haselbach <ch...@tngtech.com>.
On Thu, Mar 01, 2007 at 08:56:58PM +0200, andyhot wrote:
> Can you give an example of what you're trying to accomplish ?

In this case I want to render customized LinkSubmit. For that I have
LinkSubmit as subcomponent, but want to influence its body w/o using a
template. With the addBody function I can add the custom renderer, but I
cannot find the right way to do it, as I explained formerly.

Regards,
Christian

-- 
Christian Haselbach - christian.haselbach@tngtech.com - +49 176 2082 5804
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Gerhard Müller, Eike Reinel
Amtsgericht München, HRB 135082

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


Re: [T4] Adding body of a sub-component w/o using a template

Posted by andyhot <an...@di.uoa.gr>.
Can you give an example of what you're trying to accomplish ?

Christian Haselbach wrote:
> Hello,
>
> is it possible to add a body to a sub-component w/o using a template? I
> tried to inject the sub-component (which is specified in the jwc) into
> the class and than use addBody(). However, doing this during render adds
> a new body during each render. Doing it during finishLoad is not
> possible, because i cannot access the sub-component.
>
> Any ideas? Thanks in advance.
>
> Regards,
> Christian
>   


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


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