Hi, I also find myself often in the situation to create two components Link + Label for a link. So, I would appreciate if Link's used their model for the element content.
Best regards, Peter Martijn Dashorst wrote: > > Not everybody puts a label inside a link. Not as common as you might > think it is. It is also common to attach a link to a span, div, td or > even tr. > > Martijn > > On Wed, Dec 17, 2008 at 12:29 AM, Phil Grimm <[email protected]> wrote: >> Guys, >> >> Maybe I'm missing something, but it seems odd that I need to create >> custom >> components in order to set the label on a link. The ability to set the >> label >> (the text the user sees) on a link seems like a very basic use case. Why >> would that not be provided in all Link classes? >> >> So far, I've needed to create my own LabeledLink, LabeledSubmitLink and >> now >> it looks like I need to create a LabeledPageLink in order to do what >> ExternalLink already provides. >> >> I'm not sure this is the best way to do this, but this is what I've done >> to >> implement a Link that allows the label to be specified. >> >> public class LabeledLink extends Link >> { >> protected String label; >> >> public LabeledLink(java.lang.String id, IModel model, String label) >> { >> super(id, model); >> this.label = label; >> } >> >> @Override >> protected void onComponentTagBody(final MarkupStream markupStream, >> final >> ComponentTag openTag) >> { >> replaceComponentTagBody(markupStream, openTag, label); >> } >> } >> >> Is there a better way? >> Am I missing something? >> >> Thanks! >> Phil >> > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > Apache Wicket 1.3.4 is released > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://old.nabble.com/Why-don%27t-all-Link-classes-support-a-label-like-ExternalLink-does--tp21044160p26469569.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
