Search in sources :

Example 6 with SelectableListDataProvider

use of com.evolveum.midpoint.web.component.util.SelectableListDataProvider 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

SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)6 SelectableListDataProvider (com.evolveum.midpoint.web.component.util.SelectableListDataProvider)6 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)3 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)3 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)3 ArrayList (java.util.ArrayList)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 Label (org.apache.wicket.markup.html.basic.Label)3 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)2 Component (org.apache.wicket.Component)2 AjaxFallbackLink (org.apache.wicket.ajax.markup.html.AjaxFallbackLink)2 ResourceModel (org.apache.wicket.model.ResourceModel)2 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)1 OpResult (com.evolveum.midpoint.gui.api.component.result.OpResult)1 OperationResultPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPanel)1 OperationResultPopupPanel (com.evolveum.midpoint.gui.api.component.result.OperationResultPopupPanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1