I have added a [patch][revision] for [Wicket 2.0][trunk] which introduces a [ClientEvent enum][clientevent]
for specifying which event on the client should fire the event.

So where you in 1.2 would write something like this:

...
Label label = new Label("label", "This is my label");
label.add(new AjaxEventBehavior("onclick") {
	public void onEvent(AjaxRequestTarget target) {
		// Do your stuff here.
	}
});
...

You now write this:

...
Label lavel = new Label(parent, "label", "This is my label");
label.add(new AjaxEventBehavior(ClientEvent.CLICK) {
	public void onEvent(AjaxRequestTarget target) {
		// Do your stuff here.
	}
});

Which eliminates the problem with misspelling the event name (like “onclck”, “click” or “onclicked”).

[revision]: http://svn.sourceforge.net/viewcvs.cgi/wicket?rev=6243&view=rev
[trunk]: http://svn.sourceforge.net/viewcvs.cgi/wicket/trunk/wicket/
[clientevent]: http://svn.sourceforge.net/viewcvs.cgi/wicket/trunk/wicket/src/java/wicket/ajax/ClientEvent.java?view=markup

Post a Comment

*
*