Re: better way setting up ID for a Wicket component?
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 martin.maku...@koodaripalvelut.com wrote: From: Martin Makundi martin.maku...@koodaripalvelut.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org 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 jer...@wickettraining.com: 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 david_q_zh...@yahoo.comwrote: 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 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, 11:06 PM See...told you. :) On Mon, Mar 29, 2010 at 10:32 PM, Igor Vaynberg igor.vaynb...@gmail.com 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.com 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 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
Re: better way setting up ID for a Wicket component?
Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. --- On Tue, 3/30/10, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: From: McIlwee, Craig craig.mcil...@openroadsconsulting.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 7:49 AM There's a good reason that markup ID doesn't match wicket ID. If I have a panel with a few form components, and then put 2 of those panels on the same page, then your approach would break things like document.getElementId(...) because there would be more than 1 element w/ same ID. Craig _ From: David Chang [mailto:david_q_zh...@yahoo.com] To: users@wicket.apache.org Sent: Mon, 29 Mar 2010 21:03:46 -0400 Subject: Re: better way setting up ID for a Wicket component? 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.comwrote: 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
Re: better way setting up ID for a Wicket component?
IDs are needed for e.g. AJAX functionality. The default Wicket implementation of markup IDs will create them smartly, never creating duplicate ids even in the case of multiple instances of panels, repeaters, etc. As I understand Wicket best practice, it is never to call setMarkupId() at all, and just let the smart default thing happen. If you *must* call it because you have some special requirement for particular IDs, then you take on the responsibility for making sure your IDs are unique yourself. In this light, a setMarkupIdToWicketId() method is a dangerous thing. Bng David Chang wrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: better way setting up ID for a Wicket component?
Yes! Von: Boris Goldowsky [mailto:bgoldow...@cast.org] Gesendet: Di 30.03.2010 23:06 An: users@wicket.apache.org Betreff: Re: better way setting up ID for a Wicket component? IDs are needed for e.g. AJAX functionality. The default Wicket implementation of markup IDs will create them smartly, never creating duplicate ids even in the case of multiple instances of panels, repeaters, etc. As I understand Wicket best practice, it is never to call setMarkupId() at all, and just let the smart default thing happen. If you *must* call it because you have some special requirement for particular IDs, then you take on the responsibility for making sure your IDs are unique yourself. In this light, a setMarkupIdToWicketId() method is a dangerous thing. Bng David Chang wrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. - 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
Re: better way setting up ID for a Wicket component?
That's the point of what he's saying. It's easy to say that, but in practice, you may create a component that you don't think will ever be used on the same page twice, and then it is. That's why Wicket defaults to the safest practice of generating an ID for you. I typically avoid programmatically setting the markup ID for this very reason. There's (almost) always a way around it. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Mar 30, 2010 at 12:06 PM, David Chang david_q_zh...@yahoo.comwrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. --- On Tue, 3/30/10, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: From: McIlwee, Craig craig.mcil...@openroadsconsulting.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 7:49 AM There's a good reason that markup ID doesn't match wicket ID. If I have a panel with a few form components, and then put 2 of those panels on the same page, then your approach would break things like document.getElementId(...) because there would be more than 1 element w/ same ID. Craig _ From: David Chang [mailto:david_q_zh...@yahoo.com] To: users@wicket.apache.org Sent: Mon, 29 Mar 2010 21:03:46 -0400 Subject: Re: better way setting up ID for a Wicket component? 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.comwrote: 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
Re: better way setting up ID for a Wicket component?
I feel there is some misunderstanding on this thread now. Two things need to clear: 1. There is no need to call this convenience method on each wicket component. Nobody asks for that. 2. The method is there simply for the programmer to decide to use it or not and use it right. Without this method, it is still equally likely to have duplicate wicket ids due multiple use of the same panel. Just my 2 cents. Best. --- On Tue, 3/30/10, Jeremy Thomerson jer...@wickettraining.com wrote: From: Jeremy Thomerson jer...@wickettraining.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 5:28 PM That's the point of what he's saying. It's easy to say that, but in practice, you may create a component that you don't think will ever be used on the same page twice, and then it is. That's why Wicket defaults to the safest practice of generating an ID for you. I typically avoid programmatically setting the markup ID for this very reason. There's (almost) always a way around it. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Mar 30, 2010 at 12:06 PM, David Chang david_q_zh...@yahoo.comwrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. --- On Tue, 3/30/10, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: From: McIlwee, Craig craig.mcil...@openroadsconsulting.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 7:49 AM There's a good reason that markup ID doesn't match wicket ID. If I have a panel with a few form components, and then put 2 of those panels on the same page, then your approach would break things like document.getElementId(...) because there would be more than 1 element w/ same ID. Craig _ From: David Chang [mailto:david_q_zh...@yahoo.com] To: users@wicket.apache.org Sent: Mon, 29 Mar 2010 21:03:46 -0400 Subject: Re: better way setting up ID for a Wicket component? 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.comwrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: better way setting up ID for a Wicket component?
And, I think one good reason not to do it is that you're making it easier to do something that isn't really recommended anyway (there are almost always workarounds for these situations). On Tue, Mar 30, 2010 at 8:50 PM, David Chang david_q_zh...@yahoo.com wrote: I feel there is some misunderstanding on this thread now. Two things need to clear: 1. There is no need to call this convenience method on each wicket component. Nobody asks for that. 2. The method is there simply for the programmer to decide to use it or not and use it right. Without this method, it is still equally likely to have duplicate wicket ids due multiple use of the same panel. Just my 2 cents. Best. --- On Tue, 3/30/10, Jeremy Thomerson jer...@wickettraining.com wrote: From: Jeremy Thomerson jer...@wickettraining.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 5:28 PM That's the point of what he's saying. It's easy to say that, but in practice, you may create a component that you don't think will ever be used on the same page twice, and then it is. That's why Wicket defaults to the safest practice of generating an ID for you. I typically avoid programmatically setting the markup ID for this very reason. There's (almost) always a way around it. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Mar 30, 2010 at 12:06 PM, David Chang david_q_zh...@yahoo.comwrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. --- On Tue, 3/30/10, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: From: McIlwee, Craig craig.mcil...@openroadsconsulting.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 7:49 AM There's a good reason that markup ID doesn't match wicket ID. If I have a panel with a few form components, and then put 2 of those panels on the same page, then your approach would break things like document.getElementId(...) because there would be more than 1 element w/ same ID. Craig _ From: David Chang [mailto:david_q_zh...@yahoo.com] To: users@wicket.apache.org Sent: Mon, 29 Mar 2010 21:03:46 -0400 Subject: Re: better way setting up ID for a Wicket component? 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.comwrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: better way setting up ID for a Wicket component?
Boris, thanks for sharing your thoughts: IDs are needed for e.g. AJAX functionality. I cannot agree on this. In the context of wicket for the web framework, you actually dont need to create ID. Let Wicket to create whatever ID wicket deems right. In my understanding, and actually in my case that initiated this thread, is to style certain elements and I hope to have meaningful markup IDs. I have meaningful wicket IDs in my case, and I simply want to do the same for markup IDs. Thanks, David --- On Tue, 3/30/10, Boris Goldowsky bgoldow...@cast.org wrote: From: Boris Goldowsky bgoldow...@cast.org Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 5:06 PM IDs are needed for e.g. AJAX functionality. The default Wicket implementation of markup IDs will create them smartly, never creating duplicate ids even in the case of multiple instances of panels, repeaters, etc. As I understand Wicket best practice, it is never to call setMarkupId() at all, and just let the smart default thing happen. If you *must* call it because you have some special requirement for particular IDs, then you take on the responsibility for making sure your IDs are unique yourself. In this light, a setMarkupIdToWicketId() method is a dangerous thing. Bng David Chang wrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. - 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
Re: better way setting up ID for a Wicket component?
If you just want to do this so you can style your markup, use the class attribute in your markup and convert your CSS #id's to .classes, if that's possible. cheers, Steve On 31/03/2010, at 12:03 PM, David Chang wrote: Boris, thanks for sharing your thoughts: IDs are needed for e.g. AJAX functionality. I cannot agree on this. In the context of wicket for the web framework, you actually dont need to create ID. Let Wicket to create whatever ID wicket deems right. In my understanding, and actually in my case that initiated this thread, is to style certain elements and I hope to have meaningful markup IDs. I have meaningful wicket IDs in my case, and I simply want to do the same for markup IDs. Thanks, David --- On Tue, 3/30/10, Boris Goldowsky bgoldow...@cast.org wrote: From: Boris Goldowsky bgoldow...@cast.org Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 5:06 PM IDs are needed for e.g. AJAX functionality. The default Wicket implementation of markup IDs will create them smartly, never creating duplicate ids even in the case of multiple instances of panels, repeaters, etc. As I understand Wicket best practice, it is never to call setMarkupId() at all, and just let the smart default thing happen. If you *must* call it because you have some special requirement for particular IDs, then you take on the responsibility for making sure your IDs are unique yourself. In this light, a setMarkupIdToWicketId() method is a dangerous thing. Bng David Chang wrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. - 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 smime.p7s Description: S/MIME cryptographic signature
Re: better way setting up ID for a Wicket component?
But why should we add something that makes it easier for a programmer to fall into a mistake that is not a recommended practice? It just causes us to have more traffic on this list with people needing help because they messed something up. We don't want to make it easier to mess up and generate help requests. Smaller interfaces are better. convenience methods are not always better (in fact, are generally not better). If you want that convenience, create a utility class. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Mar 30, 2010 at 7:50 PM, David Chang david_q_zh...@yahoo.comwrote: I feel there is some misunderstanding on this thread now. Two things need to clear: 1. There is no need to call this convenience method on each wicket component. Nobody asks for that. 2. The method is there simply for the programmer to decide to use it or not and use it right. Without this method, it is still equally likely to have duplicate wicket ids due multiple use of the same panel. Just my 2 cents. Best. --- On Tue, 3/30/10, Jeremy Thomerson jer...@wickettraining.com wrote: From: Jeremy Thomerson jer...@wickettraining.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 5:28 PM That's the point of what he's saying. It's easy to say that, but in practice, you may create a component that you don't think will ever be used on the same page twice, and then it is. That's why Wicket defaults to the safest practice of generating an ID for you. I typically avoid programmatically setting the markup ID for this very reason. There's (almost) always a way around it. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Mar 30, 2010 at 12:06 PM, David Chang david_q_zh...@yahoo.com wrote: Craig, I really appreciate your input. If a panel is reused more than one time on the same page, then the panel's components should not use IDs in the first place. It would always violate valid HTML. Correct? Regards. --- On Tue, 3/30/10, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: From: McIlwee, Craig craig.mcil...@openroadsconsulting.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Tuesday, March 30, 2010, 7:49 AM There's a good reason that markup ID doesn't match wicket ID. If I have a panel with a few form components, and then put 2 of those panels on the same page, then your approach would break things like document.getElementId(...) because there would be more than 1 element w/ same ID. Craig _ From: David Chang [mailto:david_q_zh...@yahoo.com] To: users@wicket.apache.org Sent: Mon, 29 Mar 2010 21:03:46 -0400 Subject: Re: better way setting up ID for a Wicket component? 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.comwrote: 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
Re: better way setting up ID for a Wicket component?
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.comwrote: 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
Re: better way setting up ID for a Wicket component?
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.comwrote: 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
Re: better way setting up ID for a Wicket component?
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.comwrote: 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
Re: better way setting up ID for a Wicket component?
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 david_q_zh...@yahoo.comwrote: 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
Re: better way setting up ID for a Wicket component?
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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.comwrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: better way setting up ID for a Wicket component?
I just created a JIRA before you replied. https://issues.apache.org/jira/browse/WICKET-2809 I understand your concern, but I dont fully agree with you. As you know, less and clean coding is always a good thing and best to be the part of the tool. Regards. --- On Mon, 3/29/10, Igor Vaynberg igor.vaynb...@gmail.com wrote: From: Igor Vaynberg igor.vaynb...@gmail.com Subject: Re: better way setting up ID for a Wicket component? To: users@wicket.apache.org Date: Monday, March 29, 2010, 10:32 PM 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.comwrote: 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 - 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
Re: better way setting up ID for a Wicket component?
See...told you. :) On Mon, Mar 29, 2010 at 10:32 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.com 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 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: better way setting up ID for a Wicket component?
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 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, 11:06 PM See...told you. :) On Mon, Mar 29, 2010 at 10:32 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.com 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 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 - 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
Re: better way setting up ID for a Wicket component?
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 david_q_zh...@yahoo.comwrote: 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 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, 11:06 PM See...told you. :) On Mon, Mar 29, 2010 at 10:32 PM, Igor Vaynberg igor.vaynb...@gmail.com 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.com 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 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: better way setting up ID for a Wicket component?
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 jer...@wickettraining.com: 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 david_q_zh...@yahoo.comwrote: 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 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, 11:06 PM See...told you. :) On Mon, Mar 29, 2010 at 10:32 PM, Igor Vaynberg igor.vaynb...@gmail.com 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 jcar...@carmanconsulting.com 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 david_q_zh...@yahoo.com 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 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