Search in sources :

Example 1 with ValidationErrorPanel

use of com.evolveum.midpoint.gui.api.component.result.ValidationErrorPanel in project midpoint by Evolveum.

the class FeedbackListView method populateItem.

@Override
protected void populateItem(final ListItem<FeedbackMessage> item) {
    final FeedbackMessage message = item.getModelObject();
    if (message.getMessage() instanceof OpResult) {
        final OpResult opResult = (OpResult) message.getMessage();
        OperationResultPanel panel = new OperationResultPanel("message", Model.of(opResult)) {

            private static final long serialVersionUID = 1L;

            @Override
            public void close(AjaxRequestTarget target) {
                super.close(target);
                message.markRendered();
            }

            protected void onAfterRender() {
                opResult.setAlreadyShown(true);
                super.onAfterRender();
            }
        };
        panel.add(new VisibleBehaviour(() -> opResult != null && !opResult.isAlreadyShown()));
        panel.setOutputMarkupId(true);
        item.add(panel);
    } else {
        message.markRendered();
        ValidationErrorPanel validationPanel = new ValidationErrorPanel("message", item.getModel()) {

            private static final long serialVersionUID = 1L;

            @Override
            public void close(AjaxRequestTarget target) {
                super.close(target);
                message.markRendered();
            }
        };
        validationPanel.setOutputMarkupId(true);
        item.add(validationPanel);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ValidationErrorPanel(com.evolveum.midpoint.gui.api.component.result.ValidationErrorPanel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage)

Aggregations

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 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 FeedbackMessage (org.apache.wicket.feedback.FeedbackMessage)1