RE: Link text
You might want to look at IComponentBorder -Clay -Original Message- From: Sam Hough [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 5:47 AM To: users@wicket.apache.org Subject: Re: Link text Anything similar for spitting something out _after_ the tag that the component is mapped to? e.g. Sending out some text/html after a checkbox? Presumably onComponentTagBody doesn't get called because it is not a Container and the input tag is send after anything I do in onComponentTag :( 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#a13624806 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
Doh. Should have thought of Behaviours (sic). Guess my coding style is a bit old fashioned trying to use extension from than composition. Must re-read that great article about the pattern behind Spring not intending things to be extended. Cheers Sam Al Maw wrote: > > Sam Hough wrote: >> Anything similar for spitting something out _after_ the tag that the >> component is mapped to? e.g. Sending out some text/html after a checkbox? >> >> Presumably onComponentTagBody doesn't get called because it is not a >> Container and the input tag is send after anything I do in onComponentTag >> :( > > Have a look at how WicketAjaxIndicatorAppender works. > > 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#a13624978 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
Sam Hough wrote: Anything similar for spitting something out _after_ the tag that the component is mapped to? e.g. Sending out some text/html after a checkbox? Presumably onComponentTagBody doesn't get called because it is not a Container and the input tag is send after anything I do in onComponentTag :( Have a look at how WicketAjaxIndicatorAppender works. Regards, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
Anything similar for spitting something out _after_ the tag that the component is mapped to? e.g. Sending out some text/html after a checkbox? Presumably onComponentTagBody doesn't get called because it is not a Container and the input tag is send after anything I do in onComponentTag :( 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#a13624806 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
Not counted but not far off as almost all the link are the names/titles of objects in search results/detail panels etc... igor.vaynberg wrote: > > yes, but is the text dynamic on 90% of your links??? > > most of the time if you want i18n its just > > > > -igor > > > On 11/5/07, Sam Hough <[EMAIL PROTECTED]> wrote: >> >> 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] >> >> > > - > 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#a13591418 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
yes, but is the text dynamic on 90% of your links??? most of the time if you want i18n its just -igor On 11/5/07, Sam Hough <[EMAIL PROTECTED]> wrote: > > 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link text
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]
Re: Link text
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]
Re: Link text
Monday, November 5, 2007, 12:16:50 PM, Sam wrote: SH> Lots of the time I just want a link with text as the body of the SH> ... ... The Link class takes an IModel so presumably uses that for SH> something but I can't see it in the source or get it to appear... It's typically just used so the model object's available if you want to pass arguments to the destination - see the javadoc. For what I think you're after, you'd need to have something like Link then do Link link = new Link("link") { public void onClick() { // ToDo: Implement this! } }; Label label = new Label("linkTitle"); // or new Label("linkTitle", ); link.add(label); add(link); or similar, e.g. add( new Link("link") { public void onClick() { // ToDo: Implement this! } }.add(new Label("linkTitle"))); if you prefer! -- /Gwyn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]