Search in sources :

Example 1 with ContainerFeedbackMessageFilter

use of org.apache.wicket.feedback.ContainerFeedbackMessageFilter in project wicket by apache.

the class AjaxFormValidatingBehaviorTestPage method addFormWithOrdinaryFeedbackPanel.

private void addFormWithOrdinaryFeedbackPanel() {
    Form<Void> form = new Form<>("form1");
    form.add(new AjaxFormValidatingBehavior("blur"));
    form.add(new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(form)).setOutputMarkupId(true));
    add(form);
    TextField<String> input = new TextField<>("input", new Model<String>());
    input.setRequired(true);
    form.add(input);
}
Also used : FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) Form(org.apache.wicket.markup.html.form.Form) TextField(org.apache.wicket.markup.html.form.TextField) ContainerFeedbackMessageFilter(org.apache.wicket.feedback.ContainerFeedbackMessageFilter)

Example 2 with ContainerFeedbackMessageFilter

use of org.apache.wicket.feedback.ContainerFeedbackMessageFilter in project midpoint by Evolveum.

the class PageSelfRegistration method initInputProperties.

private void initInputProperties(FeedbackPanel feedback, TextPanel<String> input) {
    input.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    input.getBaseFormComponent().setRequired(true);
    feedback.setFilter(new ContainerFeedbackMessageFilter(input.getBaseFormComponent()));
    input.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return getOidFromParams(getPageParameters()) == null;
        }
    });
}
Also used : EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) ContainerFeedbackMessageFilter(org.apache.wicket.feedback.ContainerFeedbackMessageFilter) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 3 with ContainerFeedbackMessageFilter

use of org.apache.wicket.feedback.ContainerFeedbackMessageFilter in project midpoint by Evolveum.

the class PageSelfRegistration method initStaticFormLayout.

private void initStaticFormLayout(Form<?> mainForm) {
    // feedback
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(PageSelfRegistration.this));
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);
    WebMarkupContainer staticRegistrationForm = createMarkupContainer(ID_STATIC_FORM, new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return getSelfRegistrationConfiguration().getFormRef() == null;
        }
    }, mainForm);
    TextPanel<String> firstName = new TextPanel<>(ID_FIRST_NAME, new PropertyModel<String>(userModel, UserType.F_GIVEN_NAME.getLocalPart() + ".orig") {

        private static final long serialVersionUID = 1L;

        @Override
        public void setObject(String object) {
            userModel.getObject().setGivenName(new PolyStringType(object));
        }
    });
    initInputProperties(feedback, firstName);
    staticRegistrationForm.add(firstName);
    TextPanel<String> lastName = new TextPanel<>(ID_LAST_NAME, new PropertyModel<String>(userModel, UserType.F_FAMILY_NAME.getLocalPart() + ".orig") {

        private static final long serialVersionUID = 1L;

        @Override
        public void setObject(String object) {
            userModel.getObject().setFamilyName(new PolyStringType(object));
        }
    });
    initInputProperties(feedback, lastName);
    staticRegistrationForm.add(lastName);
    TextPanel<String> email = new TextPanel<>(ID_EMAIL, new PropertyModel<String>(userModel, UserType.F_EMAIL_ADDRESS.getLocalPart()));
    initInputProperties(feedback, email);
    staticRegistrationForm.add(email);
    createPasswordPanel(staticRegistrationForm);
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) ContainerFeedbackMessageFilter(org.apache.wicket.feedback.ContainerFeedbackMessageFilter) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 4 with ContainerFeedbackMessageFilter

use of org.apache.wicket.feedback.ContainerFeedbackMessageFilter in project midpoint by Evolveum.

the class TextFormGroup method initLayout.

