Latest wicket support drag n drop
here is the link
http://code.google.com/p/wicket-dnd/
here is the same code, simple define source and target 🙂
WebMarkupContainer container = new WebMarkupContainer("container");
Model<String> model = Model.of(new String("AAA"));
container.add(new DragSource(Operation.values()) {
public void onAfterDrop(AjaxRequestTarget target, Transfer transfer) {
System.out.println("Drag n drop");
}
}.drag("span"));
container.add(new DropTarget(Operation.values()) {
public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) {
// add transfer data
System.out.println("rrrr");
}
}.dropCenter("td"));
Label label = new Label("aaa", model);
label.setOutputMarkupId(true);
container.add(label);
add(container);