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 <phil.gr...@gmail.com> 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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to