Thanks Al,

That is what I was after. The rendering stuff is waaay over my head.

Gwyn : nabble cut most of my post for some reason, I've been using two
components (link and label) but it seems very verbose when 90% of my links
are to text... Many thanks.

Cheers

Sam



Al Maw wrote:
> 
> Sam Hough wrote:
>> Lots of the time I just want a link with text as the body of the  ... ...
>> 
>> The Link class takes an IModel so presumably uses that for something but
>> I
>> can't see it in the source or get it to appear...
>> 
>> Sorry I'm being thick and I did search honest!
> 
> You'd typically use the model so you have something to get at in the 
> onClick().
> 
> Of course, if you don't care about how much state is in your session, 
> you can just make whatever it is final so you can use it in there anyway.
> 
> If you want to use the model for the text of the link instead, then you 
> could write a class like this:
> 
> 
> public abstract class TextLink extends Link {
>      public TextLink(String id, IModel model) {
>          super(id, model);
>      }
> 
>      protected void onComponentTagBody(final MarkupStream markupStream,
>              final ComponentTag openTag)
>      {
>          replaceComponentTagBody(
>                  markupStream, openTag, getModelObjectAsString()
>          );
>      }
> 
> }
> 
> 
> If you want enabled/disabled to work properly, you'll need to copy the 
> relevant bits out of AbstractLink#onComponentTagBody(...)
> 
> 
> Regards,
> 
> Al
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Link-text-tf4751114.html#a13591081
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to