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

List:       tapestry-user
Subject:    Re: Programmatically generating DirectLinks with updateComponents
From:       Kaspar Fischer <fischerk () inf ! ethz ! ch>
Date:       2007-12-24 9:39:20
Message-ID: CC06DC1E-5F17-4D2E-A15B-08A4108110CE () inf ! ethz ! ch
[Download RAW message or body]


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

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

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