Search in sources :

Example 1 with ComponentFeedbackMessageFilter

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

the class PrismValuePanel method initLayout.

private void initLayout(IModel<String> labelModel, Form form, String valueCssClass, String inputCssClass) {
    //container
    WebMarkupContainer valueContainer = new WebMarkupContainer(ID_VALUE_CONTAINER);
    valueContainer.setOutputMarkupId(true);
    valueContainer.add(new AttributeModifier("class", valueCssClass));
    add(valueContainer);
    //feedback
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
    feedback.setOutputMarkupId(true);
    add(feedback);
    //input
    Panel input = createInputComponent(ID_INPUT, labelModel, form);
    input.add(new AttributeModifier("class", inputCssClass));
    if (input instanceof InputPanel) {
        initAccessBehaviour((InputPanel) input);
        feedback.setFilter(new ComponentFeedbackMessageFilter(((InputPanel) input).getBaseFormComponent()));
    } else if (input instanceof LockoutStatusPanel) {
        feedback.setFilter(new ComponentFeedbackMessageFilter(input));
    } else if (input instanceof ValueChoosePanel) {
        feedback.setFilter(new ComponentFeedbackMessageFilter(input));
    } else if (input instanceof AssociationValueChoicePanel) {
        feedback.setFilter(new ComponentFeedbackMessageFilter(((AssociationValueChoicePanel) input).getTextComponent()));
    }
    valueContainer.add(input);
    //buttons
    AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValue(target);
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isAddButtonVisible();
        }
    });
    valueContainer.add(addButton);
    AjaxLink removeButton = new AjaxLink(ID_REMOVE_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            removeValue(target);
        }
    };
    removeButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isRemoveButtonVisible();
        }
    });
    valueContainer.add(removeButton);
}
Also used : LockoutStatusPanel(com.evolveum.midpoint.web.component.LockoutStatusPanel) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) LockoutStatusPanel(com.evolveum.midpoint.web.component.LockoutStatusPanel) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) AutoCompleteTextPanel(com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteTextPanel) ValueChoosePanel(com.evolveum.midpoint.web.component.form.ValueChoosePanel) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) ModificationsPanel(com.evolveum.midpoint.web.component.model.delta.ModificationsPanel) Panel(org.apache.wicket.markup.html.panel.Panel) AssociationValueChoicePanel(com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) AssociationValueChoicePanel(com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel) ValueChoosePanel(com.evolveum.midpoint.web.component.form.ValueChoosePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 2 with ComponentFeedbackMessageFilter

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

the class AssociationValueChoicePanel method initLayout.

private void initLayout(final IModel<PrismContainerValue<ShadowAssociationType>> value, final List<PrismPropertyValue> values, final boolean required, Class<C> type) {
    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
    textWrapper.setOutputMarkupId(true);
    TextField<String> text = new TextField<>(ID_TEXT, createTextModel(value));
    text.add(new AjaxFormComponentUpdatingBehavior("blur") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
        }
    });
    text.setRequired(required);
    text.setEnabled(false);
    textWrapper.add(text);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
    feedback.setFilter(new ComponentFeedbackMessageFilter(text));
    textWrapper.add(feedback);
    AjaxLink edit = new AjaxLink(ID_EDIT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            editValuePerformed(target);
        }
    };
    edit.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return model.getObject().isEmpty();
        }
    });
    textWrapper.add(edit);
    add(textWrapper);
    initDialog(type, values);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 3 with ComponentFeedbackMessageFilter

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

the class TableConfigurationPanel method initPopoverLayout.

private void initPopoverLayout() {
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    Form form = new Form(ID_FORM);
    popover.add(form);
    AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(TableConfigurationPanel.this.get(createComponentPath(ID_POPOVER, ID_FORM, "inputFeedback")));
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            pageSizeChanged(target);
        }
    };
    form.add(button);
    TextField input = new TextField(ID_INPUT, createInputModel());
    input.add(new RangeValidator(5, 100));
    input.setLabel(createStringResource("PageSizePopover.title"));
    input.add(new SearchFormEnterBehavior(button));
    input.setType(Integer.class);
    input.setOutputMarkupId(true);
    FeedbackPanel feedback = new FeedbackPanel("inputFeedback", new ComponentFeedbackMessageFilter(input));
    feedback.setOutputMarkupId(true);
    form.add(feedback);
    form.add(input);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SearchFormEnterBehavior(com.evolveum.midpoint.web.util.SearchFormEnterBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) Form(org.apache.wicket.markup.html.form.Form) TextField(org.apache.wicket.markup.html.form.TextField) RangeValidator(org.apache.wicket.validation.validator.RangeValidator) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 4 with ComponentFeedbackMessageFilter

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

the class ValueChoosePanel method initLayout.

private void initLayout(final IModel<T> value, final List<PrismReferenceValue> values, final boolean required, Collection<Class<? extends O>> types) {
    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
    textWrapper.setOutputMarkupId(true);
    TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(value));
    text.add(new AjaxFormComponentUpdatingBehavior("blur") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
        }
    });
    text.setRequired(required);
    text.setEnabled(false);
    textWrapper.add(text);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
    textWrapper.add(feedback);
    AjaxLink<String> edit = new AjaxLink<String>(ID_EDIT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            editValuePerformed(values, target);
        }
    };
    textWrapper.add(edit);
    add(textWrapper);
    initButtons();
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) TextField(org.apache.wicket.markup.html.form.TextField) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 5 with ComponentFeedbackMessageFilter

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

the class MultiValueTextFormGroup method initLayout.

private void initLayout(final IModel<String> label, final String labelSize, final String textSize, final boolean required) {
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);
    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    StringBuilder sb = new StringBuilder();
                    if (StringUtils.isNotEmpty(textSize)) {
                        sb.append(textSize).append(' ');
                    }
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
                        sb.append(getOffsetClass()).append(' ');
                        sb.append(CLASS_MULTI_VALUE);
                    }
                    return sb.toString();
                }
            }));
            item.add(textWrapper);
            TextField text = new TextField(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("blur") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            text.setRequired(required);
            text.add(AttributeAppender.replace("placeholder", label));
            text.setLabel(label);
            textWrapper.add(text);
            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
            textWrapper.add(feedback);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
                        return CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    add(repeater);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) TextField(org.apache.wicket.markup.html.form.TextField) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)10 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)10 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)8 TextField (org.apache.wicket.markup.html.form.TextField)7 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)6 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)6 Label (org.apache.wicket.markup.html.basic.Label)5 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 ListItem (org.apache.wicket.markup.html.list.ListItem)4 ListView (org.apache.wicket.markup.html.list.ListView)4 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)4 AutoCompleteTextPanel (com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteTextPanel)1 PasswordPanel (com.evolveum.midpoint.gui.api.component.password.PasswordPanel)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)1 DateInput (com.evolveum.midpoint.web.component.DateInput)1 LockoutStatusPanel (com.evolveum.midpoint.web.component.LockoutStatusPanel)1 ValueChoosePanel (com.evolveum.midpoint.web.component.form.ValueChoosePanel)1 ModificationsPanel (com.evolveum.midpoint.web.component.model.delta.ModificationsPanel)1