Search in sources :

Example 11 with FeedbackMessage

use of org.apache.wicket.feedback.FeedbackMessage in project openmeetings by apache.

the class AbstractWicketTester method checkErrors.

public static void checkErrors(WicketTester tester, int count) {
    List<FeedbackMessage> errors = getErrors(tester);
    if (count != errors.size()) {
        for (FeedbackMessage fm : errors) {
            log.debug("Error {}", fm);
        }
    }
    assertEquals(String.format("There should be exactly %s errors", count), count, errors.size());
}
Also used : FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage)

Example 12 with FeedbackMessage

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

the class RunReportPopupPanel method initLayout.

protected void initLayout() {
    Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
    add(mainForm);
    FeedbackAlerts feedback = new FeedbackAlerts(ID_POPUP_FEEDBACK);
    ReportObjectsListPanel table = new ReportObjectsListPanel(ID_TABLE, getModel()) {

        private final boolean checkViewAfterInitialize = true;

        @Override
        public Component getFeedbackPanel() {
            return feedback;
        }

        @Override
        protected boolean checkViewAfterInitialize() {
            if (checkViewAfterInitialize) {
                return true;
            }
            return super.checkViewAfterInitialize();
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
    feedback.setFilter(new ComponentFeedbackMessageFilter(table) {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean accept(FeedbackMessage message) {
            return true;
        }
    });
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);
    AjaxSubmitButton runButton = new AjaxSubmitButton(ID_RUN_BUTTON, createStringResource("runReportPopupContent.button.run")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            FeedbackAlerts feedback = (FeedbackAlerts) getForm().get(ID_POPUP_FEEDBACK);
            target.add(feedback);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            runConfirmPerformed(target);
        }
    };
    runButton.setOutputMarkupId(true);
    runButton.add(new VisibleBehaviour(() -> isRunnable));
    mainForm.add(runButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("userBrowserDialog.button.cancelButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
        }
    };
    cancelButton.setOutputMarkupId(true);
    mainForm.add(cancelButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage)

Example 13 with FeedbackMessage

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

the class PageBase method onBeforeRender.

@Override
protected void onBeforeRender() {
    super.onBeforeRender();
    FeedbackMessages messages = getSession().getFeedbackMessages();
    for (FeedbackMessage message : messages) {
        getFeedbackMessages().add(message);
    }
    getSession().getFeedbackMessages().clear();
}
Also used : FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage) FeedbackMessages(org.apache.wicket.feedback.FeedbackMessages)

Example 14 with FeedbackMessage

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

the class ValidationErrorPanel method initHeader.

private void initHeader(WebMarkupContainer box) {
    WebMarkupContainer iconType = new WebMarkupContainer("iconType");
    iconType.setOutputMarkupId(true);
    iconType.add(new AttributeAppender("class", new IModel() {

        @Override
        public Object getObject() {
            FeedbackMessage result = getModelObject();
            if (result == null) {
                return " fa-info";
            }
            switch(result.getLevel()) {
                case FeedbackMessage.INFO:
                case FeedbackMessage.DEBUG:
                    return " fa-info";
                case FeedbackMessage.SUCCESS:
                    return " fa-check";
                case FeedbackMessage.ERROR:
                case FeedbackMessage.FATAL:
                    return " fa-ban";
                case FeedbackMessage.UNDEFINED:
                // TODO:
                case FeedbackMessage.WARNING:
                default:
                    return " fa-warning";
            }
        }
    }));
    box.add(iconType);
    Label message = new Label(ID_MESSAGE, new PropertyModel<Serializable>(getModel(), "message"));
    box.add(message);
    AjaxLink<Void> close = new AjaxLink<Void>("close") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            close(target);
        }
    };
    box.add(close);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) Serializable(java.io.Serializable) Label(org.apache.wicket.markup.html.basic.Label) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Aggregations

FeedbackMessage (org.apache.wicket.feedback.FeedbackMessage)14 Serializable (java.io.Serializable)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 FormComponent (org.apache.wicket.markup.html.form.FormComponent)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)2 Component (org.apache.wicket.Component)2 FeedbackMessages (org.apache.wicket.feedback.FeedbackMessages)2 IFeedbackMessageFilter (org.apache.wicket.feedback.IFeedbackMessageFilter)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 IModel (org.apache.wicket.model.IModel)2 OpResult (com.evolveum.midpoint.gui.api.component.result.OpResult)1 OperationResultPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPanel)1 ValidationErrorPanel (com.evolveum.midpoint.gui.api.component.result.ValidationErrorPanel)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 FeedbackAlerts (com.evolveum.midpoint.web.component.message.FeedbackAlerts)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AttributeModifier (org.apache.wicket.AttributeModifier)1