I'm not sure how much of the core wicket framework programatically creates javascript, but I've been doing it a lot lately for the wicket-stuff scriptaculous project. I've written a helper class that has *drastically* cleaned up the Java code and made building javascript within Java pretty painless. If anyone is interested in using this in a seperate project, or the core, let me know.
http://jroller.com/page/wireframe/?anchor=javascriptbuilder http://jroller.com/page/wireframe?entry=more_javascript_helpers