On 3/8/11 12:33 PM, Martijn Dashorst wrote:
On Tue, Mar 8, 2011 at 6:03 PM, GOODWIN, MATTHEW (ATTCORP)
<mg0...@att.com>  wrote:
+1 for clear documentation/Javadoc explaining proper use of
onInitialize.

Does this exist somewhere? As someone new to Wicket I'm trying to learn
as fast as I can and a lot of examples (almost exclusively) I see out
there show the add(..) from within the constructor - which is apparently
an anti-pattern from the sound of this thread.

It is most certainly not an antipattern in my book. I find the
reaction of the anti-constructor folks too strong and am trying to
formulate a civil reaction to this whole anti constructor rant.

Martijn


*Please* don't deprecate add() from constructor.

While a minority use-case, this allows for very elegant Wicket code when using Scala:

add(new Form[Person]("form", model) {
    add (new TextArea[String]("text", (getModel -> "text")) {
        override def isVisible: Boolean = false
    })
})

etc.


Since the body of a class is the constructor in Scala, this is a perfect fit for closure-like structures when using Wicket.

Thanks,
Gary

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to