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>