Re: Set all form fields to output markup id automatically

2011-03-30 Thread Martin Grigorov
On Wed, Mar 30, 2011 at 10:18 PM, Matthew Pennington < m...@profounddecisions.co.uk> wrote: > On 30/03/2011 19:44, Martin Grigorov wrote: > >> @Bruno: this is interesting question. You should ask it in scala-users@. >> I >> think this should be possible with some implicit declaration. >> >> @Matth

Re: Set all form fields to output markup id automatically

2011-03-30 Thread Matthew Pennington
On 30/03/2011 19:44, Martin Grigorov wrote: @Bruno: this is interesting question. You should ask it in scala-users@. I think this should be possible with some implicit declaration. @Matthew: Do you use org.apache.wicket.markup.html.form.FormComponentLabel ? Going through the app and changing all

Re: Set all form fields to output markup id automatically

2011-03-30 Thread Martin Grigorov
@Bruno: this is interesting question. You should ask it in scala-users@. I think this should be possible with some implicit declaration. @Matthew: Do you use org.apache.wicket.markup.html.form.FormComponentLabel ? On Tue, Mar 29, 2011 at 11:29 AM, Matthew Pennington < m...@profounddecisions.co.uk

Re: Set all form fields to output markup id automatically

2011-03-29 Thread Matthew Pennington
I personally would suggest *not* having that second line "component.setMarkupId(component.getId())" there. Let Wicket generate the IDs for you so that they're all unique on a page. Your approach above breaks using two EmailAddressTextField (fake example class) components on the same page. Des

Re: Set all form fields to output markup id automatically

2011-03-28 Thread Jeremy Thomerson
On Sun, Mar 27, 2011 at 11:43 PM, Bruno Borges wrote: > For now, I simply did this: > > object autoMarkupId extends IComponentInstantiationListener { > def onInstantiation(component: Component) { >if (component.isInstanceOf[FormComponent[_]]) { > component.se

Re: Set all form fields to output markup id automatically

2011-03-27 Thread Bruno Borges
For now, I simply did this: object autoMarkupId extends IComponentInstantiationListener { def onInstantiation(component: Component) { if (component.isInstanceOf[FormComponent[_]]) { component.setOutputMarkupId(true) component.setMarkupId(com

Re: Set all form fields to output markup id automatically

2011-03-27 Thread James Carman
You could use an aspect. However, the calling of the IComponentInstantiationListeners already occurs in-line during the constructor execution, so adding your logic (which is merely setting a flag) shouldn't be too much overhead, really. It shouldn't be any different (other than pushing a stack fr

Re: Set all form fields to output markup id automatically

2011-03-27 Thread Clint Checketts
If this is specific to a particular form you could use A formcompoment visitor to iterate over each child and call setOutputMarkupId On Sunday, March 27, 2011, Bruno Borges wrote: > I was looking for a better way (optimized too) to achieve this, considering > that I'm using Scala. > > I admit I'm

Re: Set all form fields to output markup id automatically

2011-03-27 Thread Bruno Borges
I was looking for a better way (optimized too) to achieve this, considering that I'm using Scala. I admit I'm not an expert on Scala though. :-) Bruno Borges www.brunoborges.com.br +55 21 76727099 "The glory of great men should always be measured by the means they have used to acquire it." -

Re: Set all form fields to output markup id automatically

2011-03-27 Thread James Carman
A quick way to set it by default would be to use a IComponentInitializationListener. On Sun, Mar 27, 2011 at 8:52 PM, Bruno Borges wrote: > I'm developing a project with Scala + Wicket and I wanted to set that all > form components have their markup id output automatically > (setOutputMarkupId(tr

Set all form fields to output markup id automatically

2011-03-27 Thread Bruno Borges
I'm developing a project with Scala + Wicket and I wanted to set that all form components have their markup id output automatically (setOutputMarkupId(true)). Any idea? Cheers, Bruno Borges www.brunoborges.com.br +55 21 76727099 "The glory of great men should always be measured by the means th