I have serious doubts for modifying the BPL. What should it do when no model is provided? How about the other Link classes? Using the Link's model for this is a faux pas: it is used in the onclick handler. Adding another IModel parameter (the displayed string does need to be localized in many contexts)? What if the link is to participate with inherited models?
It is trivial for anyone to add such a class for their particular usecase. We have built an application with 150+ pages, and we haven't found a need for such a link. And I'm 100% sure that 99% of Link implementations actually don't have an embedded label component, but have static text inside the markup. If the need arises for localized strings, I suggest using <wicket:message key="foo" /> instead. As for other committers, many have voiced a concern with the ever growing API and convenience methods. What this solves is merely a very minor inconvenience, with greater implications. Removing 'RequiredTextField' is very inconvenient for current users of that field, but bloats the API and I think removing it helps Wicket. Similarly in this case: adding it doesn't help Wicket, but bloats the api. There are enough possibilities already to solve this. Martijn On 10/25/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
I think we should add such a class or extend links behavior. This question comes up what, once a month? And I believe some committers (Johan?) have said they would like such a component too. Eelco On 10/25/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote: > Hi Martinj, > > well, i like frameworks that let me do what i want but also i like them if > they take me the full 9 yards... > > Regards > > > -----Ursprüngliche Nachricht----- > > Von: Martijn Dashorst [mailto:[EMAIL PROTECTED] > > Gesendet: Montag, 23. Oktober 2006 20:17 > > An: [email protected] > > Betreff: Re: Feature Idea / Request > > > > Hi Korbinian, > > > > I have several problems with this proposal: > > - the link class now has just one purpose: being a link. It > > knows how to attach itself to a markup tag and how to make > > the link stuff work. > > Automagically adding the label opens up the can of worms for > > all links. > > - the link class can contain *any* markup, not just labels > > - you propose a mere convenience that can be easiliy > > implemented in your own custom class: > > public MyOwnLabeledBookmarkableLink extends BookmarkablePageLink { > > public MyOwnLabeledBoomarkableLink(id, pageparameters, > > IModel label) { > > super(id, pageparameters); > > this.label = label; > > } > > protected void onComponentTagBody(final MarkupStream > > markupStream, final ComponentTag openTag) > > { > > replaceComponentTagBody(markupStream, openTag, > > label.getObject(this).toString()); > > } > > } > > > > One of the goals of Wicket is to be able to create reusable > > components yourself, and this is a perfect case for that. > > Another goal is to keep the framework small and focused, not > > the whole nine yards. > > > > Martijn > > > > > > On 10/22/06, Korbinian Bachl <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > i've come over a point where i think it might be useful to make a > > > thing easier. Im talking about BookmarkablePageLink. > > > > > > Usually a link consists of following in html: <a > > > href="URL">DESCRIPTION</a> > > > > > > while in Wicket a BookmarkablePageLink only (!) alters the > > URL, e.g: a > > > BPL has to be: > > > <a href="#" wicket:id="myLinkId"><span > > > wicket:id="myLinkLabel">foo</span></a> > > > > > > couldnt this be simplfied to just: > > > <a href="#" wicket:id="myLinkId">foo</a> > > > > > > and the constructor could then be: > > > public BookmarkablePageLink(final String id, final Class pageClass, > > > final PageParameters parameters, final String linkDescription) > > > > > > > > > wouldnt this be a bit nicer? > > > > > > ive come over this as i create a list with links, but without a > > > description it makes no sense, e.g: > > > > > > List navList = new ArrayList(); > > > navList.add(new BookmarkablePageLink("linkTo",A.class).add(new > > > Label("linkName","FOOA"))); > > > navList.add(new BookmarkablePageLink("linkTo",B.class).add(new > > > Label("linkName","FOO HSH"))); > > > navList.add(new BookmarkablePageLink("linkTo",C.class).add(new > > > Label("linkName","FOO BAR BAR"))); > > > > > > just my 2 cents, > > > > > > Best Regards, > > > > > > Korbinian > > > > > > PS: if im wrong anywhere please let me know! > > > > > > > > > > > > -- > > <a > > href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a> > > for <a > > href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a> > > at the <a href="http://www.thebeststuffintheworld.com/">Best > > Stuff in the World!</a> > > > >
-- <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in the World!</a>
