Jquery Ui Widget dialog with wicket

Jquery Ui Widget dialog with wicket


I am using wicket message dialog box, which is a jquery ui widget dialog.

I want to close the dialog box , when user clicks on "confirm
 button. Even if the operation takes time, the dialog box must close.

When I press "Cancel" dialog box closes immedialtely, but when I click "confirm", and the operation takes longer , then the dialog box is still open. I don't want this behanvior,

I am doing something like this:

final MessageDialogAjaxBehavior confirmDialog = new MessageDialogAjaxBehavior("confirmDialog", Model.of("Warning"), message, DialogButtons.YES_NO, DialogIcon.WARN) {

public void onClose(AjaxRequestTarget target, DialogButton button) {
 String js2 = this.getMarkupId() + ".dialog('close')";            


if (button != null && "YES".equalsIgnoreCase(button.toString()))

labTestTypeService.delete(labTestTemplateType.getState(), EnoviaId.create)




But , this doesn't close the dialog box, til opertation is complete.

Kindly help