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);
}
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;
}
});
}
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);
}
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);
}
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;
}
Aggregations