we went with the cheapest variant possible as default. a callback method doesnt have the memory overhead of holding onto a list, besides since buttons/links 99% of the time only have a single listener anyways it makes sense.
if you have a lot of cases where you need more then one listener you can create a subclass that delegates the call. -igor On 8/31/07, Sam Hough <[EMAIL PROTECTED]> wrote: > > > Thanks Eelco, > > On a related subject. Why does Wicket get us to do: > new Button("id") { > @Override > public void onSubmit() { > } > }; > > rather than: > Button b = new Button("id"); > b.addOnSubmit(new SubmitHandler() { > public void onSubmit(Field f) { > } > }}; > ? The latter seems more common elsewhere. Is it taste or something more > concrete? > > I was sulking a bit trying to do: > final Button a = new Button("a"); > final Button b = new Button("b"); > a. addOnSubmit(new SubmitHandler() { > public void onSubmit(FIeld f) { > a.setEnabled(false); > b.setEnabled(true); > } > }; > b.addOnSubmit(new SubmitHandler() { > public void onSubmit(Field f) { > a.setEnabled(true); > b.setEnabled(false); > } > }; > Probably me still trying to convert from GWT ;) > > > > > > Eelco Hillenius wrote: > > > >> Great. I must have just imagined the anti-pattern comment or got it the > >> wrong > >> way around. > > > > An anti pattern in Wicket 1.2 would be to keep passing pages in to > > other pages. One back page is no problem, but a linked list out of > > them would eat considerable memory. In Wicket 1.3 this is hardly > > relevant since Johan and Matej optimized the hell out of how pages are > > serialized. > > > > And just in general, keep in mind that everything that can be > > referenced from components/ a page means it is part of it's state > > (which might hurt you in a cluster if you over-do it). > > > > Eelco > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/MarkupContainer.get%28path%29-or-hold-reference--tf4358991.html#a12424669 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >