[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Programmatically generating DirectLinks with updateComponents
From:       "Andreas Andreou" <andreoua () gmail ! com>
Date:       2007-12-24 13:56:54
Message-ID: 745369620712240556s86f69baof0544711ea4e4997 () mail ! gmail ! com
[Download RAW message or body]

I'm wondering if you can just extend from BaseComponent,
include an html template that just has a DirectLink
and in your renderComponent() call
super.renderComponent() each time you want to output the direct link

The other solution is to implement IDirect (similarly to what DirectLink does)

On Dec 24, 2007 11:39 AM, Kaspar Fischer <fischerk@inf.ethz.ch> wrote:
>
> On 22.12.2007, at 23:30, Andreas Andreou wrote:
>
> > Hi,
> > what's the html template for
> > ResultElement ?
> > Can't you add the link there?
>
> ResultElement does not have a HTML but is an AbstractComponent rendering
> its content using the renderComponent(). The name "ResultElement" is
> a little
> missleading; in reality, ResultElement's renderComponent() method
> renders
> a tree-like structure and needs to emit lots of DirectLinks with update-
> Components:
>
> >> ... and from the code (ResultElement's renderComponent()) I try to
> >> render the link as follows:
> >>
> >>      DirectLink link = (DirectLink)this.getContainer().getComponent
> >> ("link");
> >>      String url = link.getLink(cycle).getURL();
> >>      writer.begin("a");
> >>      writer.appendAttribute("href", url);
> >>      writer.print(title);
> >>      writer.end();
>
> In the meantime I've taken a look at DefaultLinkRenderer.java and see
> how
> they output the onClick element. But this does not seem to anwser my
> original question:
>
> How can I programatically generate a DirectLink? Is the above way of
> doing it (using getComponent("link"), referring to an existing
> DirectLink
> component, that is) the "right" way? If so, how would I add a body to
> the component?
>
> I'd prefer to generate the link like this:
>
>    DirectLink mylink = new DirectLink(...);
>    // how to add the body of the link?
>
> How can I do this?
>
>
> Kaspar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic