I am looking into the groovy-wicket integration and lack of anonymous inner classes seems to be a problem when writing the event handlers. Is there a groovier way of writing this code
import org.apache.wicket.PageParameters
import org.apache.wicket.markup.html.basic.Label
import org.apache.wicket.markup.html.link.Link
import org.apache.wicket.markup.html.WebPage
/**
* Homepage
*/
class HomePage extends WebPage {
public HomePage(final PageParameters parameters) {
// Add the simplest type of label
add(new Label("message", "Wicket running!"));
def link1 = new ClickHandler("link1") //in java, defined inline
add(link1);
}
}
class ClickHandler extends Link{
ClickHandler(String id) {
super(id);
}
void onClick(){println "Hi"}
}