Example usage for org.apache.wicket.markup.html.form Form hasFeedbackMessage

List of usage examples for org.apache.wicket.markup.html.form Form hasFeedbackMessage

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form Form hasFeedbackMessage.

Prototype

public final boolean hasFeedbackMessage() 

Source Link

Usage

From source file:org.hippoecm.frontend.widgets.NameUriField.java

License:Apache License

private Component createUrlAction() {
    final AjaxLink<Boolean> uriAction = new AjaxLink<Boolean>("uriAction") {
        @Override/*from  w w w.j a v  a2 s .  co m*/
        public void onClick(final AjaxRequestTarget target) {
            urlIsEditable = !urlIsEditable;

            urlComponent.modelChanging();
            urlModel.setObject(getName());
            urlComponent.modelChanged();

            final Form<?> form = urlComponent.getForm();
            if (form.hasFeedbackMessage()) {
                form.getFeedbackMessages().clear();
            }

            if (!urlComponent.isValid()) {

                urlComponent.validate();
            }

            target.add(this);
            target.add(urlComponent);
            target.focusComponent(urlIsEditable ? urlComponent : nameComponent);
        }
    };

    uriAction.add(new Label("uriActionLabel",
            ReadOnlyModel.of(() -> getString(urlIsEditable ? "url-reset" : "url-edit"))));
    return uriAction;
}