Using an external helper should do the trick, but it feels not so natural as a convenince method as mentioned in my previous email.
Would it be possible for such a method make its way into a future release? Regards. --- On Mon, 3/29/10, James Carman <jcar...@carmanconsulting.com> wrote: > From: James Carman <jcar...@carmanconsulting.com> > Subject: Re: better way setting up ID for a Wicket component? > To: users@wicket.apache.org > Date: Monday, March 29, 2010, 9:07 PM > You could make your own helper method > that sets both to the same thing and > returns the component. Just modify what I sent > earlier. > > On Mon, Mar 29, 2010 at 9:03 PM, David Chang <david_q_zh...@yahoo.com>wrote: > > > Not sure whether the help method will do the trick of > one-liner code. > > > > I feel that it would be much nice if Wicket could have > the following > > additional method for a Componment: > > > > Component setMarkupIdToWicketId(). > > > > Re-using a Wicket Id as markup id as convention should > be best practice. Am > > I right? I am new in wicket and sorry if I am wrong. > > > > Best. > > > > > > > > --- On Mon, 3/29/10, James Carman <jcar...@carmanconsulting.com> > wrote: > > > > > From: James Carman <jcar...@carmanconsulting.com> > > > Subject: Re: better way setting up ID for a > Wicket component? > > > To: users@wicket.apache.org > > > Date: Monday, March 29, 2010, 7:16 PM > > > helper method? > > > > > > protected <T extends Component> T > setMarkupId(T > > > component, String markupId) > > > { > > > > component.setMarkupId(markupId); > > > return component; > > > } > > > > > > > > > On Mon, Mar 29, 2010 at 7:00 PM, David Chang > <david_q_zh...@yahoo.com > > >wrote: > > > > > > > Here is what I am using the follow pattern > to set up > > > ID for a wicket > > > > component: > > > > > > > > Label abc = new Label("abcd", "abcdedfg"); > > > > > abc.setOutputMarkupId(true).setMarkupId(abc.getId()); > > > > > > > > It takes two lines to do this. > > > > > > > > Can I do something like > > > > > > > > Label abc = new Label("abcd", > > > > > "abcdedfg").setOutputMarkupId(true).setMarkupId(???); > > > > > > > > Is this doable? If yes, then what should go > to replace > > > ??? > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org