private void initLayout(IModel<String> label, final String tooltipKey, String labelCssClass, String textCssClass, final boolean required, final boolean markAsRequired, boolean isSimilarAsPropertyPanel) {
    WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
    add(labelContainer);
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelCssClass)) {
        labelContainer.add(AttributeAppender.prepend("class", labelCssClass));
    }
    if (isSimilarAsPropertyPanel) {
        labelContainer.add(AttributeAppender.prepend("class", " col-xs-2 prism-property-label "));
    } else {
        labelContainer.add(AttributeAppender.prepend("class", " control-label "));
    }
    labelContainer.add(l);
    Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
    tooltipLabel.add(new AttributeAppender("data-original-title", new IModel<String>() {

        @Override
        public String getObject() {
            return getString(tooltipKey);
        }
    }));
    tooltipLabel.add(new InfoTooltipBehavior());
    tooltipLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return tooltipKey != null;
        }
    });
    tooltipLabel.setOutputMarkupId(true);
    tooltipLabel.setOutputMarkupPlaceholderTag(true);
    labelContainer.add(tooltipLabel);
    WebMarkupContainer requiredContainer = new WebMarkupContainer(ID_REQUIRED);
    requiredContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return markAsRequired;
        }
    });
    labelContainer.add(requiredContainer);
    WebMarkupContainer propertyLabel = new WebMarkupContainer(ID_PROPERTY_LABEL);
    WebMarkupContainer rowLabel = new WebMarkupContainer(ID_ROW);
    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
    if (StringUtils.isNotEmpty(textCssClass)) {
        textWrapper.add(AttributeAppender.prepend("class", textCssClass));
    }
    if (isSimilarAsPropertyPanel) {
        propertyLabel.add(AttributeAppender.prepend("class", " col-md-10 prism-property-value "));
        rowLabel.add(AttributeAppender.prepend("class", " row "));
    }
    propertyLabel.add(rowLabel);
    rowLabel.add(textWrapper);
    add(propertyLabel);
    TextField text = createText(getModel(), label, required);
    text.setLabel(label);
    textWrapper.add(text);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(this));
    feedback.setOutputMarkupId(true);
    textWrapper.add(feedback);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) IModel(org.apache.wicket.model.IModel) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) Label(org.apache.wicket.markup.html.basic.Label) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ContainerFeedbackMessageFilter(org.apache.wicket.feedback.ContainerFeedbackMessageFilter) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 5 with ContainerFeedbackMessageFilter

use of org.apache.wicket.feedback.ContainerFeedbackMessageFilter in project midpoint by Evolveum.

the class PageSelfRegistration method initStaticLayout.

@Override
protected WebMarkupContainer initStaticLayout() {
    // feedback
    // final Form<?> mainForm = new Form<>(ID_MAIN_FORM);
    WebMarkupContainer staticRegistrationForm = createMarkupContainer(ID_STATIC_FORM);
    addMultilineLable(ID_WELCOME, createStringResource("PageSelfRegistration.welcome.message"), staticRegistrationForm);
    addMultilineLable(ID_ADDITIONAL_TEXT, createStringResource("PageSelfRegistration.additional.message", WebComponentUtil.getMidpointCustomSystemName(PageSelfRegistration.this, "MidPoint")), staticRegistrationForm);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(PageSelfRegistration.this));
    feedback.setOutputMarkupId(true);
    add(feedback);
    TextPanel<String> firstName = new TextPanel<>(ID_FIRST_NAME, new PropertyModel<String>(getUserModel(), UserType.F_GIVEN_NAME.getLocalPart() + ".orig") {

        private static final long serialVersionUID = 1L;

        @Override
        public void setObject(String object) {
            getUserModel().getObject().setGivenName(new PolyStringType(object));
        }
    });
    initInputProperties(feedback, firstName);
    staticRegistrationForm.add(firstName);
    TextPanel<String> lastName = new TextPanel<>(ID_LAST_NAME, new PropertyModel<String>(getUserModel(), UserType.F_FAMILY_NAME.getLocalPart() + ".orig") {

        private static final long serialVersionUID = 1L;

        @Override
        public void setObject(String object) {
            getUserModel().getObject().setFamilyName(new PolyStringType(object));
        }
    });
    initInputProperties(feedback, lastName);
    staticRegistrationForm.add(lastName);
    TextPanel<String> email = new TextPanel<>(ID_EMAIL, new PropertyModel<>(getUserModel(), UserType.F_EMAIL_ADDRESS.getLocalPart()));
    initInputProperties(feedback, email);
    staticRegistrationForm.add(email);
    createPasswordPanel(staticRegistrationForm);
    return staticRegistrationForm;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) ContainerFeedbackMessageFilter(org.apache.wicket.feedback.ContainerFeedbackMessageFilter) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

ContainerFeedbackMessageFilter (org.apache.wicket.feedback.ContainerFeedbackMessageFilter)5 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)4 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 TextPanel (com.evolveum.midpoint.web.component.input.TextPanel)2 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)2 TextField (org.apache.wicket.markup.html.form.TextField)2 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)1 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 Label (org.apache.wicket.markup.html.basic.Label)1 Form (org.apache.wicket.markup.html.form.Form)1 IModel (org.apache.wicket.model.IModel)1