For now, I simply did this:
object autoMarkupId extends IComponentInstantiationListener {
def onInstantiation(component: Component) {
if (component.isInstanceOf[FormComponent[_]]) {
component.setOutputMarkupId(true)
component.setMarkupId(component.getId())
}
}
}
getComponentInstantiationListeners().add(autoMarkupId);
I've been playing with this technic, of having all Form components outputing
their ids as is. Of course, this is application-specific, and Wicket should
not take this to its core.
But it seems that improves development time, when the web designer codes CSS
and HTML with the application running on his machine. No more code like
wicket:id="foo" id="foo"
Now, I'm considering to implement a different way to define a Wicket
component in the HTML:
<div id="w_foo">
</div>
add(new WebMarkupContainer("foo"));
What you guys think of this?
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."
- Francois de La Rochefoucauld
On Sun, Mar 27, 2011 at 11:15 PM, James Carman
<[email protected]>wrote:
> 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 frame) than just adding the
> setOutputMarkupId() call into the constructor yourself (which I guess
> you could do by running a locally-modified version of Wicket).
>
> On Sun, Mar 27, 2011 at 9:21 PM, Bruno Borges <[email protected]>
> wrote:
> > 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."
> > - Francois de La Rochefoucauld
> >
> >
> >
> > On Sun, Mar 27, 2011 at 9:56 PM, James Carman <
> [email protected]>wrote:
> >
> >> 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 <[email protected]>
> >> 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(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 they have used to
> >> > acquire it."
> >> > - Francois de La Rochefoucauld
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> 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]
>
>