Search in sources :

Example 1 with OperationResultPanel

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

the class TaskResultTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
    SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this, new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
    TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setStyle("padding-top: 0px;");
    resultTablePanel.setShowPaging(false);
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    add(new AjaxFallbackLink(ID_SHOW_RESULT) {

        public void onClick(AjaxRequestTarget target) {
            OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
            OperationResultPanel body = new OperationResultPanel(pageBase.getMainPopupBodyId(), new Model<>(OpResult.getOpResult(pageBase, opResult)), pageBase);
            body.setOutputMarkupId(true);
            pageBase.showMainPopup(body, target);
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ArrayList(java.util.ArrayList) List(java.util.List) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 2 with OperationResultPanel

use of com.evolveum.midpoint.gui.api.component.result.OperationResultPanel 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)

Example 3 with OperationResultPanel

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

the class TestConnectionMessagesPanel method initResultsPanel.

public void initResultsPanel(RepeatingView resultView, List<OpResult> opresults, Page parentPage) {
    for (OpResult result : opresults) {
        OperationResultPanel resultPanel = new OperationResultPanel(resultView.newChildId(), new Model<>(result));
        resultPanel.add(new VisibleBehaviour(() -> result != null));
        resultPanel.setOutputMarkupId(true);
        resultView.add(resultPanel);
    }
}
Also used : 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)

Example 4 with OperationResultPanel

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

the class TaskResultTabPanel method initLayout.

private void initLayout() {
    IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(() -> createOperationResultList());
    SelectableListDataProvider<SelectableBean<OperationResult>, OperationResult> provider = new SelectableListDataProvider<>(this, resultModel);
    BoxedTablePanel<SelectableBean<OperationResult>> resultTablePanel = new BoxedTablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    AjaxFallbackLink<Void> showResult = new AjaxFallbackLink<Void>(ID_SHOW_RESULT) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
            if (!optionalTarget.isPresent()) {
                LOGGER.warn("Cannot show result in interactive way, request target not present.");
                return;
            }
            AjaxRequestTarget target = optionalTarget.get();
            PrismObjectWrapper<TaskType> taskWrapper = TaskResultTabPanel.this.getModelObject();
            TaskType taskType = taskWrapper.getObject().asObjectable();
            OperationResult opResult = OperationResult.createOperationResult(taskType.getResult());
            OpResult result = opResult != null ? OpResult.getOpResult(getPageBase(), opResult) : null;
            OperationResultPanel body = new OperationResultPanel(getPageBase().getMainPopupBodyId(), new Model<>(result));
            body.add(new VisibleBehaviour(() -> opResult != null));
            body.setOutputMarkupId(true);
            getPageBase().showMainPopup(body, target);
        }
    };
    showResult.setOutputMarkupId(true);
    add(showResult);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Aggregations

OperationResultPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPanel)4 OpResult (com.evolveum.midpoint.gui.api.component.result.OpResult)3 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 AjaxFallbackLink (org.apache.wicket.ajax.markup.html.AjaxFallbackLink)2 ValidationErrorPanel (com.evolveum.midpoint.gui.api.component.result.ValidationErrorPanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)1 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)1 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)1 SelectableListDataProvider (com.evolveum.midpoint.web.component.util.SelectableListDataProvider)1 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 FeedbackMessage (org.apache.wicket.feedback.FeedbackMessage)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 IModel (org.apache.wicket.model.IModel)1