Martin and Jeremy, thanks for chiming. The suggested solutions work but IMHO none of them seem ideal in terms of less code, error-less, and refactoring.
The best is to have that convenience method or use Wickt 1.5 where HTMLElement's id will be kept. All the best, David --- On Tue, 3/30/10, Martin Makundi <[email protected]> wrote: > From: Martin Makundi <[email protected]> > Subject: Re: better way setting up ID for a Wicket component? > To: [email protected] > Date: Tuesday, March 30, 2010, 12:32 AM > Hi! > > Actually one line that he wants is more like: > > { Label label; add(label = new Label("abc", > "abcdef").setOutputMarkupId(true).setMarkupId(label.getId())); > } > > ;) > > ** > Martin > > 2010/3/30 Jeremy Thomerson <[email protected]>: > > You can still do this in one line: > > > > add(new Label("abc", > "abcdef").setOutputMarkupId(true).setMarkupId("foo")); > > > > -- > > Jeremy Thomerson > > http://www.wickettraining.com > > > > > > > > On Mon, Mar 29, 2010 at 10:32 PM, David Chang > > <[email protected]>wrote: > > > >> Well, it is not bad to tell people what you > believe is right:) We are > >> wicket programmers, aren't we? :) Feel good to say > what I wanted to say and > >> thanks for the initial JIRA idea > >> > >> > >> --- On Mon, 3/29/10, James Carman <[email protected]> > wrote: > >> > >> > From: James Carman <[email protected]> > >> > Subject: Re: better way setting up ID for a > Wicket component? > >> > To: [email protected] > >> > Date: Monday, March 29, 2010, 11:06 PM > >> > See...told you. :) > >> > > >> > On Mon, Mar 29, 2010 at 10:32 PM, Igor > Vaynberg <[email protected] > >> >wrote: > >> > > >> > > im letting you know. we dont need to > litter the public > >> > api with such > >> > > trivial methods, the api has a large > surface area as > >> > it is. i am sure > >> > > as you code more with wicket you will > find another 30 > >> > such trivial > >> > > methods that will be useful to you, this > is what > >> > static imports are > >> > > for. > >> > > > >> > > -igor > >> > > > >> > > On Mon, Mar 29, 2010 at 6:18 PM, James > Carman > >> > > <[email protected]> > >> > wrote: > >> > > > Perhaps. File a JIRA report ( > >> > > https://issues.apache.org/jira/browse/WICKET) > >> > > > and ask for it as a "New Feature." > If the > >> > core developers don't like the > >> > > > idea, I'm sure they'll let you > know. :) > >> > > > > >> > > > > >> > > > On Mon, Mar 29, 2010 at 9:13 PM, > David Chang > >> > <[email protected] > >> > > >wrote: > >> > > > > >> > > >> 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 <[email protected]> > >> > wrote: > >> > > >> > >> > > >> > From: James Carman <[email protected]> > >> > > >> > Subject: Re: better way > setting up ID > >> > for a Wicket component? > >> > > >> > To: [email protected] > >> > > >> > 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 <[email protected] > >> > > >> >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 > >> > <[email protected]> > >> > > >> > wrote: > >> > > >> > > > >> > > >> > > > From: James > Carman <[email protected]> > >> > > >> > > > Subject: Re: > better way > >> > setting up ID for a > >> > > >> > Wicket component? > >> > > >> > > > To: [email protected] > >> > > >> > > > 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 > >> > > >> > <[email protected] > >> > > >> > > >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: > >> > [email protected] > >> > > >> > > > > For > additional commands, > >> > e-mail: [email protected] > >> > > >> > > > > > >> > > >> > > > > > >> > > >> > > > > >> > > >> > > > >> > > >> > > > >> > > >> > > > >> > > >> > > > >> > > >> > > > >> > > >> > > >> > > --------------------------------------------------------------------- > >> > > >> > > To unsubscribe, > e-mail: [email protected] > >> > > >> > > For additional > commands, e-mail: [email protected] > >> > > >> > > > >> > > >> > > > >> > > >> > > >> > > >> > >> > > >> > >> > > >> > >> > > >> > >> > > >> > >> > > --------------------------------------------------------------------- > >> > > >> To unsubscribe, e-mail: [email protected] > >> > > >> For additional commands, > e-mail: [email protected] > >> > > >> > >> > > >> > >> > > > > >> > > > >> > > > >> > > --------------------------------------------------------------------- > >> > > To unsubscribe, e-mail: [email protected] > >> > > For additional commands, e-mail: [email protected] > >> > > > >> > > > >> > > >> > >> > >> > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
