As for other committers, many have voiced a concern with the ever
growing API and convenience methods.

Yes. I was probably number one in voicing that last year. Still many
convenience thingies made without too much discussion.

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.

I'm just getting tired of getting this same question all the time.
What we could do is something cheap API wise, like adding a method
like this:

protected String getLabel() {
 return null;
}

onComponentTagBody (which is final!) then does:

protected final void onComponentTagBody(final MarkupStream
markupStream, final ComponentTag openTag) {

 if (!isEnabled() && getBeforeDisabledLink() != null) {
   getResponse().write(getBeforeDisabledLink());
 }

 String label = getLabel();
 if (label != null) {
   getResponse().write(label);
 }

 renderComponentTagBody(markupStream, openTag);

 if (!isEnabled() && getAfterDisabledLink() != null) {
   getResponse().write(getAfterDisabledLink());
 }
}

Imo that a solution that doesn't bloat that much, would be cheaper to
in then nesting labels, would still encourage making a custom class,
but at least makes it easily possible to create an anonymous
implementation to do this.

(btw, I didn't test this code yet)

Eelco

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>

Reply via email to