How to set a button enabled=false after clicking on it in Wicket? How to set a button enabled=false after clicking on it in Wicket? ajax ajax

How to set a button enabled=false after clicking on it in Wicket?


    final Form<?> form = new Form<>("form");    form.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);    add(form        .add(new FeedbackPanel("feedback"))        .add(new AjaxButton("button") {            @Override            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {                info(System.currentTimeMillis());                target.add(form);                try {                    TimeUnit.SECONDS.sleep(1);                } catch (InterruptedException e) {                    e.printStackTrace();                }            }            @Override            protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {                super.updateAjaxAttributes(attributes);                attributes.getAjaxCallListeners().add(new AjaxCallListener()                    .onBefore("$('#" + getMarkupId() + "').prop('disabled',true);")                    .onComplete("$('#" + getMarkupId() + "').prop('disabled',false);"));            }        }));