Search in sources :

Example 6 with ComponentFeedbackMessageFilter

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

the class DropDownFormGroup method initLayout.

private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, final boolean required) {
    WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
    add(labelContainer);
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        labelContainer.add(AttributeAppender.prepend("class", labelSize));
    }
    labelContainer.add(l);
    Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
    tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(tooltipKey);
        }
    }));
    tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
    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 required;
        }
    });
    labelContainer.add(requiredContainer);
    WebMarkupContainer selectWrapper = new WebMarkupContainer(ID_SELECT_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        selectWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(selectWrapper);
    DropDownChoice select = createDropDown(ID_SELECT, choices, renderer, required);
    select.setLabel(label);
    selectWrapper.add(select);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(select));
    feedback.setOutputMarkupId(true);
    selectWrapper.add(feedback);
    Component additionalInfo = createAdditionalInfoComponent(ID_ADDITIONAL_INFO);
    if (additionalInfo == null) {
        additionalInfo = new Label(ID_ADDITIONAL_INFO, "");
    }
    selectWrapper.add(additionalInfo);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 7 with ComponentFeedbackMessageFilter

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

the class GenericMultiValueLabelEditPanel method initLayout.

private void initLayout(final IModel<String> label, final String labelSize, final String textSize) {
    Label l = new Label(ID_LABEL, label);
    l.setVisible(getLabelVisibility());
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);
    WebMarkupContainer addFirstContainer = new WebMarkupContainer(ID_ADD_FIRST_CONTAINER);
    addFirstContainer.setOutputMarkupId(true);
    addFirstContainer.setOutputMarkupPlaceholderTag(true);
    addFirstContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().isEmpty();
        }
    });
    add(addFirstContainer);
    AjaxLink addFirst = new AjaxLink(ID_ADD_FIRST) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addFirstPerformed(target);
        }
    };
    addFirstContainer.add(addFirst);
    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> listItem) {
            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 (listItem.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) {
                        sb.append(getOffsetClass()).append(' ');
                        sb.append(CLASS_MULTI_VALUE);
                    }
                    return sb.toString();
                }
            }));
            listItem.add(textWrapper);
            TextField text = new TextField<>(ID_TEXT, createTextModel(listItem.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("blur") {

                @Override
                protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
                }
            });
            text.setEnabled(false);
            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 (listItem.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) {
                        return CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            AjaxLink edit = new AjaxLink(ID_EDIT) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    editValuePerformed(target, listItem.getModel());
                }
            };
            textWrapper.add(edit);
            listItem.add(buttonGroup);
            initButtons(buttonGroup, listItem);
        }
    };
    add(repeater);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 8 with ComponentFeedbackMessageFilter

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

the class MultiValueChoosePanel method initLayout.

private void initLayout(final IModel<List<T>> chosenValues, final List<PrismReferenceValue> filterValues, final boolean required, final boolean multiselect) {
    AjaxLink<String> edit = new AjaxLink<String>(ID_EDIT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            editValuePerformed(chosenValues.getObject(), filterValues, target, multiselect);
        }
    };
    edit.setOutputMarkupPlaceholderTag(true);
    add(edit);
    ListView<T> selectedRowsList = new ListView<T>(ID_SELECTED_ROWS, chosenValues) {

        @Override
        protected void populateItem(ListItem<T> item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.setOutputMarkupPlaceholderTag(true);
            //was value
            TextField<String> text = new TextField<String>(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("blur") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
                }
            });
            text.setRequired(required);
            text.setEnabled(false);
            text.setOutputMarkupPlaceholderTag(true);
            textWrapper.add(text);
            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
            feedback.setOutputMarkupPlaceholderTag(true);
            textWrapper.add(feedback);
            initButtons(item, item);
            item.add(textWrapper);
        }
    };
    selectedRowsList.setReuseItems(true);
    add(selectedRowsList);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 9 with ComponentFeedbackMessageFilter

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

the class DateFormGroup method initLayout.

private void initLayout(IModel<String> label, String labelSize, String textSize, boolean required) {
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        l.add(AttributeAppender.prepend("class", labelSize));
    }
    add(l);
    WebMarkupContainer dateWrapper = new WebMarkupContainer(ID_DATE_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        dateWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(dateWrapper);
    DateInput date = new DateInput(ID_DATE, new XmlGregorianCalendarModel(getModel()));
    date.setRequired(required);
    date.setLabel(label);
    dateWrapper.add(date);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(date));
    dateWrapper.add(feedback);
}
Also used : ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) XmlGregorianCalendarModel(com.evolveum.midpoint.web.model.XmlGregorianCalendarModel) Label(org.apache.wicket.markup.html.basic.Label) DateInput(com.evolveum.midpoint.web.component.DateInput) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 10 with ComponentFeedbackMessageFilter

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

the class ObjectPolicyConfigurationEditor method initLayout.

protected void initLayout() {
    final Label label = new Label(ID_LABEL, createStringResource("objectPolicyConfigurationEditor.label"));
    add(label);
    ListView<ObjectPolicyConfigurationTypeDto> repeater = new ListView<ObjectPolicyConfigurationTypeDto>(ID_REPEATER, getModel()) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return OFFSET_CLASS + " " + CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(textWrapper);
            TextField<String> name = new TextField<>(ID_NAME, createNameModel(item.getModel()));
            name.setOutputMarkupId(true);
            name.add(new AjaxFormComponentUpdatingBehavior("blur") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            name.setEnabled(false);
            name.add(AttributeAppender.replace("placeholder", createStringResource("objectPolicyConfigurationEditor.name.placeholder")));
            textWrapper.add(name);
            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(name));
            textWrapper.add(feedback);
            AjaxLink<String> edit = new AjaxLink<String>(ID_BUTTON_EDIT) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    editPerformed(target, item);
                }
            };
            textWrapper.add(edit);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    //        initDialog();
    repeater.setOutputMarkupId(true);
    add(repeater);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ObjectPolicyConfigurationTypeDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectPolicyConfigurationTypeDto)

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